Class: Chef::Knife::ProfitbricksServerDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksServerDelete
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_server_delete.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 30 31 32 33 34 35 36 37 |
# File 'lib/chef/knife/profitbricks_server_delete.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 msg_pair('ID', server.id) msg_pair('Name', server.properties['name']) msg_pair('Cores', server.properties['cores']) msg_pair('RAM', server.properties['ram']) msg_pair('Availability Zone', server.properties['availabilityZone']) confirm('Do you really want to delete this server') server.delete ui.warn("Deleted server #{server.id}") end end |