Class: Chef::Knife::OktawaveOciRestart

Inherits:
Chef::Knife show all
Includes:
OktawaveBase
Defined in:
lib/chef/knife/oktawave_oci_restart.rb

Instance Method Summary collapse

Methods included from OktawaveBase

#api, #get_oci, included, #msg_pair, #oci_not_found, #print_oci_summary, #validate!

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/chef/knife/oktawave_oci_restart.rb', line 8

def run
  validate!
  if name_args.length < 1
    show_usage
    ui.fatal('You must specify the OCI ID (try "knife oktawave oci list")')
    exit 1
  end
  id = name_args[0]
  oci = api.oci_get(id)
  api.oci_restart(id)
  puts "Instance \##{id} (#{oci[:virtual_machine_name]}) restarted."
end