Class: VagrantPlugins::Abiquo::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-abiquo/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-abiquo/config.rb', line 16

def initialize
  @abiquo_api_user        = UNSET_VALUE
  @abiquo_api_password    = UNSET_VALUE
  @virtualdatacenter      = UNSET_VALUE
  @virtualappliance       = UNSET_VALUE
  @label                  = UNSET_VALUE
  @template               = UNSET_VALUE
  @setup                  = UNSET_VALUE
end

Instance Attribute Details

#abiquo_api_passwordObject

Returns the value of attribute abiquo_api_password.



5
6
7
# File 'lib/vagrant-abiquo/config.rb', line 5

def abiquo_api_password
  @abiquo_api_password
end

#abiquo_api_uriObject

Returns the value of attribute abiquo_api_uri.



6
7
8
# File 'lib/vagrant-abiquo/config.rb', line 6

def abiquo_api_uri
  @abiquo_api_uri
end

#abiquo_api_userObject

Returns the value of attribute abiquo_api_user.



4
5
6
# File 'lib/vagrant-abiquo/config.rb', line 4

def abiquo_api_user
  @abiquo_api_user
end

#exposed_nicObject

Returns the value of attribute exposed_nic.



10
11
12
# File 'lib/vagrant-abiquo/config.rb', line 10

def exposed_nic
  @exposed_nic
end

#labelObject

Returns the value of attribute label.



9
10
11
# File 'lib/vagrant-abiquo/config.rb', line 9

def label
  @label
end

#setupObject Also known as: setup?

Returns the value of attribute setup.



12
13
14
# File 'lib/vagrant-abiquo/config.rb', line 12

def setup
  @setup
end

#templateObject

Returns the value of attribute template.



11
12
13
# File 'lib/vagrant-abiquo/config.rb', line 11

def template
  @template
end

#virtualapplianceObject

Returns the value of attribute virtualappliance.



8
9
10
# File 'lib/vagrant-abiquo/config.rb', line 8

def virtualappliance
  @virtualappliance
end

#virtualdatacenterObject

Returns the value of attribute virtualdatacenter.



7
8
9
# File 'lib/vagrant-abiquo/config.rb', line 7

def virtualdatacenter
  @virtualdatacenter
end

Instance Method Details

#finalize!Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/vagrant-abiquo/config.rb', line 26

def finalize!
  @abiquo_api_user        = ENV['ABIQUO_API_USER'] if @abiquo_api_user == UNSET_VALUE
  @abiquo_api_password    = ENV['ABIQUO_API_PASSWORD'] if @abiquo_api_password == UNSET_VALUE
  @abiquo_api_uri         = ENV['ABIQUO_API_URI'] if @abiquo_api_uri == UNSET_VALUE
  @virtualdatacenter      = 'VagrantVDC' if @virtualdatacenter == UNSET_VALUE
  @virtualappliance       = 'VagrantVAPP' if @virtualappliance == UNSET_VALUE
  @label                  = 'VagrantVM' if @label == UNSET_VALUE
  @template               = 'TemplateImage' if @template == UNSET_VALUE
  @setup                  = true if @setup == UNSET_VALUE
end

#validate(machine) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/vagrant-abiquo/config.rb', line 37

def validate(machine)
  errors = []
  errors << I18n.t('vagrant_abiquo.config.abiquo_api_user') if !@abiquo_api_user
  errors << I18n.t('vagrant_abiquo.config.abiquo_api_password') if !@abiquo_api_password
  errors << I18n.t('vagrant_abiquo.config.abiquo_api_uri') if !@abiquo_api_uri
  errors << I18n.t('vagrant_abiquo.config.virtualdatacenter') if !@virtualdatacenter
  errors << I18n.t('vagrant_abiquo.config.template') if !@template

  { 'Abiquo Provider' => errors }
end