Class: Chef::Knife::ProfitbricksServerStop
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksServerStop
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_server_stop.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, #error_and_exit, #get_image, included, #msg_pair, #validate_required_params
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/chef/knife/profitbricks_server_stop.rb', line 16 def run connection @name_args.each do |server_id| begin server = ProfitBricks::Server.get(Chef::Config[:knife][:datacenter_id], server_id) rescue Excon::Errors::NotFound ui.error("Server ID #{server_id} not found. Skipping.") next end server.stop ui.warn("Server #{server.id} is stopping") end end |