class VagrantPlugins::OpenNebulaProvider::Config
Attributes
auth[RW]
cpu[RW]
disk_size[RW]
endpoint[RW]
memory[RW]
os_tpl[RW]
password[RW]
resource_tpl[RW]
template[RW]
template_id[RW]
template_name[RW]
title[RW]
username[RW]
vcpu[RW]
Public Class Methods
new()
click to toggle source
# File lib/opennebula-provider/config.rb, line 19 def initialize @endpoint = ENV['ONE_XMLRPC'] || ENV['ONE_ENDPOINT'] || UNSET_VALUE @auth = UNSET_VALUE @username = ENV['ONE_USER'] || UNSET_VALUE @password = ENV['ONE_PASSWORD'] || UNSET_VALUE @template_id = UNSET_VALUE @template_name = UNSET_VALUE @os_tpl = UNSET_VALUE @resource_tpl = UNSET_VALUE @title = UNSET_VALUE @memory = UNSET_VALUE @cpu = UNSET_VALUE @vcpu = UNSET_VALUE @disk_size = UNSET_VALUE end
Public Instance Methods
finalize!()
click to toggle source
# File lib/opennebula-provider/config.rb, line 35 def finalize! @endpoint = nil if @endpoint == UNSET_VALUE || @endpoint.empty? @auth = 'basic' if @auth == UNSET_VALUE @username = nil if @username == UNSET_VALUE @password = nil if @password == UNSET_VALUE @template_id = nil if @template_id == UNSET_VALUE @template_name = nil if @template_name == UNSET_VALUE if @template_id @template = @template_id elsif @template_name @template = @template_name elsif @template == UNSET_VALUE @template = nil end @resource_tpl = 'small' if @resource_tpl == UNSET_VALUE @title = nil if @title == UNSET_VALUE @memory = nil if @memory == UNSET_VALUE @vcpu = nil if @vcpu == UNSET_VALUE @cpu = nil if @cpu == UNSET_VALUE if @cpu && ! @vcpu @vcpu = @cpu end @disk_size = nil if @disk_size == UNSET_VALUE end
validate(machine)
click to toggle source
# File lib/opennebula-provider/config.rb, line 60 def validate(machine) errors = [] errors << I18n.t('opennebula_provider.config.endpoint') unless @endpoint errors << I18n.t('opennebula_provider.config.username') unless @username errors << I18n.t('opennebula_provider.config.password') unless @password errors << I18n.t('opennebula_provider.config.template') unless @template errors << I18n.t('opennebula_provider.config.title') unless @title { 'OpenNebula provider' => errors } end