class Chef::Knife::ClcServerPowerOff

Public Instance Methods

execute() click to toggle source
# File lib/chef/knife/clc_server_power_off.rb, line 23
def execute
  ui.info 'Requesting server power off...'
  links = connection.power_off_server(name_args[0])

  if config[:clc_wait]
    connection.wait_for(links['operation']['id']) { putc '.' }
    ui.info "\n"
    ui.info 'Server has been powered off'
  else
    ui.info 'Power off request has been sent'
    ui.info "You can check power off operation status with 'knife clc operation show #{links['operation']['id']}'"
  end
end
parse_and_validate_parameters() click to toggle source
# File lib/chef/knife/clc_server_power_off.rb, line 17
def parse_and_validate_parameters
  unless name_args[0]
    errors << 'Server ID is required'
  end
end