Class: Chef::Knife::Cloud::VcenterVmCreate

Inherits:
ServerCreateCommand
  • Object
show all
Includes:
VcenterServiceHelpers, VcenterServiceOptions, ServerCreateOptions
Defined in:
lib/chef/knife/vcenter_vm_create.rb

Overview

Extends the ServerCreateCommand for specific vCenter

Instance Method Summary collapse

Methods included from VcenterServiceOptions

included

Methods included from VcenterServiceHelpers

#check_for_missing_config_values!, #create_service_instance, #validate!, #verify_ssl?

Instance Method Details

#before_exec_commandObject

Sets up the create options and puts them



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/chef/knife/vcenter_vm_create.rb', line 70

def before_exec_command
  super

  @create_options = {
    name: @name_args[0],
    type: "create",
    targethost: locate_config_value(:targethost),
    folder: locate_config_value(:folder),
    datastore: locate_config_value(:datastore),
    resource_pool: locate_config_value(:resource_pool),
  }

  puts @create_options
end

#validate_params!Object

Validates the parameters, you need that unique name person!



58
59
60
61
62
63
64
65
66
# File 'lib/chef/knife/vcenter_vm_create.rb', line 58

def validate_params!
  super

  if @name_args.empty?
    ui.error("You must provide the name of the new machine")
  end

  check_for_missing_config_values!(:targethost, :datastore, :folder)
end