lib/vagrant-vcenter/config.rb in vagrant-vcenter-0.3.1 vs lib/vagrant-vcenter/config.rb in vagrant-vcenter-0.3.2

- old
+ new

@@ -26,10 +26,15 @@ # Catalog Name where the item resides # # @return [String] attr_accessor :folder_name + # Resource Pool Name where the item will live + # + # @return [String] + attr_accessor :resourcepool_name + # Catalog Name where the item resides # # @return [String] attr_accessor :template_folder_name @@ -73,10 +78,24 @@ # DistributedVirtualSwitchPort # # @return [String] attr_accessor :vm_network_type + # Use prep and customization api in the building + # of the vm in vcenter + # + # Mostly this allows the static ip configuration + # of a vm + # + # @return [Bool] + attr_accessor :enable_vm_customization + + # Type of the machine prep to use + # + # @return [String] + attr_accessor :prep_type + # num cpu # # @return [Fixnum] attr_accessor :num_cpu @@ -91,10 +110,15 @@ # connection handle attr_accessor :vcenter_cnx attr_accessor :template_id + def initialize + @prep_type = 'linux' + @enable_vm_customization = true + end + def validate(machine) errors = _detected_errors # TODO: add blank? errors << @@ -109,10 +133,13 @@ I18n.t('vagrant_vcenter.config.datacenter_name') if datacenter_name.nil? errors << I18n.t('vagrant_vcenter.config.computer_name') if computer_name.nil? errors << I18n.t('vagrant_vcenter.config.network_name') if network_name.nil? - + if enable_vm_customization + errors << + I18n.t('vagrant_vcenter.config.no_prep_type') if prep_type.downcase != 'linux' && prep_type.downcase != 'windows' + end { 'vCenter Provider' => errors } end end end end