Unregister a VM

    CLI Example:

    .. code-block:: bash

        salt '*' vboxmanage.unregister my_vm_filename

def unregister(name, delete=False):
    '''
    Unregister a VM

    CLI Example:

    .. code-block:: bash

        salt '*' vboxmanage.unregister my_vm_filename
    '''
    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']