# File lib/rudy/routines/handlers/disks.rb, line 41
41:     def execute(type, routine, rset, lbox, argv=nil)
42:       original_user = rset.user
43:       rset.add_key user_keypairpath(current_machine_user)
44:       rset.switch_user current_machine_user
45:       
46:       routine.each_pair do |action, disks|
47:         unless respond_to?(action.to_sym)  
48:           Rudy::Huxtable.le %Q(DiskHandler: unknown action "#{action}")
49:           next
50:         end
51:         # A quick hack to take advantage of the threading in Rye::Set.
52:         # The action method does not run in the context of a Rye::Box
53:         # object so we need to send rset as an argument. 
54:         rset.batch do
55:           # Windows EC2 instances have 2 disks by default (C: and D:)
56:           volumes = self.stash.attached_volumes
57:           disks.each_pair do |path, props|
58:             # self contains the current instance of Rye::Box. 
59:             disk = Rudy::Disk.new(self.stash.position, path, props)
60:             disk.refresh! if disk.exists?  # We need the volume ID if available
61:             # don't include the current disk in the count. 
62:             volumes.reject! { |v| v.awsid == disk.volid } if disk.volid && disk.volume_attached?
63:             disk_index = volumes.size + 2
64:             Rudy::Routines::Handlers::Disks.send(action, self, disk, disk_index)
65:           end
66:         end
67: 
68:       end
69:       
70:       rset.switch_user original_user
71:     end