.. versionadded:: 2018.3.3

    Remove the mount point from the filesystems

    CLI Example:

    .. code-block:: bash

        salt '*' mount.rm_filesystems /mnt/foo /dev/sdg
977179
def rm_filesystems(name, device, config='/etc/filesystems'):
    '''
    
    '''
    modified = False
    view_lines = []

    if 'AIX' not in __grains__['kernel']:
        return modified

    criteria = _FileSystemsEntry(name=name, dev=device)
    try:
        fsys_filedict = _filesystems(config, False)
        for fsys_view in six.viewitems(fsys_filedict):
            try:
                if criteria.match(fsys_view):
                    modified = True
                else:
                    view_lines.append(fsys_view)

            except _FileSystemsEntry.ParseError:
                view_lines.append(fsys_view)

    except (IOError, OSError) as exc:
        raise CommandExecutionError("Couldn't read from {0}: {1}".format(config, exc))

    if modified:
        try:
            with salt.utils.files.fopen(config, 'wb') as ofile:
                for fsys_view in view_lines:
                    entry = fsys_view[1]
                    mystrg = _FileSystemsEntry.dict_to_lines(entry)
                    ofile.writelines(salt.utils.data.encode(mystrg))
        except (IOError, OSError) as exc:
            raise CommandExecutionError("Couldn't write to {0}: {1}".format(config, exc))

    return modified
1301200
def rm(self, path):
        """"""

        resp = self._sendRequest("DELETE", path)
        # By documentation server must return 200 "OK", but I get 204 "No Content".
        # Anyway file or directory have been removed.
        if not (resp.status_code in (200, 204)):
            raise YaDiskException(resp.status_code, resp.content)
49709
def preview_unmount(self):
        

        commands = []
        for mountpoint in self.find_bindmounts():
            commands.append('umount {0}'.format(mountpoint))
        for mountpoint in self.find_mounts():
            commands.append('umount {0}'.format(mountpoint))
            commands.append('rm -Rf {0}'.format(mountpoint))
        for vgname, pvname in self.find_volume_groups():
            commands.append('lvchange -a n {0}'.format(vgname))
            commands.append('losetup -d {0}'.format(pvname))
        for device in self.find_loopbacks():
            commands.append('losetup -d {0}'.format(device))
        for mountpoint in self.find_base_images():
            commands.append('fusermount -u {0}'.format(mountpoint))
            commands.append('rm -Rf {0}'.format(mountpoint))
        for folder in self.find_clean_dirs():
            cmd = 'rm -Rf {0}'.format(folder)
            if cmd not in commands:
                commands.append(cmd)
        return commands
81503
def remove(ctx, client, sources):
    """"""
    from renku.api._git import _expand_directories

    def fmt_path(path):
        """Format path as relative to the client path."""
        return str(Path(path).absolute().relative_to(client.path))

    files = {
        fmt_path(source): fmt_path(file_or_dir)
        for file_or_dir in sources
        for source in _expand_directories((file_or_dir, ))
    }

    # 1. Update dataset metadata files.
    with progressbar(
        client.datasets.values(),
        item_show_func=lambda item: str(item.short_id) if item else '',
        label='Updating dataset metadata',
        width=0,
    ) as bar:
        for dataset in bar:
            remove = []
            for key, file_ in dataset.files.items():
                filepath = fmt_path(file_.full_path)
                if filepath in files:
                    remove.append(key)

            if remove:
                for key in remove:
                    dataset.unlink_file(key)

                dataset.to_yaml()

    # 2. Manage .gitattributes for external storage.
    tracked = tuple(
        path for path, attr in client.find_attr(*files).items()
        if attr.get('filter') == 'lfs'
    )
    client.untrack_paths_from_storage(*tracked)
    existing = client.find_attr(*tracked)
    if existing:
        click.echo(WARNING + 'There are custom .gitattributes.\n')
        if click.confirm(
            'Do you want to edit ".gitattributes" now?', default=False
        ):
            click.edit(filename=str(client.path / '.gitattributes'))

    # Finally remove the files.
    final_sources = list(set(files.values()))
    if final_sources:
        run(['git', 'rm', '-rf'] + final_sources, check=True)
1003214
def delete_blob(call=None, kwargs=None):  # pylint: disable=unused-argument
    '''
    
    '''
    if kwargs is None:
        kwargs = {}

    if 'container' not in kwargs:
        raise SaltCloudSystemExit(
            'A container must be specified'
        )

    if 'blob' not in kwargs:
        raise SaltCloudSystemExit(
            'A blob must be specified'
        )

    storageservice = _get_block_blob_service(kwargs)

    storageservice.delete_blob(kwargs['container'], kwargs['blob'])
    return True
466541
function remove (cb) {
    var files = my.args
    // Check for file arguements
    if (files.length === 0) {
      return cb( erf ('<remove> command requires file arguements', usage))
    }
    // Get bin and run chained processes

    async.asyncMap( files, processchain , function (err) {
      if (err) return cb(err)  //ERRORS FROM PROCESSING CHAIN

      cb(null, my.state)
    })  // end asyncMap

    function processchain (file, cb_) {
      var source = file
      async.chain( [checkState, source, true]
                   , [changeState, source, 'rm']
                   ,  cb_ )
    }  //end processchain
  }
959822
def remove_tree(self, dirname):
        """"""
        while osp.exists(dirname):
            try:
                shutil.rmtree(dirname, onerror=misc.onerror)
            except Exception as e:
                # This handles a Windows problem with shutil.rmtree.
                # See issue #8567.
                if type(e).__name__ == "OSError":
                    error_path = to_text_string(e.filename)
                    shutil.rmtree(error_path, ignore_errors=True)
896308
def transit_delete_key(self, name, mount_point='transit'):
        
        url = '/v1/{0}/keys/{1}'.format(mount_point, name)
        return self._adapter.delete(url)
33150
def _uninstall(action='remove', name=None, pkgs=None, **kwargs):
    '''
    
    '''
    try:
        pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]
    except MinionError as exc:
        raise CommandExecutionError(exc)

    old = list_pkgs()
    targets = [x for x in pkg_params if x in old]
    if not targets:
        return {}

    remove_arg = '-Rsc' if action == 'purge' else '-R'

    cmd = []
    if salt.utils.systemd.has_scope(__context__) \
            and __salt__['config.get']('systemd.scope', True):
        cmd.extend(['systemd-run', '--scope'])
    cmd.extend(['pacman', remove_arg, '--noprogressbar', '--noconfirm'])
    cmd.extend(targets)

    if 'root' in kwargs:
        cmd.extend(('-r', kwargs['root']))

    out = __salt__['cmd.run_all'](
        cmd,
        output_loglevel='trace',
        python_shell=False
    )

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []

    __context__.pop('pkg.list_pkgs', None)
    new = list_pkgs()
    ret = salt.utils.data.compare_dicts(old, new)

    if errors:
        raise CommandExecutionError(
            'Problem encountered removing package(s)',
            info={'errors': errors, 'changes': ret}
        )

    return ret
92038
def remove(name, **kwargs):
    '''
    
    '''

    cmd = 'sysrc -v'

    if 'file' in kwargs:
        cmd += ' -f '+kwargs['file']

    if 'jail' in kwargs:
        cmd += ' -j '+kwargs['jail']

    cmd += ' -x '+name

    sysrcs = __salt__['cmd.run'](cmd)
    if "sysrc: unknown variable" in sysrcs:
        raise CommandExecutionError(sysrcs)
    else:
        return name+" removed"
276400
def remove(self, path, recursive=True):
        
        if recursive:
            cmd = ["rm", "-r", path]
        else:
            cmd = ["rm", path]

        self.remote_context.check_output(cmd)
816389
def remove():
    
    if exists(env.venv_path):
        run("rm -rf %s" % env.venv_path)
    if exists(env.proj_path):
        run("rm -rf %s" % env.proj_path)
    for template in get_templates().values():
        remote_path = template["remote_path"]
        if exists(remote_path):
            sudo("rm %s" % remote_path)
    if exists(env.repo_path):
        run("rm -rf %s" % env.repo_path)
    sudo("supervisorctl update")
    psql("DROP DATABASE IF EXISTS %s;" % env.proj_name)
    psql("DROP USER IF EXISTS %s;" % env.proj_name)
515786
def do_rm(self, subcmd, opts, message):
        
        maildir = self.maildir
        client = MdClient(maildir, filesystem=self.filesystem)
        try:
            client.remove(message)
        except KeyError:
            return 1
1294477
def delete(path, dryrun=False, recursive=True, verbose=None, print_exists=True,
           ignore_errors=True):
    
    if verbose is None:
        verbose = VERBOSE
        if not QUIET:
            verbose = 1
    if verbose > 0:
        print('[util_path] Deleting path=%r' % path)
    exists_flag = exists(path)
    link_flag = islink(path)
    if not exists_flag and not link_flag:
        if print_exists and verbose:
            print('..does not exist!')
        flag = False
    else:
        rmargs = dict(verbose=verbose > 1, ignore_errors=ignore_errors,
                      dryrun=dryrun)
        if islink(path):
            os.unlink(path)
            flag = True
        elif isdir(path):
            # First remove everything in the directory
            flag = remove_files_in_dir(path, recursive=recursive, **rmargs)
            # Then remove the directory itself
            flag = flag and remove_dirs(path, **rmargs)
        elif isfile(path):
            flag = remove_file(path, **rmargs)
        else:
            raise ValueError('Unknown type of path=%r' % (path,))
        if verbose > 0:
            print('[util_path] Finished deleting path=%r' % path)
    return flag
137619
function deleteSystemD (name, callback) {
  const filepath = `/etc/systemd/system/${name}.service`
  console.log(`Removing service on: ${filepath}`)
  fs.exists(filepath, exists => {
    if (exists) {
      fs.unlink(filepath, err => {
        if (err) {
          callback(err)
          return
        }

        let cmd = 'systemctl daemon-reload'
        console.log('Running %s...', cmd)
        exec(cmd, err => {
          callback(err, 'SystemD service removed succesfully')
        })
      })
    } else {
      callback(`Service doesn't exists, nothing to uninstall`)
    }
  })
}
1047245
def umount(mountpoint, persist=False):
    """"""
    cmd_args = ['umount', mountpoint]
    try:
        subprocess.check_output(cmd_args)
    except subprocess.CalledProcessError as e:
        log('Error unmounting {}\n{}'.format(mountpoint, e.output))
        return False

    if persist:
        return fstab_remove(mountpoint)
    return True
976478
def remove(self, name, **params):
        
        log = self._getparam('log', self._discard, **params)

        if name not in self.names:
            log.error("Attempt to remove %r which was never added", name)
            raise Exception("Command %r has never been added" % (name,))
        del self.names[name]
        rebuild = False
        for path in list(self.modules):
            if name in self.modules[path]:
                self.modules[path].remove(name)
            if len(self.modules[path]) == 0:
                del self.modules[path]
                rebuild = True
        if rebuild:
            self._build(name, **params)