Class: VagrantPlugins::VSphere::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::VSphere::Config
- Defined in:
- lib/vSphere/config.rb
Instance Attribute Summary collapse
-
#addressType ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#clone_from_vm ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#compute_resource_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#cpu_count ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#cpu_reservation ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#custom_attributes ⇒ Object
readonly
Returns the value of attribute custom_attributes.
-
#customization_spec_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#data_center_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#data_store_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#extra_config ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#host ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#insecure ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#ip_address_timeout ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#linked_clone ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#mac ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#mem_reservation ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#memory_mb ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#notes ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#password ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#proxy_host ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#proxy_port ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#real_nic_ip ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#resource_pool_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#template_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#user ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#vlan ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#vm_base_path ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
-
#wait_for_sysprep ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer].
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.
12 13 14 15 16 17 |
# File 'lib/vSphere/config.rb', line 12 def initialize @ip_address_timeout = UNSET_VALUE @wait_for_sysprep = UNSET_VALUE @custom_attributes = {} @extra_config = {} end |
Instance Attribute Details
#addressType ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def addressType @addressType end |
#clone_from_vm ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def clone_from_vm @clone_from_vm end |
#compute_resource_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def compute_resource_name @compute_resource_name end |
#cpu_count ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def cpu_count @cpu_count end |
#cpu_reservation ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def cpu_reservation @cpu_reservation end |
#custom_attributes ⇒ Object (readonly)
Returns the value of attribute custom_attributes.
10 11 12 |
# File 'lib/vSphere/config.rb', line 10 def custom_attributes @custom_attributes end |
#customization_spec_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def customization_spec_name @customization_spec_name end |
#data_center_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def data_center_name @data_center_name end |
#data_store_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def data_store_name @data_store_name end |
#extra_config ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def extra_config @extra_config end |
#host ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def host @host end |
#insecure ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
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]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def ip_address_timeout @ip_address_timeout end |
#linked_clone ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def linked_clone @linked_clone end |
#mac ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def mac @mac end |
#mem_reservation ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def mem_reservation @mem_reservation end |
#memory_mb ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def memory_mb @memory_mb end |
#name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def name @name end |
#notes ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def notes @notes end |
#password ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def password @password end |
#proxy_host ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def proxy_host @proxy_host end |
#proxy_port ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def proxy_port @proxy_port end |
#real_nic_ip ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def real_nic_ip @real_nic_ip end |
#resource_pool_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def resource_pool_name @resource_pool_name end |
#template_name ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def template_name @template_name end |
#user ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def user @user end |
#vlan ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def vlan @vlan end |
#vm_base_path ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def vm_base_path @vm_base_path end |
#wait_for_sysprep ⇒ Object
Time to wait for an IP address when booting, in seconds @return [Integer]
8 9 10 |
# File 'lib/vSphere/config.rb', line 8 def wait_for_sysprep @wait_for_sysprep end |
Instance Method Details
#custom_attribute(key, value) ⇒ Object
24 25 26 |
# File 'lib/vSphere/config.rb', line 24 def custom_attribute(key, value) @custom_attributes[key.to_sym] = value end |
#finalize! ⇒ Object
19 20 21 22 |
# File 'lib/vSphere/config.rb', line 19 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
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vSphere/config.rb', line 28 def validate(machine) errors = _detected_errors self.password = machine.ui.ask('vSphere Password (will be hidden): ', echo: false) if password == :ask || password.nil? # 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 |