Remove services without host object linked to

        Note that this should not happen!

        :return: None
968582
def clean(self):
        
        to_del = []
        for serv in self:
            if not serv.host:
                to_del.append(serv.uuid)
        for service_uuid in to_del:
            del self.items[service_uuid]
624248
def clean(self, force: bool=False):
        '''
        '''
        assert not self._closed

        with (yield from self._host_pools_lock):
            for key, pool in tuple(self._host_pools.items()):
                yield from pool.clean(force=force)

                if not self._host_pool_waiters[key] and pool.empty():
                    del self._host_pools[key]
                    del self._host_pool_waiters[key]
490874
def delete_host_from_segment(ipaddress, networkaddress, auth, url):
    '''

    '''
    host_id = get_host_id(ipaddress, networkaddress, auth, url)
    remove_scope_ip(host_id, auth.creds, auth.url)
1154781
def clear_dns_cache(self,
                        host: Optional[str]=None,
                        port: Optional[int]=None) -> None:
        """"""
        if host is not None and port is not None:
            self._cached_hosts.remove((host, port))
        elif host is not None or port is not None:
            raise ValueError("either both host and port "
                             "or none of them are allowed")
        else:
            self._cached_hosts.clear()
717617
def unbind(*instances)
      service_bindings.each do |b|
        if instances.include? b.service_instance
          b.delete!
        end
      end

      self
    end
884754
def remove(name):
    '''
    
    '''

    if not enabled(name):
        return False

    svc_path = _service_path(name)
    if not os.path.islink(svc_path):
        log.error('%s is not a symlink: not removed', svc_path)
        return False

    if not stop(name):
        log.error('Failed to stop service %s', name)
        return False
    try:
        os.remove(svc_path)
    except IOError:
        log.error('Unable to remove symlink %s', svc_path)
        return False
    return True
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)
943950
def remove_all_static_host_mappings():
    """"""

    LOG.debug("remove_host_mapping() called")
    session = bc.get_writer_session()
    try:
        mapping = _lookup_all_host_mappings(
                      session=session,
                      is_static=True)
        for host in mapping:
            session.delete(host)
        session.flush()
    except c_exc.NexusHostMappingNotFound:
        pass
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
1248510
def remove_from_known_hosts(self, hosts, known_hosts=DEFAULT_KNOWN_HOSTS, dry=False):
        
        for host in hosts:
            logger.info('[%s] Removing the remote host SSH public key from [%s]...', host.hostname, known_hosts)
            cmd = ['ssh-keygen', '-f', known_hosts, '-R', host.hostname]
            logger.debug('Call: %s', ' '.join(cmd))
            if not dry:
                try:
                    subprocess.check_call(cmd)
                except subprocess.CalledProcessError as ex:
                    logger.error(format_error(format_exception(ex)))
1289619
def remove_host(self, host_id):
        
        with self._lock:
            rv = self._hosts.pop(host_id, None) is not None
            pool = self._pools.pop(host_id, None)
            if pool is not None:
                pool.disconnect()
            self._hosts_age += 1
            return rv
204559
def __unregister_services(self):
        
        # Copy the services list, as it will be modified during the process
        with self.__registration_lock:
            registered_services = self.__registered_services.copy()

        for registration in registered_services:
            try:
                registration.unregister()
            except BundleException:
                # Ignore errors at this level
                pass

        if self.__registered_services:
            _logger.warning("Not all services have been unregistered...")

        with self.__registration_lock:
            # Clear the list, just to be clean
            self.__registered_services.clear()
86595
def remove_datastore(service_instance, datastore_ref):
    '''
    
    '''
    ds_props = get_properties_of_managed_object(
        datastore_ref, ['host', 'info', 'name'])
    ds_name = ds_props['name']
    log.debug('Removing datastore \'%s\'', ds_name)
    ds_hosts = ds_props.get('host')
    if not ds_hosts:
        raise salt.exceptions.VMwareApiError(
            'Datastore \'{0}\' can\'t be removed. No '
            'attached hosts found'.format(ds_name))
    hostname = get_managed_object_name(ds_hosts[0].key)
    host_ds_system = get_host_datastore_system(ds_hosts[0].key,
                                               hostname=hostname)
    try:
        host_ds_system.RemoveDatastore(datastore_ref)
    except vim.fault.NoPermission as exc:
        log.exception(exc)
        raise salt.exceptions.VMwareApiError(
            'Not enough permissions. Required privilege: '
            '{0}'.format(exc.privilegeId))
    except vim.fault.VimFault as exc:
        log.exception(exc)
        raise salt.exceptions.VMwareApiError(exc.msg)
    except vmodl.RuntimeFault as exc:
        log.exception(exc)
        raise salt.exceptions.VMwareRuntimeError(exc.msg)
    log.trace('[%s] Removed datastore \'%s\'', hostname, ds_name)
583247
def remove_templates(self):
        
        self.hosts.remove_templates()
        self.contacts.remove_templates()
        self.services.remove_templates()
        self.servicedependencies.remove_templates()
        self.hostdependencies.remove_templates()
        self.timeperiods.remove_templates()
1150583
def remove_service(service=str):
    '''
    
    '''
    try:
        salt_return = {}
        client = docker.APIClient(base_url='unix://var/run/docker.sock')
        service = client.remove_service(service)
        salt_return.update({'Service Deleted': service,
                            'Minion ID': __context__['server_name']})
    except TypeError:
        salt_return = {}
        salt_return.update({'Error': 'service arg is missing?'})
    return salt_return
292486
def delete_service(self, service_id):
        

        svc = self.client['Network_Application_Delivery_Controller_'
                          'LoadBalancer_Service']

        return svc.deleteObject(id=service_id)
376498
def remove_all_servers(self):
        
        # 'no ntp' removes all server entries.
        # For command_builder, disable command 'ntp' gives the desired command
        cmd = self.command_builder('ntp', disable=True)
        return self.configure(cmd)