mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Add salt.runners.fileserver.{,empty_}dir_list
This rounds out the runner support for the fileserver runner.
This commit is contained in:
parent
1c55cf92e1
commit
28ccb7cb68
@ -140,6 +140,83 @@ def symlink_list(saltenv='base', backend=None, outputter='nested'):
|
||||
return output
|
||||
|
||||
|
||||
def dir_list(saltenv='base', backend=None, outputter='nested'):
|
||||
'''
|
||||
.. versionadded:: 2015.2.0
|
||||
|
||||
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.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
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
|
||||
'''
|
||||
fileserver = salt.fileserver.Fileserver(__opts__)
|
||||
load = {'saltenv': saltenv, 'fsbackend': backend}
|
||||
output = fileserver.dir_list(load=load)
|
||||
|
||||
if outputter:
|
||||
salt.output.display_output(output, outputter, opts=__opts__)
|
||||
return output
|
||||
|
||||
|
||||
def empty_dir_list(saltenv='base', backend=None, outputter='nested'):
|
||||
'''
|
||||
.. versionadded:: 2015.2.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 :mod:`git <salt.fileserver.gitfs>` and
|
||||
:mod:`hg <salt.fileserver.hgfs>`) do not support empty directories.
|
||||
So, passing ``backend=git`` or ``backend=hg`` will result in an
|
||||
empty list being returned.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt-run fileserver.empty_dir_list
|
||||
salt-run fileserver.empty_dir_list saltenv=prod
|
||||
salt-run fileserver.empty_dir_list backend=roots
|
||||
'''
|
||||
fileserver = salt.fileserver.Fileserver(__opts__)
|
||||
load = {'saltenv': saltenv, 'fsbackend': backend}
|
||||
output = fileserver.file_list_emptydirs(load=load)
|
||||
|
||||
if outputter:
|
||||
salt.output.display_output(output, outputter, opts=__opts__)
|
||||
return output
|
||||
|
||||
|
||||
def update(backend=None):
|
||||
'''
|
||||
Update the fileserver cache. If no backend is provided, then the cache for
|
||||
|
Loading…
Reference in New Issue
Block a user