mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49231 from minusf/mount-check-name
Check for mandatory parameters for `mount.mounted`
This commit is contained in:
commit
62cc0dffd6
1 changed files with 29 additions and 9 deletions
|
@ -186,6 +186,21 @@ def mounted(name,
|
|||
'result': True,
|
||||
'comment': ''}
|
||||
|
||||
if not name:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Must provide name to mount.mounted'
|
||||
return ret
|
||||
|
||||
if not device:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Must provide device to mount.mounted'
|
||||
return ret
|
||||
|
||||
if not fstype:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Must provide fstype to mount.mounted'
|
||||
return ret
|
||||
|
||||
if device_name_regex is None:
|
||||
device_name_regex = []
|
||||
|
||||
|
@ -519,11 +534,11 @@ def mounted(name,
|
|||
if __opts__['test']:
|
||||
if __grains__['os'] in ['MacOS', 'Darwin']:
|
||||
out = __salt__['mount.set_automaster'](name,
|
||||
device,
|
||||
fstype,
|
||||
opts,
|
||||
config,
|
||||
test=True)
|
||||
device,
|
||||
fstype,
|
||||
opts,
|
||||
config,
|
||||
test=True)
|
||||
else:
|
||||
out = __salt__['mount.set_fstab'](name,
|
||||
device,
|
||||
|
@ -568,10 +583,10 @@ def mounted(name,
|
|||
else:
|
||||
if __grains__['os'] in ['MacOS', 'Darwin']:
|
||||
out = __salt__['mount.set_automaster'](name,
|
||||
device,
|
||||
fstype,
|
||||
opts,
|
||||
config)
|
||||
device,
|
||||
fstype,
|
||||
opts,
|
||||
config)
|
||||
else:
|
||||
out = __salt__['mount.set_fstab'](name,
|
||||
device,
|
||||
|
@ -720,6 +735,11 @@ def unmounted(name,
|
|||
'result': True,
|
||||
'comment': ''}
|
||||
|
||||
if not name:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Must provide name to mount.unmounted'
|
||||
return ret
|
||||
|
||||
# Get the active data
|
||||
active = __salt__['mount.active'](extended=True)
|
||||
if name not in active:
|
||||
|
|
Loading…
Add table
Reference in a new issue