Class: Chef::Knife::ClcServerPowerOff

Inherits:
Chef::Knife show all
Includes:
ClcBase
Defined in:
lib/chef/knife/clc_server_power_off.rb

Instance Method Summary collapse

Methods included from ClcBase

included

Instance Method Details

#executeObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# 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_parametersObject



17
18
19
20
21
# 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