From 4398e8841b472a257875af43cc14ab374fa5e7e1 Mon Sep 17 00:00:00 2001 From: Jorge Schrauwen Date: Fri, 24 Jun 2016 22:32:20 +0200 Subject: [PATCH] undo some changes to mount.fstab and mount.rm_fstab, create mount.vfstab and mount.rm_vfstab --- salt/modules/mount.py | 51 +++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/salt/modules/mount.py b/salt/modules/mount.py index 81d1e9b9c8..3bc116dbc9 100644 --- a/salt/modules/mount.py +++ b/salt/modules/mount.py @@ -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,