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 b03e23a4ed..ae590e7fc4 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 3cb35bb1f8..066efbc874 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 5bacb8cdb5..5f4fbcd870 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 9aa6822587..1f21f8a1d9 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 db0728897c..190022934c 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 98b47cb6bc..3ea3c41b45 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 0aad2e83e0..0974dd3da2 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 9b6ba09dce..1d5c7433cd 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 389e29c35a..7cf3ab4367 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 365fd510a5..ff52c84053 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 df70ee49fa..75d22dd6e6 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 59fabe1b49..b141a2a59e 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 5b910d51d5..d0765f54b5 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 91eae2512a..3f7f00bbdc 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 13a5fd626c..72aed1667d 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 62fa3d32ac..948568eaa9 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 8aabb0b682..d9952c2101 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 6ddc8187a7..05706b6757 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 baf544235c..b173e7909f 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 0ac5d42f00..2687523fbc 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 961b07952e..1ce66abe35 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 6d0fcf42d7..9d5f809ff9 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 a20f358574..a20a9ffcd1 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: