1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

zfs: deprecate key=value 'option' (#55699)

* zfs: deprecate key=value 'option'

Fixes #55318

* Not needed to ignore these anymore
This commit is contained in:
Martin Krizek 2019-04-29 08:07:22 +02:00 committed by GitHub
parent fd2ea34444
commit 8e82baba4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 38 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- zfs - Remove deprecated key=value 'option' (https://github.com/ansible/ansible/issues/55318)

View file

@ -34,12 +34,6 @@ options:
origin:
description:
- Snapshot from which to create a clone.
key_value:
description:
- (**DEPRECATED**) This will be removed in Ansible-2.9. Set these values in the
- C(extra_zfs_properties) option instead.
- The C(zfs) module takes key=value pairs for zfs properties to be set.
- See the zfs(8) man page for more information.
extra_zfs_properties:
description:
- A dictionary of zfs properties to be set.
@ -227,14 +221,9 @@ def main():
name=dict(type='str', required=True),
state=dict(type='str', required=True, choices=['absent', 'present']),
origin=dict(type='str', default=None),
# createparent is meaningless after 2.3, but this shouldn't
# be removed until check_invalid_arguments is.
createparent=dict(type='bool', default=None),
extra_zfs_properties=dict(type='dict', default={}),
),
supports_check_mode=True,
# Remove this in Ansible 2.9
check_invalid_arguments=False,
)
state = module.params.get('state')
@ -243,31 +232,6 @@ def main():
if module.params.get('origin') and '@' in name:
module.fail_json(msg='cannot specify origin when operating on a snapshot')
# The following is deprecated. Remove in Ansible 2.9
# Get all valid zfs-properties
properties = dict()
for prop, value in module.params.items():
# All freestyle params are zfs properties
if prop not in module.argument_spec:
if isinstance(value, bool):
if value is True:
properties[prop] = 'on'
else:
properties[prop] = 'off'
else:
properties[prop] = value
if properties:
module.deprecate('Passing zfs properties as arbitrary parameters to the zfs module is'
' deprecated. Send them as a dictionary in the extra_zfs_properties'
' parameter instead.', version='2.9')
# Merge, giving the module_params precedence
for prop, value in module.params['extra_zfs_properties'].items():
properties[prop] = value
module.params['extra_zfs_properties'] = properties
# End deprecated section
# Reverse the boolification of zfs properties
for prop, value in module.params['extra_zfs_properties'].items():
if isinstance(value, bool):

View file

@ -772,8 +772,6 @@ lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py E324
lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py E326
lib/ansible/modules/storage/netapp/netapp_e_volume_copy.py E335
lib/ansible/modules/storage/purestorage/purefb_fs.py E324
lib/ansible/modules/storage/zfs/zfs.py E322
lib/ansible/modules/storage/zfs/zfs.py E323
lib/ansible/modules/storage/zfs/zfs_facts.py E323
lib/ansible/modules/storage/zfs/zpool_facts.py E323
lib/ansible/modules/system/known_hosts.py E324