class VagrantPlugins::VSphere::Config

Attributes

addressType[RW]
clone_from_vm[RW]
compute_resource_name[RW]
cpu_count[RW]
cpu_reservation[RW]
custom_attributes[R]
customization_spec_name[RW]
data_center_name[RW]
data_store_name[RW]
host[RW]
insecure[RW]
linked_clone[RW]
mac[RW]
mem_reservation[RW]
memory_mb[RW]
name[RW]
password[RW]
proxy_host[RW]
proxy_port[RW]
resource_pool_name[RW]
template_name[RW]
user[RW]
vlan[RW]
vm_base_path[RW]

Public Class Methods

new() click to toggle source
# File lib/vSphere/config.rb, line 32
def initialize
  @custom_attributes = {}
end

Public Instance Methods

custom_attribute(key, value) click to toggle source
# File lib/vSphere/config.rb, line 36
def custom_attribute(key, value)
  @custom_attributes[key.to_sym] = value
end
validate(machine) click to toggle source
# File lib/vSphere/config.rb, line 40
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