Class: VagrantPlugins::VSphere::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::VSphere::Config
- Defined in:
- lib/vSphere/config.rb
Instance Attribute Summary collapse
-
#addressType ⇒ Object
Returns the value of attribute addressType.
-
#clone_from_vm ⇒ Object
Returns the value of attribute clone_from_vm.
-
#compute_resource_name ⇒ Object
Returns the value of attribute compute_resource_name.
-
#cpu_count ⇒ Object
Returns the value of attribute cpu_count.
-
#cpu_reservation ⇒ Object
Returns the value of attribute cpu_reservation.
-
#custom_attributes ⇒ Object
readonly
Returns the value of attribute custom_attributes.
-
#customization_spec_name ⇒ Object
Returns the value of attribute customization_spec_name.
-
#data_center_name ⇒ Object
Returns the value of attribute data_center_name.
-
#data_store_name ⇒ Object
Returns the value of attribute data_store_name.
-
#extra_config ⇒ Object
Returns the value of attribute extra_config.
-
#host ⇒ Object
Returns the value of attribute host.
-
#insecure ⇒ Object
Returns the value of attribute insecure.
-
#ip_address_timeout ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#linked_clone ⇒ Object
Returns the value of attribute linked_clone.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#mem_reservation ⇒ Object
Returns the value of attribute mem_reservation.
-
#memory_mb ⇒ Object
Returns the value of attribute memory_mb.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#real_nic_ip ⇒ Object
Returns the value of attribute real_nic_ip.
-
#resource_pool_name ⇒ Object
Returns the value of attribute resource_pool_name.
-
#template_name ⇒ Object
Returns the value of attribute template_name.
-
#user ⇒ Object
Returns the value of attribute user.
-
#vlan ⇒ Object
Returns the value of attribute vlan.
-
#vm_base_path ⇒ Object
Returns the value of attribute vm_base_path.
-
#wait_for_sysprep ⇒ Object
Returns the value of attribute wait_for_sysprep.
Instance Method Summary collapse
- #custom_attribute(key, value) ⇒ Object
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
37 38 39 40 41 42 |
# File 'lib/vSphere/config.rb', line 37 def initialize @ip_address_timeout = UNSET_VALUE @wait_for_sysprep = UNSET_VALUE @custom_attributes = {} @extra_config = {} end |
Instance Attribute Details
#addressType ⇒ Object
Returns the value of attribute addressType.
24 25 26 |
# File 'lib/vSphere/config.rb', line 24 def addressType @addressType end |
#clone_from_vm ⇒ Object
Returns the value of attribute clone_from_vm.
14 15 16 |
# File 'lib/vSphere/config.rb', line 14 def clone_from_vm @clone_from_vm end |
#compute_resource_name ⇒ Object
Returns the value of attribute compute_resource_name.
12 13 14 |
# File 'lib/vSphere/config.rb', line 12 def compute_resource_name @compute_resource_name end |
#cpu_count ⇒ Object
Returns the value of attribute cpu_count.
27 28 29 |
# File 'lib/vSphere/config.rb', line 27 def cpu_count @cpu_count end |
#cpu_reservation ⇒ Object
Returns the value of attribute cpu_reservation.
28 29 30 |
# File 'lib/vSphere/config.rb', line 28 def cpu_reservation @cpu_reservation end |
#custom_attributes ⇒ Object (readonly)
Returns the value of attribute custom_attributes.
35 36 37 |
# File 'lib/vSphere/config.rb', line 35 def custom_attributes @custom_attributes end |
#customization_spec_name ⇒ Object
Returns the value of attribute customization_spec_name.
18 19 20 |
# File 'lib/vSphere/config.rb', line 18 def customization_spec_name @customization_spec_name end |
#data_center_name ⇒ Object
Returns the value of attribute data_center_name.
11 12 13 |
# File 'lib/vSphere/config.rb', line 11 def data_center_name @data_center_name end |
#data_store_name ⇒ Object
Returns the value of attribute data_store_name.
19 20 21 |
# File 'lib/vSphere/config.rb', line 19 def data_store_name @data_store_name end |
#extra_config ⇒ Object
Returns the value of attribute extra_config.
30 31 32 |
# File 'lib/vSphere/config.rb', line 30 def extra_config @extra_config end |
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/vSphere/config.rb', line 7 def host @host end |
#insecure ⇒ Object
Returns the value of attribute insecure.
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def insecure @insecure end |
#ip_address_timeout ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
6 7 8 |
# File 'lib/vSphere/config.rb', line 6 def ip_address_timeout @ip_address_timeout end |
#linked_clone ⇒ Object
Returns the value of attribute linked_clone.
20 21 22 |
# File 'lib/vSphere/config.rb', line 20 def linked_clone @linked_clone end |
#mac ⇒ Object
Returns the value of attribute mac.
25 26 27 |
# File 'lib/vSphere/config.rb', line 25 def mac @mac end |
#mem_reservation ⇒ Object
Returns the value of attribute mem_reservation.
29 30 31 |
# File 'lib/vSphere/config.rb', line 29 def mem_reservation @mem_reservation end |
#memory_mb ⇒ Object
Returns the value of attribute memory_mb.
26 27 28 |
# File 'lib/vSphere/config.rb', line 26 def memory_mb @memory_mb end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/vSphere/config.rb', line 16 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
32 33 34 |
# File 'lib/vSphere/config.rb', line 32 def notes @notes end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/vSphere/config.rb', line 10 def password @password end |
#proxy_host ⇒ Object
Returns the value of attribute proxy_host.
21 22 23 |
# File 'lib/vSphere/config.rb', line 21 def proxy_host @proxy_host end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
22 23 24 |
# File 'lib/vSphere/config.rb', line 22 def proxy_port @proxy_port end |
#real_nic_ip ⇒ Object
Returns the value of attribute real_nic_ip.
31 32 33 |
# File 'lib/vSphere/config.rb', line 31 def real_nic_ip @real_nic_ip end |
#resource_pool_name ⇒ Object
Returns the value of attribute resource_pool_name.
13 14 15 |
# File 'lib/vSphere/config.rb', line 13 def resource_pool_name @resource_pool_name end |
#template_name ⇒ Object
Returns the value of attribute template_name.
15 16 17 |
# File 'lib/vSphere/config.rb', line 15 def template_name @template_name end |
#user ⇒ Object
Returns the value of attribute user.
9 10 11 |
# File 'lib/vSphere/config.rb', line 9 def user @user end |
#vlan ⇒ Object
Returns the value of attribute vlan.
23 24 25 |
# File 'lib/vSphere/config.rb', line 23 def vlan @vlan end |
#vm_base_path ⇒ Object
Returns the value of attribute vm_base_path.
17 18 19 |
# File 'lib/vSphere/config.rb', line 17 def vm_base_path @vm_base_path end |
#wait_for_sysprep ⇒ Object
Returns the value of attribute wait_for_sysprep.
33 34 35 |
# File 'lib/vSphere/config.rb', line 33 def wait_for_sysprep @wait_for_sysprep end |
Instance Method Details
#custom_attribute(key, value) ⇒ Object
49 50 51 |
# File 'lib/vSphere/config.rb', line 49 def custom_attribute(key, value) @custom_attributes[key.to_sym] = value end |
#finalize! ⇒ Object
44 45 46 47 |
# File 'lib/vSphere/config.rb', line 44 def finalize! @ip_address_timeout = 240 if @ip_address_timeout == UNSET_VALUE @wait_for_sysprep = false if @wait_for_sysprep == UNSET_VALUE end |
#validate(machine) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vSphere/config.rb', line 53 def validate(machine) errors = _detected_errors if password == :ask || password.nil? self.password = machine.ui.ask('vSphere Password (will be hidden): ', echo: false) end # TODO: add blank? errors << I18n.t('vsphere.config.host') if host.nil? errors << I18n.t('vsphere.config.user') if user.nil? errors << I18n.t('vsphere.config.password') if password.nil? errors << I18n.t('vsphere.config.template') if template_name.nil? # Only required if we're cloning from an actual template errors << I18n.t('vsphere.config.compute_resource') if compute_resource_name.nil? && !clone_from_vm { 'vSphere Provider' => errors } end |