From 668d8556c8b4fc3f9aed9ebe4305bf0978ae79ec Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 17:46:00 +1300 Subject: [PATCH 1/7] fixed validation-modules for plugins/modules/cloud/smartos/smartos_image_info.py --- plugins/modules/cloud/smartos/smartos_image_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/cloud/smartos/smartos_image_info.py b/plugins/modules/cloud/smartos/smartos_image_info.py index 17761af8a5e..473d345ad89 100644 --- a/plugins/modules/cloud/smartos/smartos_image_info.py +++ b/plugins/modules/cloud/smartos/smartos_image_info.py @@ -24,6 +24,7 @@ manifest and 'published_date', 'published', 'source', 'clones', and 'size'. More information can be found at U(https://smartos.org/man/1m/imgadm) under 'imgadm list'. + type: str ''' EXAMPLES = ''' From 9825c50dea6a9e7f816ecead4efd43bca88c1f20 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 21:11:14 +1300 Subject: [PATCH 2/7] fixed validation-modules for plugins/modules/cloud/rackspace/rax_scaling_group.py --- plugins/modules/cloud/rackspace/rax_scaling_group.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/modules/cloud/rackspace/rax_scaling_group.py b/plugins/modules/cloud/rackspace/rax_scaling_group.py index 7b2b6ace79b..2f8fa0a2cc9 100644 --- a/plugins/modules/cloud/rackspace/rax_scaling_group.py +++ b/plugins/modules/cloud/rackspace/rax_scaling_group.py @@ -53,6 +53,7 @@ - key pair to use on the instance loadbalancers: type: list + elements: dict description: - List of load balancer C(id) and C(port) hashes max_entities: @@ -78,6 +79,7 @@ required: true networks: type: list + elements: str description: - The network to attach to the instances. If specified, you must include ALL networks including the public and private interfaces. Can be C(id) @@ -376,12 +378,12 @@ def main(): flavor=dict(required=True), image=dict(required=True), key_name=dict(), - loadbalancers=dict(type='list'), + loadbalancers=dict(type='list', elements='dict'), meta=dict(type='dict', default={}), min_entities=dict(type='int', required=True), max_entities=dict(type='int', required=True), name=dict(required=True), - networks=dict(type='list', default=['public', 'private']), + networks=dict(type='list', elements='str', default=['public', 'private']), server_name=dict(required=True), state=dict(default='present', choices=['present', 'absent']), user_data=dict(no_log=True), From 984d132174f519100a494a6b9061ba2e90dd91f7 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 21:21:03 +1300 Subject: [PATCH 3/7] fixed validation-modules for plugins/modules/cloud/rackspace/rax_cdb_user.py --- plugins/modules/cloud/rackspace/rax_cdb_user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/cloud/rackspace/rax_cdb_user.py b/plugins/modules/cloud/rackspace/rax_cdb_user.py index 34be49d8628..2034170f423 100644 --- a/plugins/modules/cloud/rackspace/rax_cdb_user.py +++ b/plugins/modules/cloud/rackspace/rax_cdb_user.py @@ -30,6 +30,7 @@ required: yes databases: type: list + elements: str description: - Name of the databases that the user can access default: [] @@ -189,7 +190,7 @@ def main(): cdb_id=dict(type='str', required=True), db_username=dict(type='str', required=True), db_password=dict(type='str', required=True, no_log=True), - databases=dict(type='list', default=[]), + databases=dict(type='list', elements='str', default=[]), host=dict(type='str', default='%'), state=dict(default='present', choices=['present', 'absent']) ) From 5be7c1e524228c8cd9a1fe549f0b517cbf4821f6 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 22:16:55 +1300 Subject: [PATCH 4/7] fixed validation-modules for plugins/modules/cloud/rackspace/rax.py --- plugins/modules/cloud/rackspace/rax.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/modules/cloud/rackspace/rax.py b/plugins/modules/cloud/rackspace/rax.py index 9f7df5c45b0..18769fd45e3 100644 --- a/plugins/modules/cloud/rackspace/rax.py +++ b/plugins/modules/cloud/rackspace/rax.py @@ -110,6 +110,7 @@ with this image instance_ids: type: list + elements: str description: - list of instance ids, currently only used when state='absent' to remove instances @@ -129,6 +130,7 @@ - Name to give the instance networks: type: list + elements: str description: - The network to attach to the instances. If specified, you must include ALL networks including the public and private interfaces. Can be C(id) @@ -810,12 +812,11 @@ def main(): flavor=dict(), group=dict(), image=dict(), - instance_ids=dict(type='list'), + instance_ids=dict(type='list', elements='str'), key_name=dict(aliases=['keypair']), meta=dict(type='dict', default={}), name=dict(), - networks=dict(type='list', default=['public', 'private']), - service=dict(), + networks=dict(type='list', elements='str', default=['public', 'private']), state=dict(default='present', choices=['present', 'absent']), user_data=dict(no_log=True), wait=dict(default=False, type='bool'), @@ -831,12 +832,7 @@ def main(): if not HAS_PYRAX: module.fail_json(msg='pyrax is required for this module') - service = module.params.get('service') - - if service is not None: - module.fail_json(msg='The "service" attribute has been deprecated, ' - 'please remove "service: cloudservers" from your ' - 'playbook pertaining to the "rax" module') + # this if has been here at least as far back as Ansible 2.3.0 auto_increment = module.params.get('auto_increment') boot_from_volume = module.params.get('boot_from_volume') From 1b9dbc3996a27c282aff6a784808c0eeb1b3a433 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 22:30:12 +1300 Subject: [PATCH 5/7] Tidy up sanity checks ignore lines modules (batch 8) --- tests/sanity/ignore-2.10.txt | 8 +------- tests/sanity/ignore-2.11.txt | 8 +------- tests/sanity/ignore-2.9.txt | 5 +---- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 6cc090eefda..22717659638 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -64,15 +64,10 @@ plugins/modules/cloud/ovirt/ovirt_vm_facts.py validate-modules:parameter-type-no plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed -plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type -plugins/modules/cloud/rackspace/rax.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter -plugins/modules/cloud/rackspace/rax_cdb_user.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path plugins/modules/cloud/rackspace/rax_mon_notification_plan.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed -plugins/modules/cloud/rackspace/rax_scaling_group.py validate-modules:parameter-list-no-elements +plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed, expanduser() applied to dict values plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_image_info.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_ip_facts.py validate-modules:return-syntax-error @@ -87,7 +82,6 @@ plugins/modules/cloud/scaleway/scaleway_snapshot_facts.py validate-modules:retur plugins/modules/cloud/scaleway/scaleway_snapshot_info.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_volume_info.py validate-modules:return-syntax-error -plugins/modules/cloud/smartos/smartos_image_info.py validate-modules:doc-missing-type plugins/modules/cloud/smartos/vmadm.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/smartos/vmadm.py validate-modules:undocumented-parameter plugins/modules/cloud/spotinst/spotinst_aws_elastigroup.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index b718639b773..e01f0ee9984 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -63,15 +63,10 @@ plugins/modules/cloud/ovirt/ovirt_vm_facts.py validate-modules:parameter-type-no plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed -plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type -plugins/modules/cloud/rackspace/rax.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter -plugins/modules/cloud/rackspace/rax_cdb_user.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path plugins/modules/cloud/rackspace/rax_mon_notification_plan.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed -plugins/modules/cloud/rackspace/rax_scaling_group.py validate-modules:parameter-list-no-elements +plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed, expanduser() applied to dict values plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_image_info.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_ip_facts.py validate-modules:return-syntax-error @@ -86,7 +81,6 @@ plugins/modules/cloud/scaleway/scaleway_snapshot_facts.py validate-modules:retur plugins/modules/cloud/scaleway/scaleway_snapshot_info.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_volume_info.py validate-modules:return-syntax-error -plugins/modules/cloud/smartos/smartos_image_info.py validate-modules:doc-missing-type plugins/modules/cloud/smartos/vmadm.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/smartos/vmadm.py validate-modules:undocumented-parameter plugins/modules/cloud/spotinst/spotinst_aws_elastigroup.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 06e83d35358..40eef942b41 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -94,10 +94,8 @@ plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:deprecation-m plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:invalid-documentation plugins/modules/cloud/rackspace/rax.py use-argspec-type-path -plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type -plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path -plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path +plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed, expanduser() applied to dict values plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:deprecation-mismatch plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:invalid-documentation plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:return-syntax-error @@ -126,7 +124,6 @@ plugins/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:depreca plugins/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:invalid-documentation plugins/modules/cloud/scaleway/scaleway_volume_facts.py validate-modules:return-syntax-error plugins/modules/cloud/scaleway/scaleway_volume_info.py validate-modules:return-syntax-error -plugins/modules/cloud/smartos/smartos_image_info.py validate-modules:doc-missing-type plugins/modules/cloud/smartos/vmadm.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/smartos/vmadm.py validate-modules:undocumented-parameter plugins/modules/cloud/spotinst/spotinst_aws_elastigroup.py validate-modules:parameter-type-not-in-doc From ab4f43a082817d4e76bbaf87dd3abf0438a046df Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Fri, 12 Mar 2021 22:38:49 +1300 Subject: [PATCH 6/7] added changelog fragment --- changelogs/fragments/2006-valmod-batch8.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/2006-valmod-batch8.yml diff --git a/changelogs/fragments/2006-valmod-batch8.yml b/changelogs/fragments/2006-valmod-batch8.yml new file mode 100644 index 00000000000..30be5e16b2a --- /dev/null +++ b/changelogs/fragments/2006-valmod-batch8.yml @@ -0,0 +1,4 @@ +minor_changes: + - rax - elements of list parameters are now validated (https://github.com/ansible-collections/community.general/pull/2006). + - rax_cdb_user - elements of list parameters are now validated (https://github.com/ansible-collections/community.general/pull/2006). + - rax_scaling_group - elements of list parameters are now validated (https://github.com/ansible-collections/community.general/pull/2006). From 2499f86a5cfa739e39b66ca255b2227fe7481e79 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky Date: Sun, 14 Mar 2021 19:07:19 +1300 Subject: [PATCH 7/7] rolled back removal of parameter from rax.py --- plugins/modules/cloud/rackspace/rax.py | 8 +++++++- tests/sanity/ignore-2.10.txt | 2 ++ tests/sanity/ignore-2.11.txt | 2 ++ tests/sanity/ignore-2.9.txt | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/modules/cloud/rackspace/rax.py b/plugins/modules/cloud/rackspace/rax.py index 18769fd45e3..d2d9119b027 100644 --- a/plugins/modules/cloud/rackspace/rax.py +++ b/plugins/modules/cloud/rackspace/rax.py @@ -817,6 +817,7 @@ def main(): meta=dict(type='dict', default={}), name=dict(), networks=dict(type='list', elements='str', default=['public', 'private']), + service=dict(), state=dict(default='present', choices=['present', 'absent']), user_data=dict(no_log=True), wait=dict(default=False, type='bool'), @@ -832,7 +833,12 @@ def main(): if not HAS_PYRAX: module.fail_json(msg='pyrax is required for this module') - # this if has been here at least as far back as Ansible 2.3.0 + service = module.params.get('service') + + if service is not None: + module.fail_json(msg='The "service" attribute has been deprecated, ' + 'please remove "service: cloudservers" from your ' + 'playbook pertaining to the "rax" module') auto_increment = module.params.get('auto_increment') boot_from_volume = module.params.get('boot_from_volume') diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 22717659638..bb785282208 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -64,6 +64,8 @@ plugins/modules/cloud/ovirt/ovirt_vm_facts.py validate-modules:parameter-type-no plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed +plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type +plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter plugins/modules/cloud/rackspace/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path plugins/modules/cloud/rackspace/rax_mon_notification_plan.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index e01f0ee9984..c30978e2478 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -63,6 +63,8 @@ plugins/modules/cloud/ovirt/ovirt_vm_facts.py validate-modules:parameter-type-no plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed +plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type +plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter plugins/modules/cloud/rackspace/rax_files.py validate-modules:parameter-state-invalid-choice plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path plugins/modules/cloud/rackspace/rax_mon_notification_plan.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 40eef942b41..0782b315930 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -94,6 +94,8 @@ plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:deprecation-m plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:doc-missing-type plugins/modules/cloud/ovirt/ovirt_vmpool_facts.py validate-modules:invalid-documentation plugins/modules/cloud/rackspace/rax.py use-argspec-type-path +plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type +plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter plugins/modules/cloud/rackspace/rax_files_objects.py use-argspec-type-path plugins/modules/cloud/rackspace/rax_scaling_group.py use-argspec-type-path # fix needed, expanduser() applied to dict values plugins/modules/cloud/scaleway/scaleway_image_facts.py validate-modules:deprecation-mismatch