Class: Chef::Knife::ProfitbricksServerStart

Inherits:
Chef::Knife
  • Object
show all
Includes:
ProfitbricksBase
Defined in:
lib/chef/knife/profitbricks_server_start.rb

Instance Method Summary collapse

Methods included from ProfitbricksBase

#connection, included, #msg_pair

Instance Method Details

#runObject



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

def run
  connection
  @name_args.each do |server_id|
    begin
      server = ProfitBricks::Server.get(config[:datacenter_id], server_id)
    rescue Excon::Errors::NotFound
      ui.error("Server ID #{server_id} not found. Skipping.")
      next
    end

    server.start
    ui.warn("Server #{server.id} is starting")
  end
end