undo some changes to mount.fstab and mount.rm_fstab, create mount.vfstab and mount.rm_vfstab

This commit is contained in:
Jorge Schrauwen 2016-06-24 22:32:20 +02:00
parent 133d3bb2bb
commit 4398e8841b

View File

@ -366,14 +366,11 @@ class _vfstab_entry(object):
return True
def fstab(config=None):
def fstab(config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
List the contents of the fstab
config : string
optional path of fstab
CLI Example:
.. code-block:: bash
@ -381,11 +378,6 @@ def fstab(config=None):
salt '*' mount.fstab
'''
ret = {}
if not config:
if __grains__['kernel'] == 'SunOS':
config = '/etc/vfstab'
else:
config = '/etc/fstab'
if not os.path.isfile(config):
return ret
with salt.utils.fopen(config) as ifile:
@ -415,7 +407,22 @@ def fstab(config=None):
return ret
def rm_fstab(name, device, config=None):
def vfstab(config='/etc/vfstab'):
'''
.. versionadded:: 2016.3.2
List the contents of the vfstab
CLI Example:
.. code-block:: bash
salt '*' mount.vfstab
'''
## NOTE: vfstab is a wrapper, we share all code with fstab
return fstab(config)
def rm_fstab(name, device, config='/etc/fstab'):
'''
.. versionchanged:: 2016.3.2
Remove the mount point from the fstab
@ -431,12 +438,6 @@ def rm_fstab(name, device, config=None):
'''
modified = False
if not config:
if __grains__['kernel'] == 'SunOS':
config = '/etc/vfstab'
else:
config = '/etc/fstab'
if __grains__['kernel'] == 'SunOS':
criteria = _vfstab_entry(name=name, device=device)
else:
@ -474,6 +475,24 @@ def rm_fstab(name, device, config=None):
return True
def rm_vfstab(name, device, config='/etc/vfstab'):
'''
.. versionadded:: 2016.3.2
Remove the mount point from the vfstab
config : string
optional path of vfstab
CLI Example:
.. code-block:: bash
salt '*' mount.rm_vfstab /mnt/foo /device/c0t0d0p0
'''
## NOTE: rm_vfstab is a wrapper, we share all code with fstab
return rm_fstab(name, device, config)
def set_fstab(
name,
device,