Skip to content

Commit

Permalink
Remove deprecated parameter for 2.10 in purefb_fs (ansible#67026)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdodsley authored Feb 2, 2020
1 parent 8f10db8 commit b1a8bde
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
removed_features:
- purefb_fs - ``nfs`` parameter deprecated. Use ``nfsv3`` instead (https://github.com/ansible/ansible/pull/67026)
1 change: 1 addition & 0 deletions docs/docsite/rst/porting_guides/porting_guide_2.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Noteworthy module changes
* Junction points are no longer reported as ``islnk``, use ``isjunction`` to properly report these files. This behaviour matches the :ref:`win_stat <win_stat_module>`
* Directories no longer return a ``size``, this matches the ``stat`` and ``find`` behaviour and has been removed due to the difficulties in correctly reporting the size of a directory
* :ref:`docker_container <docker_container_module>` no longer passes information on non-anonymous volumes or binds as ``Volumes`` to the Docker daemon. This increases compatibility with the ``docker`` CLI program. Note that if you specify ``volumes: strict`` in ``comparisons``, this could cause existing containers created with docker_container from Ansible 2.9 or earlier to restart.
* :ref:`purefb_fs <purefb_fs_module>` no longer supports the deprecated ``nfs`` option. This has been superceeded by ``nfsv3``.

Plugins
=======
Expand Down
39 changes: 13 additions & 26 deletions lib/ansible/modules/storage/purestorage/purefb_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@
type: bool
default: true
version_added: 2.9
nfs:
description:
- (Deprecate) Define whether to NFSv3 protocol is enabled for the filesystem.
- This option will be deprecated in 2.10, use I(nfsv3) instead.
required: false
type: bool
default: true
nfs_rules:
description:
- Define the NFS rules in operation.
Expand Down Expand Up @@ -208,7 +201,6 @@ def create_fs(module, blade):
module.params['size'] = '32G'

size = human_to_bytes(module.params['size'])
nfsv3 = module.params['nfs'] if module.params['nfsv3'] is None else module.params['nfsv3']

if module.params['user_quota']:
user_quota = human_to_bytes(module.params['user_quota'])
Expand All @@ -227,7 +219,7 @@ def create_fs(module, blade):
fast_remove_directory_enabled=module.params['fastremove'],
hard_limit_enabled=module.params['hard_limit'],
snapshot_directory_enabled=module.params['snapshot'],
nfs=NfsRule(v3_enabled=nfsv3,
nfs=NfsRule(v3_enabled=module.params['nfsv3'],
v4_1_enabled=module.params['nfsv4'],
rules=module.params['nfs_rules']),
smb=ProtocolRule(enabled=module.params['smb']),
Expand All @@ -241,7 +233,7 @@ def create_fs(module, blade):
fast_remove_directory_enabled=module.params['fastremove'],
hard_limit_enabled=module.params['hard_limit'],
snapshot_directory_enabled=module.params['snapshot'],
nfs=NfsRule(enabled=nfsv3, rules=module.params['nfs_rules']),
nfs=NfsRule(enabled=module.params['nfsv3'], rules=module.params['nfs_rules']),
smb=ProtocolRule(enabled=module.params['smb']),
http=ProtocolRule(enabled=module.params['http'])
)
Expand All @@ -250,7 +242,7 @@ def create_fs(module, blade):
provisioned=size,
fast_remove_directory_enabled=module.params['fastremove'],
snapshot_directory_enabled=module.params['snapshot'],
nfs=NfsRule(enabled=module.params['nfs'], rules=module.params['nfs_rules']),
nfs=NfsRule(enabled=module.params['nfsv3'], rules=module.params['nfs_rules']),
smb=ProtocolRule(enabled=module.params['smb']),
http=ProtocolRule(enabled=module.params['http'])
)
Expand All @@ -265,7 +257,6 @@ def modify_fs(module, blade):
changed = True
if not module.check_mode:
mod_fs = False
nfsv3 = module.params['nfs'] if module.params['nfsv3'] is None else module.params['nfsv3']
attr = {}
if module.params['user_quota']:
user_quota = human_to_bytes(module.params['user_quota'])
Expand All @@ -281,19 +272,19 @@ def modify_fs(module, blade):
mod_fs = True
api_version = blade.api_version.list_versions().versions
if NFSV4_API_VERSION in api_version:
if nfsv3 and not fsys.nfs.v3_enabled:
attr['nfs'] = NfsRule(v3_enabled=nfsv3)
if module.params['nfsv3'] and not fsys.nfs.v3_enabled:
attr['nfs'] = NfsRule(v3_enabled=module.params['nfsv3'])
mod_fs = True
if not nfsv3 and fsys.nfs.v3_enabled:
attr['nfs'] = NfsRule(v3_enabled=nfsv3)
if not module.params['nfsv3'] and fsys.nfs.v3_enabled:
attr['nfs'] = NfsRule(v3_enabled=module.params['nfsv3'])
mod_fs = True
if module.params['nfsv4'] and not fsys.nfs.v4_1_enabled:
attr['nfs'] = NfsRule(v4_1_enabled=module.params['nfsv4'])
mod_fs = True
if not module.params['nfsv4'] and fsys.nfs.v4_1_enabled:
attr['nfs'] = NfsRule(v4_1_enabled=module.params['nfsv4'])
mod_fs = True
if nfsv3 or module.params['nfsv4'] and fsys.nfs.v3_enabled or fsys.nfs.v4_1_enabled:
if module.params['nfsv3'] or module.params['nfsv4'] and fsys.nfs.v3_enabled or fsys.nfs.v4_1_enabled:
if fsys.nfs.rules != module.params['nfs_rules']:
attr['nfs'] = NfsRule(rules=module.params['nfs_rules'])
mod_fs = True
Expand All @@ -304,13 +295,13 @@ def modify_fs(module, blade):
attr['default_group_quota'] = group_quota
mod_fs = True
else:
if nfsv3 and not fsys.nfs.enabled:
attr['nfs'] = NfsRule(enabled=nfsv3)
if module.params['nfsv3'] and not fsys.nfs.enabled:
attr['nfs'] = NfsRule(enabled=module.params['nfsv3'])
mod_fs = True
if not nfsv3 and fsys.nfs.enabled:
attr['nfs'] = NfsRule(enabled=nfsv3)
if not module.params['nfsv3'] and fsys.nfs.enabled:
attr['nfs'] = NfsRule(enabled=module.params['nfsv3'])
mod_fs = True
if nfsv3 and fsys.nfs.enabled:
if module.params['nfsv3'] and fsys.nfs.enabled:
if fsys.nfs.rules != module.params['nfs_rules']:
attr['nfs'] = NfsRule(rules=module.params['nfs_rules'])
mod_fs = True
Expand Down Expand Up @@ -406,7 +397,6 @@ def main():
dict(
name=dict(required=True),
eradicate=dict(default='false', type='bool'),
nfs=dict(removed_in_version='2.10', default='true', type='bool'),
nfsv3=dict(default='true', type='bool'),
nfsv4=dict(default='true', type='bool'),
nfs_rules=dict(default='*(rw,no_root_squash)'),
Expand All @@ -422,10 +412,7 @@ def main():
)
)

mutually_exclusive = [['nfs', 'nfsv3']]

module = AnsibleModule(argument_spec,
mutually_exclusive=mutually_exclusive,
supports_check_mode=True)

if not HAS_PURITY_FB:
Expand Down

0 comments on commit b1a8bde

Please sign in to comment.