Class: Chef::Knife::Cloud::VcenterVmDelete

Inherits:
ServerDeleteCommand
  • Object
show all
Includes:
VcenterServiceOptions, ServerDeleteOptions
Defined in:
lib/chef/knife/vcenter_vm_delete.rb

Overview

Extends the SeverDeleteCommand for specifically vCenter

Instance Method Summary collapse

Methods included from VcenterServiceOptions

included

Instance Method Details

#execute_commandObject

Executes the command against vCenter and the Chef Server



53
54
55
56
57
58
# File 'lib/chef/knife/vcenter_vm_delete.rb', line 53

def execute_command
  @name_args.each do |name|
    service.delete_vm(name)
    delete_from_chef(name)
  end
end

#validate_params!Object

rubocop:disable Style/GuardClause Validates the parameters to make sure we’re good.



44
45
46
47
48
49
# File 'lib/chef/knife/vcenter_vm_delete.rb', line 44

def validate_params!
  if @name_args.empty?
    ui.error("You must supply the name of the virtual machine to delete.")
    exit(1) if @name_args.empty?
  end
end