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

Inherits:
ServerCreateCommand
  • Object
show all
Includes:
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

Instance Method Details

#before_exec_commandObject

Sets up the create options and puts them



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/chef/knife/vcenter_vm_create.rb', line 73

def before_exec_command
  super

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

  puts @create_options
end

#validate_params!Object

Validates the parameters, you need that unique name person!



61
62
63
64
65
66
67
68
69
# File 'lib/chef/knife/vcenter_vm_create.rb', line 61

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