Class: Chef::Knife::ProfitbricksDatacenterDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksDatacenterDelete
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_datacenter_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
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/knife/profitbricks_datacenter_delete.rb', line 19 def run connection @name_args.each do |datacenter_id| begin datacenter = ProfitBricks::Datacenter.get(datacenter_id) rescue Excon::Errors::NotFound ui.error("Data center ID #{datacenter_id} not found. Skipping.") next end msg_pair('ID', datacenter.id) msg_pair('Name', datacenter.properties['name']) msg_pair('Description', datacenter.properties['description']) msg_pair('Location', datacenter.properties['location']) msg_pair('Version', datacenter.properties['version']) puts "\n" confirm('Do you really want to delete this data center') datacenter.delete ui.warn("Deleted data center #{datacenter.id}") end end |