salt.runners.fileserver

Directly manage the Salt fileserver plugins

salt.runners.fileserver.clear_cache(backend=None)

New in version 2015.5.0.

Clear the fileserver cache from VCS fileserver backends (git, hg, svn). Executing this runner with no arguments will clear the cache for all enabled VCS fileserver backends, but this can be narrowed using the backend argument.

backend
Only clear the update lock for the specified backend(s). If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

CLI Example:

salt-run fileserver.clear_cache
salt-run fileserver.clear_cache backend=git,hg
salt-run fileserver.clear_cache hg
salt-run fileserver.clear_cache -roots
salt.runners.fileserver.clear_lock(backend=None, remote=None)

New in version 2015.5.0.

Clear the fileserver update lock from VCS fileserver backends (git, hg, svn). This should only need to be done if a fileserver update was interrupted and a remote is not updating (generating a warning in the Master's log file). Executing this runner with no arguments will remove all update locks from all enabled VCS fileserver backends, but this can be narrowed by using the following arguments:

backend
Only clear the update lock for the specified backend(s).
remote
If specified, then any remotes which contain the passed string will have their lock cleared. For example, a remote value of github will remove the lock from all github.com remotes.

CLI Example:

salt-run fileserver.clear_lock
salt-run fileserver.clear_lock backend=git,hg
salt-run fileserver.clear_lock backend=git remote=github
salt-run fileserver.clear_lock remote=bitbucket
salt.runners.fileserver.dir_list(saltenv='base', backend=None, outputter=None)

Return a list of directories in the given environment

saltenv
: base
The salt fileserver environment to be listed
backend

Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

New in version 2015.5.0.

CLI Example:

salt-run fileserver.dir_list
salt-run fileserver.dir_list saltenv=prod
salt-run fileserver.dir_list saltenv=dev backend=git
salt-run fileserver.dir_list base hg,roots
salt-run fileserver.dir_list -git
salt.runners.fileserver.empty_dir_list(saltenv='base', backend=None, outputter=None)

New in version 2015.5.0.

Return a list of empty directories in the given environment

saltenv
: base
The salt fileserver environment to be listed
backend

Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

Note

Some backends (such as git and hg) do not support empty directories. So, passing backend=git or backend=hg will result in an empty list being returned.

CLI Example:

salt-run fileserver.empty_dir_list
salt-run fileserver.empty_dir_list saltenv=prod
salt-run fileserver.empty_dir_list backend=roots
salt.runners.fileserver.envs(backend=None, sources=False, outputter=None)

Return the available fileserver environments. If no backend is provided, then the environments for all configured backends will be returned.

backend

Narrow fileserver backends to a subset of the enabled ones.

Changed in version 2015.5.0: If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

Additionally, fileserver backends can now be passed as a comma-separated list. In earlier versions, they needed to be passed as a python list (ex: backend="['roots', 'git']")

CLI Example:

salt-run fileserver.envs
salt-run fileserver.envs backend=roots,git
salt-run fileserver.envs git
salt.runners.fileserver.file_list(saltenv='base', backend=None, outputter=None)

Return a list of files from the salt fileserver

saltenv
: base
The salt fileserver environment to be listed
backend

Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

New in version 2015.5.0.

CLI Examples:

salt-run fileserver.file_list
salt-run fileserver.file_list saltenv=prod
salt-run fileserver.file_list saltenv=dev backend=git
salt-run fileserver.file_list base hg,roots
salt-run fileserver.file_list -git
salt.runners.fileserver.lock(backend=None, remote=None)

New in version 2015.5.0.

Set a fileserver update lock for VCS fileserver backends (git, hg, svn).

Note

This will only operate on enabled backends (those configured in fileserver_backend).

backend
Only set the update lock for the specified backend(s).
remote
If not None, then any remotes which contain the passed string will have their lock cleared. For example, a remote value of *github.com* will remove the lock from all github.com remotes.

CLI Example:

salt-run fileserver.lock
salt-run fileserver.lock backend=git,hg
salt-run fileserver.lock backend=git remote='*github.com*'
salt-run fileserver.lock remote=bitbucket

Return a list of symlinked files and dirs

saltenv
: base
The salt fileserver environment to be listed
backend

Narrow fileserver backends to a subset of the enabled ones. If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

New in version 2015.5.0.

CLI Example:

salt-run fileserver.symlink_list
salt-run fileserver.symlink_list saltenv=prod
salt-run fileserver.symlink_list saltenv=dev backend=git
salt-run fileserver.symlink_list base hg,roots
salt-run fileserver.symlink_list -git
salt.runners.fileserver.update(backend=None)

Update the fileserver cache. If no backend is provided, then the cache for all configured backends will be updated.

backend

Narrow fileserver backends to a subset of the enabled ones.

Changed in version 2015.5.0: If all passed backends start with a minus sign (-), then these backends will be excluded from the enabled backends. However, if there is a mix of backends with and without a minus sign (ex: backend=-roots,git) then the ones starting with a minus sign will be disregarded.

Additionally, fileserver backends can now be passed as a comma-separated list. In earlier versions, they needed to be passed as a python list (ex: backend="['roots', 'git']")

CLI Example:

salt-run fileserver.update
salt-run fileserver.update backend=roots,git