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

Inherits:
ServerDeleteCommand
  • Object
show all
Includes:
VcenterServiceHelpers, 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 VcenterServiceHelpers

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

Methods included from VcenterServiceOptions

included

Instance Method Details

#execute_commandObject

Executes the command against vCenter and the Chef Server



50
51
52
53
54
55
# File 'lib/chef/knife/vcenter_vm_delete.rb', line 50

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.



41
42
43
44
45
46
# File 'lib/chef/knife/vcenter_vm_delete.rb', line 41

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