Proposed fix to not require src and fstype arguments for mount. Issue #1259. (#1357)

pull/18777/head
Ken Mitchell 9 years ago committed by Matt Clay
parent d519fca04b
commit 8c2b333a73

@ -34,12 +34,14 @@ options:
required: true required: true
src: src:
description: description:
- device to be mounted on I(name). - device to be mounted on I(name). Required when C(state=present) or C(state=mounted)
required: true required: false
default: null
fstype: fstype:
description: description:
- file-system type - file-system type. Required when C(state=present) or C(state=mounted)
required: true required: false
default: null
opts: opts:
description: description:
- mount options (see fstab(5)) - mount options (see fstab(5))
@ -261,21 +263,25 @@ def main():
opts = dict(default=None), opts = dict(default=None),
passno = dict(default=None, type='str'), passno = dict(default=None, type='str'),
dump = dict(default=None), dump = dict(default=None),
src = dict(required=True), src = dict(required=False),
fstype = dict(required=True), fstype = dict(required=False),
fstab = dict(default='/etc/fstab') fstab = dict(default='/etc/fstab')
), ),
supports_check_mode=True supports_check_mode=True,
required_if = (
['state', 'mounted', ['src', 'fstype']],
['state', 'present', ['src', 'fstype']]
)
) )
changed = False changed = False
rc = 0 rc = 0
args = { args = {'name': module.params['name']}
'name': module.params['name'], if module.params['src'] is not None:
'src': module.params['src'], args['src'] = module.params['src']
'fstype': module.params['fstype'] if module.params['fstype'] is not None:
} args['fstype'] = module.params['fstype']
if module.params['passno'] is not None: if module.params['passno'] is not None:
args['passno'] = module.params['passno'] args['passno'] = module.params['passno']
if module.params['opts'] is not None: if module.params['opts'] is not None:

Loading…
Cancel
Save