Unregister a VM

    CLI Example:

    .. code-block:: bash

        salt '*' vboxmanage.unregister my_vm_filename
174778
def unregister(name, delete=False):
    '''
    
    '''
    nodes = list_nodes_min()
    if name not in nodes:
        raise CommandExecutionError(
            'The specified VM ({0}) is not registered.'.format(name)
        )

    cmd = '{0} unregistervm {1}'.format(vboxcmd(), name)
    if delete is True:
        cmd += ' --delete'
    ret = salt.modules.cmdmod.run_all(cmd)
    if ret['retcode'] == 0:
        return True
    return ret['stderr']
552283
def unregister(self, bucket, name):
        
        assert bucket in self, 'Bucket %s is unknown' % bucket
        if not name in self[bucket]:
            raise NotRegistered('The function %s is not registered' % name)
        del self[bucket][name]
186867
def unregister(self, fileobj):
        
        try:
            key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
        except KeyError:
            raise KeyError("{0!r} is not registered".format(fileobj))

        # Getting the fileno of a closed socket on Windows errors with EBADF.
        except socket.error as err:
            if err.errno != errno.EBADF:
                raise
            else:
                for key in self._fd_to_key.values():
                    if key.fileobj is fileobj:
                        self._fd_to_key.pop(key.fd)
                        break
                else:
                    raise KeyError("{0!r} is not registered".format(fileobj))
        return key
1187483
def delete_vhost(self, vname):
        
        vname = quote(vname, '')
        path = Client.urls['vhosts_by_name'] % vname
        return self._call(path, 'DELETE')
428408
def unregister(*args, &block)
      h = Unobservable.handler_for(*args, &block)
      index = @handlers.index(h)
      if index
        @handlers.slice!(index)
        return h
      else
        return nil
      end
    end
1268654
def unregister(self, name: str):
        ''''''
        del self._callbacks[name]

        if self._event_dispatcher is not None:
            self._event_dispatcher.unregister(name)
786502
def destroy
      #disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
      unless host.free_license
        vm_object.Destroy_Task.wait_for_completion
      else
        host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
        host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
      end
    end
1218204
def destroy(name):
    '''
    
    '''
    vm_ = get_vm_info(name)
    machine = vm_['machine']

    cmd = 'vagrant destroy -f {}'.format(machine)

    ret = __salt__['cmd.run_all'](cmd,
                                  runas=vm_.get('runas'),
                                  cwd=vm_.get('cwd'),
                                  output_loglevel='info')
    if ret['retcode'] == 0:
        _erase_vm_info(name)
        return 'Destroyed VM {0}'.format(name)
    return False
517981
def unregister_all(self, name):
        
        try:
            templatehook = self._registry[name]
        except KeyError:
            return

        templatehook.unregister_all()
59167
function unbind (vm, key) {
  var source = vm._wilddogSources && vm._wilddogSources[key]
  if (!source) {
    throw new Error(
      'VueWild: unbind failed: "' + key + '" is not bound to ' +
      'a Wilddog reference.'
    )
  }
  var listeners = vm._wilddogListeners[key]
  for (var event in listeners) {
    source.off(event, listeners[event])
  }
  vm[key] = null
  vm.$wilddogRefs[key] = null
  vm._wilddogSources[key] = null
  vm._wilddogListeners[key] = null
}
1016445
def destroy_template(name=None, call=None, kwargs=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The destroy_template function must be called with  -f.'
        )
    if kwargs is None:
        kwargs = {}
    name = kwargs.get('name', None)
    session = _get_session()
    vms = session.xenapi.VM.get_all_records()
    ret = {}
    found = False
    for vm in vms:
        record = session.xenapi.VM.get_record(vm)
        if record['is_a_template']:
            if record['name_label'] == name:
                found = True
                # log.debug(record['name_label'])
                session.xenapi.VM.destroy(vm)
                ret[name] = {'status': 'destroyed'}
    if not found:
        ret[name] = {'status': 'not found'}
    return ret
1215663
def unregister(model_or_iterable, fail_silently=False):
    '''
    
    '''
    from django.db import models
    from .compat import get_model

    if issubclass(model_or_iterable, models.Model):
        model_or_iterable = [model_or_iterable]
    for model in model_or_iterable:
        if isinstance(model, string_types):
            model = get_model(*model.split('.', 1))
        try:
            del REGISTRY[model]
        except KeyError:
            if fail_silently:
                continue
            raise ValueError(
                u'The model %s.%s is not registered.' % (
                    model._meta.app_label,
                    model._meta.object_name,
                ))
1056671
def stop_vm(self):
        
        if self.vagrant is not None:
            if self.destroy:
                self.vagrant.destroy()
                shutil.rmtree(self.vagrant.root, ignore_errors=True)
                self.vagrant = None
            else:
                self.vagrant.halt()
813365
def delete_policy(vhost, name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'clear_policy', '-p', vhost, name],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)
    log.debug('Delete policy: %s', res['stdout'])
    return _format_response(res, 'Deleted')
1090778
def destroy(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name, reservation_id):
        
        # disconnect
        self._disconnect_all_my_connectors(session=session, resource_name=vm_name, reservation_id=reservation_id,
                                           logger=logger)
        # find vm
        vm = self.pv_service.find_by_uuid(si, vm_uuid)

        if vm is not None:
            # destroy vm
            result = self.pv_service.destroy_vm(vm=vm, logger=logger)
        else:
            logger.info("Could not find the VM {0},will remove the resource.".format(vm_name))
            result = True

        # delete resources
        self.resource_remover.remove_resource(session=session, resource_full_name=vm_name)
        return result
929569
def destroy_vm_by_name(self, si, vm_name, vm_path, logger):
        
        if vm_name is not None:
            vm = self.find_vm_by_name(si, vm_path, vm_name)
            if vm:
                return self.destroy_vm(vm, logger)
        raise ValueError('vm not found')
248429
void unregister(ResourceMonitorImpl monitorImpl)
   {
      Set<Entry<WatchKey, ResourceMonitorImpl>> entrySet = keys.entrySet();
      Iterator<Entry<WatchKey, ResourceMonitorImpl>> iterator = entrySet.iterator();
      while (iterator.hasNext())
      {
         Entry<WatchKey, ResourceMonitorImpl> next = iterator.next();
         if (next.getValue() == monitorImpl)
         {
            next.getKey().cancel();
            iterator.remove();
         }
      }
   }