Class: Chef::Knife::SceVolumeDetach

Inherits:
Chef::Knife show all
Includes:
SceBase
Defined in:
lib/chef/knife/sce_volume_detach.rb

Instance Method Summary collapse

Methods included from SceBase

#connection, #connection_storage, #datacenter_id, included, #locate_config_value, #msg_pair, #validate!

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/chef/knife/sce_volume_detach.rb', line 28

def run
  
  $stdout.sync = true

  validate!
  
  (1..@name_args.length-1).each do |idx|
    puts "Detaching volume #{@name_args[idx]} from #{name_args[0]}"
    begin
      res = connection.modify_instance(@name_args[0], {
        "type" => "detach",
        "storageID" => @name_args[idx]
      })
      puts "Detach request for volume #{@name_args[idx]} issued."
    rescue Exception => e
      ui.error("There was an error while detaching volume #{@name_args[idx]}.  Error is #{e.to_s}")
    end
  end
  
end