Merge pull request #49231 from minusf/mount-check-name

Check for mandatory parameters for `mount.mounted`
This commit is contained in:
Mike Place 2018-08-22 09:26:03 -06:00 committed by GitHub
commit 62cc0dffd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: