Adding ability in salt.modules.zfs.list to list a specified dataset and values of its properties

This commit is contained in:
Nitin Madhok 2014-12-08 05:48:44 -05:00
parent bbca945fd2
commit 25fe04df9b

View File

@ -275,19 +275,20 @@ def rename(name, new_name):
return ret
def list_():
def list_(name=''):
'''
.. versionadded:: Lithium
Return a list of all datasets on the system and the values of their used, available, referenced, and mountpoint properties.
Return a list of all datasets or a specified dataset on the system and the values of their used, available, referenced, and mountpoint properties.
CLI Example:
.. code-block:: bash
salt '*' zfs.list
salt '*' zfs.list /myzpool/mydataset
'''
zfs = _check_zfs()
res = __salt__['cmd.run']('{0} list'.format(zfs))
res = __salt__['cmd.run']('{0} list {1}'.format(zfs, name))
dataset_list = [l for l in res.splitlines()]
return {'datasets': dataset_list}