Class: Chef::Knife::ProfitbricksVolumeDetach
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksVolumeDetach
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_volume_detach.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, included, #msg_pair
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/chef/knife/profitbricks_volume_detach.rb', line 23 def run connection @name_args.each do |volume_id| begin volume = ProfitBricks::Volume.get(config[:datacenter_id], nil, volume_id) rescue Excon::Errors::NotFound ui.error("Volume ID #{volume_id} not found. Skipping.") next end msg_pair('ID', volume.id) msg_pair('Name', volume.properties['name']) msg_pair('Size', volume.properties['size']) msg_pair('Bus', volume.properties['bus']) msg_pair('Device Number', volume.properties['deviceNumber']) confirm('Do you really want to detach this volume') volume.detach(config[:server_id]) ui.msg("Detaching volume #{volume_id} from server") end end |