Cleanup all earlier provisioned hosts on EC2 using the Aws::EC2 library

 It goes without saying, but a #cleanup does nothing without a #provision
 method call first.

 @return [void]
439192
def cleanup
      # Provisioning should have set the host 'instance' values.
      kill_instances(@hosts.map{ |h| h['instance'] }.select{ |x| !x.nil? })
      delete_key_pair_all_regions()
      nil
    end
1698
def cleanup(self):
        

        while self.inactive_timeout > 0:
            self.time = time.time()

            keys = []

            for key, client in self.clients.items.items():
                t = getattr(client, "active_at", 0)
                if t > 0 and self.time - t > self.inactive_timeout:
                    client.kwargs["link"].disconnect()
                    keys.append(key)

            for key in keys:
                self.log_debug("Removing client (inactive): %s" % key)
                del self.clients[key]

            time.sleep(1)
141991
def clean_previous_run(self):
        
        # Execute the base class treatment...
        super(Satellite, self).clean_previous_run()

        # Clean my lists
        del self.broks[:]
        del self.events[:]
864578
def do_cleanup(connection, host_agent_id):
    '''
    
    '''
    desc = yield safe_get(connection, host_agent_id)
    if isinstance(desc, host.Descriptor):
        for partner in desc.partners:
            partner_desc = yield safe_get(connection, partner.recipient.key)
            if partner_desc:
                host_part = first(x for x in partner_desc.partners
                                  if x.role == 'host')
                if host_part is None:
                    log.warning('host_restart',
                                'Agent id: %s type: %s did not have any '
                                'host partner. So we are leaving it be.',
                                partner_desc.doc_id,
                                partner_desc.type_name)
                elif host_part.recipient.key == host_agent_id:
                    log.info('host_restart', "Deleting document with ID: %s",
                             partner_desc.doc_id)
                    yield connection.delete_document(partner_desc)
                else:
                    log.warning('host_restart',
                                "Not deleting descriptor of the agent id: %s, "
                                "agent_type: %s, as it seems to be hosted by "
                                "the host agent: %s. Although keep in mind "
                                "that he will not receive the goodbye "
                                "notification from us!",
                                partner_desc.doc_id,
                                partner_desc.type_name,
                                host_part.recipient.key)
        log.info('host_restart', "Deleting document with ID: %s",
                 desc.doc_id)
        yield connection.delete_document(desc)
446193
def clean!
      stop
      remove_instance_dir!
      FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)
      FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir
      md5.clean!
      FileUtils.remove_entry(config.version_file) if File.exists? config.version_file
    end
329669
def cleanup_services(self):
        
        services = self.list_services()

        for service in services:
            if service.namespace in self.managed_namespaces:
                service.delete()
1242009
def _cleanup(self):
        
        for channel in self._open_channels:
            try:
                self.disconnect_channel(channel)
            except Exception:  # pylint: disable=broad-except
                pass

        for handler in self._handlers.values():
            try:
                handler.tear_down()
            except Exception:  # pylint: disable=broad-except
                pass

        try:
            self.socket.close()
        except Exception:  # pylint: disable=broad-except
            self.logger.exception(
                "[%s:%s] _cleanup", self.fn or self.host, self.port)
        self._report_connection_status(
            ConnectionStatus(CONNECTION_STATUS_DISCONNECTED,
                             NetworkAddress(self.host, self.port)))
        self.connecting = True
613551
def cleanup(self):
        
        for future in self.futures:
            future.cancel()
        self.executor.shutdown(wait=10)
        if self.ssh.get_transport() != None:
            self.ssh.close()
420481
def cleanup(parent = Object, current = @top)
      return unless all_project_objects_lookup[current]
      current.constants.each {|const| cleanup current, current.const_get(const)}
      parent.send(:remove_const, current.to_s.split('::').last.to_sym)
    end
948323
def cleanup_state
      # intentionally not deleting entire temp dir to preserve localized
      # executable directories between tests on Windows. see how we reference
      # RS_RIGHT_RUN_EXE below.
      delete_if_exists(state_file_path)
      delete_if_exists(chef_file_path)
      delete_if_exists(past_scripts_path)
      delete_if_exists(log_path)
      delete_if_exists(cook_state_file_path)
    end
610380
function cleanUp (directoryToClean) {
  return new Promise((resolve, reject) => {
    rimraf(directoryToClean, (err) => {
      if (err) {
        return reject(new Error(err));
      }
      return resolve();
    });
  });
}
1195143
public function cleanup_tables()
    {

        logger()->info('Performing table maintenance');

        // Prune the failed jobs table
        FailedJob::where('id', '<', (FailedJob::max('id') - 100))->delete();

        // Prune the server statuses older than a week.
        ServerStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Prune ESI statuses older than a week
        EsiStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Remove groups with no users
        Group::doesntHave('users')->delete();
    }
247280
def cleanup_storage vm
      vm.volumes.each do |vol|
        @logger.debug "Deleting volume #{vol.name} for OpenStack host #{vm.name}"
        vm.detach_volume(vol.id)
        vol.wait_for { ready? }
        vol.destroy
      end
    end
299556
public static function cleanup_instances() {
        global $DB;
        self::init_levels();

        $sqls = array();
        foreach (self::$alllevels as $level=>$classname) {
            $sqls[] = $classname::get_cleanup_sql();
        }

        $sql = implode(" UNION ", $sqls);

        // it is probably better to use transactions, it might be faster too
        $transaction = $DB->start_delegated_transaction();

        $rs = $DB->get_recordset_sql($sql);
        foreach ($rs as $record) {
            $context = context::create_instance_from_record($record);
            $context->delete();
        }
        $rs->close();

        $transaction->allow_commit();
    }
171222
public void cleanup() {
        synchronized (_sslMap) {
            for (SslRelayOdo relay : _sslMap.values()) {
                if (relay.getHttpServer() != null && relay.isStarted()) {
                    relay.getHttpServer().removeListener(relay);
                }
            }

            sslRelays.clear();
        }
    }
1136590
def purge(release: false)
      mutex.synchronize do
        check_process!

        log(:debug) { "Purge all queues on #{uri}..." }

        connection.purge(release: release)
      end
    end
792162
def cleanup():
    
    _log.debug("P4P atexit begins")
    # clean provider registry
    from .server import clearProviders, _cleanup_servers
    clearProviders()

    # close client contexts
    from .client.raw import _cleanup_contexts
    _cleanup_contexts()

    # stop servers
    _cleanup_servers()

    # shutdown default work queue
    from .util import _defaultWorkQueue
    _defaultWorkQueue.stop()
    _log.debug("P4P atexit completes")