def deprovision_group(group_name, clean_state=true)
      provisioner = vm_groups[group_name]

      # if we can't find the provisioner, we probably got asked to clean up
      # something we never scheduled. Just ignore that.
      if provisioner and ((solved.to_set + vm_working.to_set).include?(group_name) or @force_deprovision)
        if_debug do
          $stderr.puts "Attempting to deprovision group #{group_name}"
        end

        perform_deprovision = lambda do |this_prov|
          result = this_prov.shutdown
          unless result
            if_debug do
              $stderr.puts "Could not deprovision group #{group_name}."
            end
          end
          result
        end

        provisioner.reverse.each do |this_prov|
          if @force_deprovision
            begin
              perform_deprovision.call(this_prov)
            rescue Exception => e
              if_debug do
                $stderr.puts "Deprovision #{this_prov.class.name}/#{group_name} had errors:"
                $stderr.puts "#{e.message}"
              end
            end
          else
            unless perform_deprovision.call(this_prov)
              raise "Could not deprovision #{group_name}/#{this_prov.inspect}"
            end
          end
        end
      end

      if clean_state
        solved.delete(group_name)
        @waiters_mutex.synchronize do
          @waiters.delete(group_name)
        end
        vm_working.delete(group_name)
        vm_dependencies.delete(group_name)
        vm_groups.delete(group_name)
      end
    end
def deprovision_group(group_name, clean_state=true)
      provisioner = vm_groups[group_name]

      # if we can't find the provisioner, we probably got asked to clean up
      # something we never scheduled. Just ignore that.
      if provisioner and ((solved.to_set + vm_working.to_set).include?(group_name) or @force_deprovision)
        if_debug do
          $stderr.puts "Attempting to deprovision group #{group_name}"
        end

        perform_deprovision = lambda do |this_prov|
          result = this_prov.shutdown
          unless result
            if_debug do
              $stderr.puts "Could not deprovision group #{group_name}."
            end
          end
          result
        end

        provisioner.reverse.each do |this_prov|
          if @force_deprovision
            begin
              perform_deprovision.call(this_prov)
            rescue Exception => e
              if_debug do
                $stderr.puts "Deprovision #{this_prov.class.name}/#{group_name} had errors:"
                $stderr.puts "#{e.message}"
              end
            end
          else
            unless perform_deprovision.call(this_prov)
              raise "Could not deprovision #{group_name}/#{this_prov.inspect}"
            end
          end
        end
      end

      if clean_state
        solved.delete(group_name)
        @waiters_mutex.synchronize do
          @waiters.delete(group_name)
        end
        vm_working.delete(group_name)
        vm_dependencies.delete(group_name)
        vm_groups.delete(group_name)
      end
    end
Performs the deprovision of a group by replaying its provision strategy
 backwards and applying the #shutdown method instead of the #startup method.
 Removes it from the various state tables if true is set as the second
 argument, which is the default.