zfs: PEP8 compliancy and documentation changes (#32648)

This PR includes:
- PEP8 compliancy changes
- Documentation changes
pull/30582/head
Dag Wieers 7 years ago committed by ansibot
parent c93ddf5473
commit 10bfa89f06

@ -1,83 +1,78 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Johan Wiren <johan.wiren.se@gmail.com>
# Copyright: (c) 2013, Johan Wiren <johan.wiren.se@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: zfs
short_description: Manage zfs
description:
- Manages ZFS file systems, volumes, clones and snapshots.
- Manages ZFS file systems, volumes, clones and snapshots
version_added: "1.1"
options:
name:
description:
- File system, snapshot or volume name e.g. C(rpool/myfs)
- File system, snapshot or volume name e.g. C(rpool/myfs).
required: true
state:
description:
- Whether to create (C(present)), or remove (C(absent)) a
file system, snapshot or volume. All parents/children
will be created/destroyed as needed to reach the desired state.
choices: ['present', 'absent']
choices: [ absent, present ]
required: true
origin:
description:
- Snapshot from which to create a clone
default: null
required: false
- Snapshot from which to create a clone.
key_value:
description:
- The C(zfs) module takes key=value pairs for zfs properties to be set. See the zfs(8) man page for more information.
default: null
required: false
author: "Johan Wiren (@johanwiren)"
- The C(zfs) module takes key=value pairs for zfs properties to be set.
- See the zfs(8) man page for more information.
author:
- Johan Wiren (@johanwiren)
'''
EXAMPLES = '''
# Create a new file system called myfs in pool rpool with the setuid property turned off
- zfs:
- name: Create a new file system called myfs in pool rpool with the setuid property turned off
zfs:
name: rpool/myfs
state: present
setuid: off
# Create a new volume called myvol in pool rpool.
- zfs:
- name: Create a new volume called myvol in pool rpool.
zfs:
name: rpool/myvol
state: present
volsize: 10M
# Create a snapshot of rpool/myfs file system.
- zfs:
- name: Create a snapshot of rpool/myfs file system.
zfs:
name: rpool/myfs@mysnapshot
state: present
# Create a new file system called myfs2 with snapdir enabled
- zfs:
- name: Create a new file system called myfs2 with snapdir enabled
zfs:
name: rpool/myfs2
state: present
snapdir: enabled
# Create a new file system by cloning a snapshot
- zfs:
- name: Create a new file system by cloning a snapshot
zfs:
name: rpool/cloned_fs
state: present
origin: rpool/myfs@mysnapshot
# Destroy a filesystem
- zfs:
- name: Destroy a filesystem
zfs:
name: rpool/myfs
state: absent
'''
@ -220,12 +215,12 @@ def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(type='str', required=True),
state = dict(type='str', required=True, choices=['present', 'absent']),
state=dict(type='str', required=True, choices=['absent', 'present']),
# No longer used. Kept here to not interfere with zfs properties
createparent = dict(type='bool', required=False)
createparent=dict(type='bool'),
),
supports_check_mode=True,
check_invalid_arguments=False
check_invalid_arguments=False,
)
state = module.params.pop('state')
@ -245,9 +240,10 @@ def main():
else:
properties[prop] = value
result = {}
result['name'] = name
result['state'] = state
result = dict(
name=name,
state=state,
)
zfs = Zfs(module, name, properties)

@ -306,4 +306,3 @@ lib/ansible/modules/storage/netapp/netapp_e_storagepool.py
lib/ansible/modules/storage/netapp/sf_snapshot_schedule_manager.py
lib/ansible/modules/storage/netapp/sf_volume_access_group_manager.py
lib/ansible/modules/storage/netapp/sf_volume_manager.py
lib/ansible/modules/storage/zfs/zfs.py

Loading…
Cancel
Save