Class: Chef::Knife::Cloud::VraServerDelete

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

Instance Method Summary collapse

Methods included from VraServiceOptions

included

Instance Method Details

#execute_commandObject

overriding this method from knife-cloud so we can pull the machine name to pass to delete_from_chef rather than the resource ID



51
52
53
54
55
56
57
# File 'lib/chef/knife/vra_server_delete.rb', line 51

def execute_command
  @name_args.each do |resource_id|
    server = service.get_server(resource_id)
    service.delete_server(resource_id)
    delete_from_chef(server.name)
  end
end

#validate_params!Object

rubocop:disable Style/GuardClause



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

def validate_params!
  if @name_args.empty?
    ui.error("You must supply a resource ID of a server to delete.")
    exit(1) if @name_args.empty?
  end
end