Class: Chef::Knife::OneandoneServerStart

Inherits:
Chef::Knife show all
Includes:
OneandoneBase
Defined in:
lib/chef/knife/oneandone_server_start.rb

Instance Method Summary collapse

Methods included from OneandoneBase

#formated_output, included, #init_client

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/chef/knife/oneandone_server_start.rb', line 15

def run
  $stdout.sync = true

  init_client

  name_args.each do |server_id|
    server = OneAndOne::Server.new
    response = server.change_status(server_id: server_id, action: 'POWER_ON')

    if config[:wait]
      puts ui.color('Starting, wait for the operation to complete...', :cyan).to_s
      server.wait_for
      puts "Server '#{server.specs['name']}' is #{ui.color('started', :bold)}"
    else
      puts "Server '#{response['name']}' is #{ui.color('starting', :bold)}"
    end
  end
end