From 820cfbbb77a74ac8b95b696a292707da38b4ee75 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 5 Aug 2019 15:26:14 -0700 Subject: [PATCH] Bug fixes for GCP modules (#60089) --- .../google/gcp_compute_global_address_facts.py | 1 - .../gcp_compute_global_forwarding_rule_facts.py | 1 - .../cloud/google/gcp_compute_health_check_facts.py | 1 - .../google/gcp_compute_http_health_check_facts.py | 1 - .../google/gcp_compute_https_health_check_facts.py | 1 - .../cloud/google/gcp_compute_image_facts.py | 1 - .../cloud/google/gcp_compute_instance_facts.py | 1 - .../google/gcp_compute_instance_group_facts.py | 1 - .../gcp_compute_instance_group_manager_facts.py | 1 - .../cloud/google/gcp_compute_instance_template.py | 14 ++++++++++++++ .../google/gcp_compute_instance_template_facts.py | 6 +++++- .../gcp_compute_interconnect_attachment_facts.py | 1 - .../cloud/google/gcp_compute_network_facts.py | 1 - .../tasks/main.yml | 2 -- .../gcp_compute_health_check/tasks/main.yml | 2 -- .../gcp_compute_http_health_check/tasks/main.yml | 2 -- .../gcp_compute_https_health_check/tasks/main.yml | 2 -- .../targets/gcp_compute_image/tasks/main.yml | 2 -- .../targets/gcp_compute_instance/tasks/main.yml | 2 -- .../gcp_compute_instance_group/tasks/main.yml | 2 -- .../tasks/main.yml | 2 -- .../gcp_compute_instance_template/tasks/main.yml | 2 -- .../targets/gcp_compute_network/tasks/main.yml | 2 -- 23 files changed, 19 insertions(+), 32 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py index b03e23a4edf..ae590e7fc48 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index 3cb35bb1f87..066efbc8745 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py index 5bacb8cdb5a..5f4fbcd870a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py index 9aa68225875..1f21f8a1d95 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py index db0728897ca..190022934c8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py index 98b47cb6bc8..3ea3c41b45b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_image_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py index 0aad2e83e03..0974dd3da2f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py @@ -62,7 +62,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py index 9b6ba09dcea..1d5c7433cd6 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py @@ -62,7 +62,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py index 389e29c35ab..7cf3ab43672 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py @@ -62,7 +62,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 365fd510a5c..ff52c84053f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -230,6 +230,12 @@ options: - 'Some valid choices include: "SCRATCH", "PERSISTENT"' required: false type: str + labels: + description: + - Labels to apply to this address. A list of key->value pairs. + required: false + type: dict + version_added: 2.9 machine_type: description: - The machine type to use in the VM instance template. @@ -673,6 +679,11 @@ properties: the default is PERSISTENT. returned: success type: str + labels: + description: + - Labels to apply to this address. A list of key->value pairs. + returned: success + type: dict machineType: description: - The machine type to use in the VM instance template. @@ -921,6 +932,7 @@ def main(): type=dict(type='str'), ), ), + labels=dict(type='dict'), machine_type=dict(required=True, type='str'), min_cpu_platform=dict(type='str'), metadata=dict(type='dict'), @@ -1190,6 +1202,7 @@ class InstanceTemplateProperties(object): u'canIpForward': self.request.get('can_ip_forward'), u'description': self.request.get('description'), u'disks': InstanceTemplateDisksArray(self.request.get('disks', []), self.module).to_request(), + u'labels': self.request.get('labels'), u'machineType': self.request.get('machine_type'), u'minCpuPlatform': self.request.get('min_cpu_platform'), u'metadata': self.request.get('metadata'), @@ -1207,6 +1220,7 @@ class InstanceTemplateProperties(object): u'canIpForward': self.request.get(u'canIpForward'), u'description': self.request.get(u'description'), u'disks': InstanceTemplateDisksArray(self.request.get(u'disks', []), self.module).from_response(), + u'labels': self.request.get(u'labels'), u'machineType': self.request.get(u'machineType'), u'minCpuPlatform': self.request.get(u'minCpuPlatform'), u'metadata': self.request.get(u'metadata'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py index df70ee49fa8..75d22dd6e6f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' @@ -258,6 +257,11 @@ resources: specified, the default is PERSISTENT. returned: success type: str + labels: + description: + - Labels to apply to this address. A list of key->value pairs. + returned: success + type: dict machineType: description: - The machine type to use in the VM instance template. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py index 59fabe1b49a..b141a2a59eb 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py @@ -62,7 +62,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py index 5b910d51d5f..d0765f54b50 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_network_facts.py @@ -56,7 +56,6 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: facts ''' RETURN = ''' diff --git a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index 91eae2512ad..3f7f00bbdc6 100644 --- a/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#forwardingRule'" - name: verify that global_forwarding_rule was created gcp_compute_global_forwarding_rule_facts: filters: @@ -133,7 +132,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#forwardingRule'" #---------------------------------------------------------- - name: delete a global forwarding rule gcp_compute_global_forwarding_rule: diff --git a/test/integration/targets/gcp_compute_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_health_check/tasks/main.yml index 13a5fd626ce..72aed1667de 100644 --- a/test/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -49,7 +49,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#healthCheck'" - name: verify that health_check was created gcp_compute_health_check_facts: filters: @@ -85,7 +84,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#healthCheck'" #---------------------------------------------------------- - name: delete a health check gcp_compute_health_check: diff --git a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml index 62fa3d32acf..948568eaa97 100644 --- a/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_http_health_check/tasks/main.yml @@ -41,7 +41,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#httpHealthCheck'" - name: verify that http_health_check was created gcp_compute_http_health_check_facts: filters: @@ -73,7 +72,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#httpHealthCheck'" #---------------------------------------------------------- - name: delete a http health check gcp_compute_http_health_check: diff --git a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml index 8aabb0b6827..d9952c2101d 100644 --- a/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_https_health_check/tasks/main.yml @@ -41,7 +41,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#httpsHealthCheck'" - name: verify that https_health_check was created gcp_compute_https_health_check_facts: filters: @@ -73,7 +72,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#httpsHealthCheck'" #---------------------------------------------------------- - name: delete a https health check gcp_compute_https_health_check: diff --git a/test/integration/targets/gcp_compute_image/tasks/main.yml b/test/integration/targets/gcp_compute_image/tasks/main.yml index 6ddc8187a75..05706b6757b 100644 --- a/test/integration/targets/gcp_compute_image/tasks/main.yml +++ b/test/integration/targets/gcp_compute_image/tasks/main.yml @@ -44,7 +44,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#image'" - name: verify that image was created gcp_compute_image_facts: filters: @@ -73,7 +72,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#image'" #---------------------------------------------------------- - name: delete a image gcp_compute_image: diff --git a/test/integration/targets/gcp_compute_instance/tasks/main.yml b/test/integration/targets/gcp_compute_instance/tasks/main.yml index baf544235c7..b173e7909f2 100644 --- a/test/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance/tasks/main.yml @@ -95,7 +95,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#instance'" - name: verify that instance was created gcp_compute_instance_facts: filters: @@ -141,7 +140,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#instance'" #---------------------------------------------------------- - name: delete a instance gcp_compute_instance: diff --git a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml index 0ac5d42f00a..2687523fbc8 100644 --- a/test/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -51,7 +51,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#instanceGroup'" - name: verify that instance_group was created gcp_compute_instance_group_facts: filters: @@ -85,7 +84,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#instanceGroup'" #---------------------------------------------------------- - name: delete a instance group gcp_compute_instance_group: diff --git a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 961b07952e3..1ce66abe35d 100644 --- a/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -79,7 +79,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#instanceGroupManager'" - name: verify that instance_group_manager was created gcp_compute_instance_group_manager_facts: filters: @@ -112,7 +111,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#instanceGroupManager'" #---------------------------------------------------------- - name: delete a instance group manager gcp_compute_instance_group_manager: diff --git a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml index 6d0fcf42d7a..9d5f809ff91 100644 --- a/test/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/test/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -76,7 +76,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#instanceTemplate'" - name: verify that instance_template was created gcp_compute_instance_template_facts: filters: @@ -117,7 +116,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#instanceTemplate'" #---------------------------------------------------------- - name: delete a instance template gcp_compute_instance_template: diff --git a/test/integration/targets/gcp_compute_network/tasks/main.yml b/test/integration/targets/gcp_compute_network/tasks/main.yml index a20f3585742..a20a9ffcd1e 100644 --- a/test/integration/targets/gcp_compute_network/tasks/main.yml +++ b/test/integration/targets/gcp_compute_network/tasks/main.yml @@ -35,7 +35,6 @@ assert: that: - result.changed == true - - "result.kind == 'compute#network'" - name: verify that network was created gcp_compute_network_facts: filters: @@ -64,7 +63,6 @@ assert: that: - result.changed == false - - "result.kind == 'compute#network'" #---------------------------------------------------------- - name: delete a network gcp_compute_network: