class Chef::Knife::Cloud::VraServerDelete

Public Instance Methods

execute_command() click to toggle source

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

# 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!() click to toggle source

rubocop:disable Style/GuardClause

# 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