mount: PEP8 compliancy and doc fixes

This PR includes:
- PEP8 compliancy fixes
- Documentation fixes
pull/30908/merge
Dag Wieers 7 years ago
parent b672fd1f45
commit 125c4b135d

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2012, Red Hat, inc # Copyright: (c) 2012, Red Hat, inc
# Written by Seth Vidal # Written by Seth Vidal
# based on the mount modules from salt and puppet # based on the mount modules from salt and puppet
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
@ -9,12 +9,10 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'core'} 'supported_by': 'core'}
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: mount module: mount
@ -37,25 +35,18 @@ options:
description: description:
- Device to be mounted on I(path). Required when I(state) set to - Device to be mounted on I(path). Required when I(state) set to
C(present) or C(mounted). C(present) or C(mounted).
required: false
default: null
fstype: fstype:
description: description:
- Filesystem type. Required when I(state) is C(present) or C(mounted). - Filesystem type. Required when I(state) is C(present) or C(mounted).
required: false
default: null
opts: opts:
description: description:
- Mount options (see fstab(5), or vfstab(4) on Solaris). - Mount options (see fstab(5), or vfstab(4) on Solaris).
required: false
default: null
dump: dump:
description: description:
- Dump (see fstab(5)). Note that if set to C(null) and I(state) set to - Dump (see fstab(5)). Note that if set to C(null) and I(state) set to
C(present), it will cease to work and duplicate entries will be made C(present), it will cease to work and duplicate entries will be made
with subsequent runs. with subsequent runs.
- Has no effect on Solaris systems. - Has no effect on Solaris systems.
required: false
default: 0 default: 0
passno: passno:
description: description:
@ -63,7 +54,6 @@ options:
C(present), it will cease to work and duplicate entries will be made C(present), it will cease to work and duplicate entries will be made
with subsequent runs. with subsequent runs.
- Deprecated on Solaris systems. - Deprecated on Solaris systems.
required: false
default: 0 default: 0
state: state:
description: description:
@ -76,7 +66,7 @@ options:
point will be created. point will be created.
- Similarly, specifying C(absent) will remove the mount point directory. - Similarly, specifying C(absent) will remove the mount point directory.
required: true required: true
choices: ["present", "absent", "mounted", "unmounted"] choices: [ absent, mounted, present, unmounted ]
fstab: fstab:
description: description:
- File to use instead of C(/etc/fstab). You shouldn't use this option - File to use instead of C(/etc/fstab). You shouldn't use this option
@ -85,16 +75,14 @@ options:
does not allow specifying alternate fstab files with mount so do not does not allow specifying alternate fstab files with mount so do not
use this on OpenBSD with any state that operates on the live use this on OpenBSD with any state that operates on the live
filesystem. filesystem.
required: false
default: /etc/fstab (/etc/vfstab on Solaris) default: /etc/fstab (/etc/vfstab on Solaris)
boot: boot:
version_added: 2.2
description: description:
- Determines if the filesystem should be mounted on boot. - Determines if the filesystem should be mounted on boot.
- Only applies to Solaris systems. - Only applies to Solaris systems.
required: false type: bool
default: yes default: 'yes'
choices: ["yes", "no"] version_added: '2.2'
notes: notes:
- As of Ansible 2.3, the I(name) option has been changed to I(path) as - As of Ansible 2.3, the I(name) option has been changed to I(path) as
default, but I(name) still works as well. default, but I(name) still works as well.
@ -356,7 +344,7 @@ def mount(module, args):
if rc == 0: if rc == 0:
return 0, '' return 0, ''
else: else:
return rc, out+err return rc, out + err
def umount(module, path): def umount(module, path):
@ -370,7 +358,7 @@ def umount(module, path):
if rc == 0: if rc == 0:
return 0, '' return 0, ''
else: else:
return rc, out+err return rc, out + err
def remount(module, args): def remount(module, args):
@ -551,23 +539,21 @@ def get_linux_mounts(module, mntinfo_file="/proc/self/mountinfo"):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
boot=dict(default='yes', choices=['yes', 'no']), boot=dict(type='bool', default=True),
dump=dict(), dump=dict(type='str'),
fstab=dict(default=None), fstab=dict(type='str'),
fstype=dict(), fstype=dict(type='str'),
path=dict(required=True, aliases=['name'], type='path'), path=dict(type='path', required=True, aliases=['name']),
opts=dict(), opts=dict(type='str'),
passno=dict(type='str'), passno=dict(type='str'),
src=dict(type='path'), src=dict(type='path'),
state=dict( state=dict(type='str', required=True, choices=['absent', 'mounted', 'present', 'unmounted']),
required=True,
choices=['present', 'absent', 'mounted', 'unmounted']),
), ),
supports_check_mode=True, supports_check_mode=True,
required_if=( required_if=(
['state', 'mounted', ['src', 'fstype']], ['state', 'mounted', ['src', 'fstype']],
['state', 'present', ['src', 'fstype']] ['state', 'present', ['src', 'fstype']],
) ),
) )
# solaris args: # solaris args:

@ -419,7 +419,6 @@ lib/ansible/modules/system/locale_gen.py
lib/ansible/modules/system/lvg.py lib/ansible/modules/system/lvg.py
lib/ansible/modules/system/lvol.py lib/ansible/modules/system/lvol.py
lib/ansible/modules/system/modprobe.py lib/ansible/modules/system/modprobe.py
lib/ansible/modules/system/mount.py
lib/ansible/modules/system/ohai.py lib/ansible/modules/system/ohai.py
lib/ansible/modules/system/open_iscsi.py lib/ansible/modules/system/open_iscsi.py
lib/ansible/modules/system/openwrt_init.py lib/ansible/modules/system/openwrt_init.py

Loading…
Cancel
Save