From b712b01f6e83d188a4b5eb6628aadbca093990f2 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 20 May 2019 11:44:30 -0700 Subject: [PATCH] Bug fixes for GCP modules (#55973) --- .../google/gcp_bigquery_dataset_facts.py | 6 +- .../cloud/google/gcp_bigquery_table_facts.py | 6 +- .../google/gcp_cloudbuild_trigger_facts.py | 6 +- .../cloud/google/gcp_compute_address_facts.py | 6 +- .../gcp_compute_backend_bucket_facts.py | 6 +- .../google/gcp_compute_backend_service.py | 70 ++++++------------- .../gcp_compute_backend_service_facts.py | 31 +++----- .../cloud/google/gcp_compute_disk_facts.py | 6 +- .../google/gcp_compute_firewall_facts.py | 6 +- .../gcp_compute_forwarding_rule_facts.py | 6 +- .../gcp_compute_global_address_facts.py | 6 +- ...cp_compute_global_forwarding_rule_facts.py | 6 +- .../gcp_bigquery_dataset/tasks/main.yml | 4 +- .../targets/gcp_bigquery_table/tasks/main.yml | 4 +- .../gcp_compute_address/tasks/main.yml | 4 +- .../gcp_compute_backend_bucket/tasks/main.yml | 4 +- .../tasks/main.yml | 4 +- .../targets/gcp_compute_disk/tasks/main.yml | 4 +- .../gcp_compute_firewall/tasks/main.yml | 4 +- .../tasks/main.yml | 4 +- .../gcp_compute_global_address/tasks/main.yml | 4 +- .../tasks/main.yml | 4 +- .../gcp_compute_health_check/tasks/main.yml | 4 +- 23 files changed, 81 insertions(+), 124 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py index ab5f7f3db84..c2890120dde 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_dataset_facts.py @@ -53,8 +53,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -209,7 +209,7 @@ def main(): items = items.get('datasets') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py index 9aebcab67f1..404a7328aae 100644 --- a/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_bigquery_table_facts.py @@ -58,8 +58,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -523,7 +523,7 @@ def main(): items = items.get('tables') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py index 42c4dc6417e..54bc9ac4aeb 100644 --- a/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_cloudbuild_trigger_facts.py @@ -53,8 +53,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -325,7 +325,7 @@ def main(): items = items.get('triggers') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index 4ad4457577c..6bb0472cc36 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -66,8 +66,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -158,7 +158,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py index aa1dd499205..ef174f5800a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py @@ -60,8 +60,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -142,7 +142,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index a7c61aa7147..72f5f9426f9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -31,8 +31,9 @@ DOCUMENTATION = ''' --- module: gcp_compute_backend_service description: -- Creates a BackendService resource in the specified project using the data included - in the request. +- A Backend Service defines a group of virtual machines that will serve traffic for + load balancing. This resource is a global backend service, appropriate for external + load balancing. For internal load balancing, use a regional backend service instead. short_description: Creates a GCP BackendService version_added: 2.6 author: Google Inc. (@googlecloudplatform) @@ -65,7 +66,6 @@ options: - Specifies the balancing mode for this backend. - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. required: false default: UTILIZATION choices: @@ -80,7 +80,6 @@ options: capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. required: false default: '1.0' description: @@ -102,9 +101,6 @@ options: Group backends. - Note that you must specify an Instance Group or Network Endpoint Group resource using the fully-qualified URL, rather than a partial URL. - - When the BackendService has load balancing scheme INTERNAL, the instance - group must be within the same region as the BackendService. Network Endpoint - Groups are not supported for INTERNAL load balancing scheme. required: false max_connections: description: @@ -112,7 +108,6 @@ options: either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. required: false max_connections_per_instance: description: @@ -121,7 +116,6 @@ options: used in either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. required: false max_rate: description: @@ -129,7 +123,6 @@ options: - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. required: false max_rate_per_instance: description: @@ -137,13 +130,11 @@ options: This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. required: false max_utilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. required: false default: '0.8' cdn_policy: @@ -218,7 +209,6 @@ options: enable_cdn: description: - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. required: false type: bool health_checks: @@ -226,8 +216,6 @@ options: - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified - instead. required: true iap: description: @@ -252,12 +240,12 @@ options: description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot - be used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. + be used with the other. Must be `EXTERNAL` for a global backend service. Defaults + to `EXTERNAL`. required: false default: EXTERNAL version_added: 2.7 choices: - - INTERNAL - EXTERNAL name: description: @@ -272,18 +260,18 @@ options: description: - Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. required: false protocol: description: - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the default - is TCP. + - 'Possible values are HTTP, HTTPS, HTTP2, TCP, and SSL. The default is HTTP. + **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer types and may result + in errors if used with the GA API.' required: false choices: - HTTP - HTTPS + - HTTP2 - TCP - SSL security_policy: @@ -295,16 +283,12 @@ options: description: - Type of session affinity to use. The default is NONE. - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - When the protocol is UDP, this field is not used. required: false choices: - NONE - CLIENT_IP - GENERATED_COOKIE - - CLIENT_IP_PROTO - - CLIENT_IP_PORT_PROTO timeout_sec: description: - How many seconds to wait for the backend before considering it a failed request. @@ -313,6 +297,9 @@ options: aliases: - timeout_seconds extends_documentation_fragment: gcp +notes: +- 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/backendServices)' +- 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/http/backend-service)' ''' EXAMPLES = ''' @@ -373,7 +360,6 @@ backends: - Specifies the balancing mode for this backend. - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. returned: success type: str capacityScaler: @@ -383,7 +369,6 @@ backends: - Default value is 1, which means the group will serve up to 100% of its configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. returned: success type: str description: @@ -406,9 +391,6 @@ backends: Group backends. - Note that you must specify an Instance Group or Network Endpoint Group resource using the fully-qualified URL, rather than a partial URL. - - When the BackendService has load balancing scheme INTERNAL, the instance group - must be within the same region as the BackendService. Network Endpoint Groups - are not supported for INTERNAL load balancing scheme. returned: success type: str maxConnections: @@ -417,7 +399,6 @@ backends: either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxConnectionsPerInstance: @@ -427,7 +408,6 @@ backends: in either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxRate: @@ -436,7 +416,6 @@ backends: - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxRatePerInstance: @@ -445,14 +424,12 @@ backends: This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: str maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. returned: success type: str cdnPolicy: @@ -543,7 +520,6 @@ description: enableCDN: description: - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: bool healthChecks: @@ -551,8 +527,6 @@ healthChecks: - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified - instead. returned: success type: list id: @@ -590,7 +564,8 @@ loadBalancingScheme: description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot be - used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. + used with the other. Must be `EXTERNAL` for a global backend service. Defaults + to `EXTERNAL`. returned: success type: str name: @@ -607,15 +582,14 @@ portName: description: - Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: str protocol: description: - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the default - is TCP. + - 'Possible values are HTTP, HTTPS, HTTP2, TCP, and SSL. The default is HTTP. **NOTE**: + HTTP2 is only valid for beta HTTP/2 load balancer types and may result in errors + if used with the GA API.' returned: success type: str securityPolicy: @@ -627,8 +601,6 @@ sessionAffinity: description: - Type of session affinity to use. The default is NONE. - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - When the protocol is UDP, this field is not used. returned: success type: str @@ -699,12 +671,12 @@ def main(): type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(required=True, type='str'), oauth2_client_secret=dict(required=True, type='str')), ), - load_balancing_scheme=dict(default='EXTERNAL', type='str', choices=['INTERNAL', 'EXTERNAL']), + load_balancing_scheme=dict(default='EXTERNAL', type='str', choices=['EXTERNAL']), name=dict(required=True, type='str'), port_name=dict(type='str'), - protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), + protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL']), security_policy=dict(type='str'), - session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']), + session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE']), timeout_sec=dict(type='int', aliases=['timeout_seconds']), ) ) @@ -863,7 +835,7 @@ def response_to_hash(module, response): u'healthChecks': response.get(u'healthChecks'), u'id': response.get(u'id'), u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(), - u'loadBalancingScheme': response.get(u'loadBalancingScheme'), + u'loadBalancingScheme': module.params.get('load_balancing_scheme'), u'name': module.params.get('name'), u'portName': response.get(u'portName'), u'protocol': response.get(u'protocol'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index c1efa95322a..7c6e693582b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -60,8 +60,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -85,7 +85,6 @@ items: - Specifies the balancing mode for this backend. - For global HTTP(S) or TCP/SSL load balancing, the default is UTILIZATION. Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - - This cannot be used for internal load balancing. returned: success type: str capacityScaler: @@ -96,7 +95,6 @@ items: configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available Capacity. Valid range is [0.0,1.0]. - - This cannot be used for internal load balancing. returned: success type: str description: @@ -119,9 +117,6 @@ items: Group backends. - Note that you must specify an Instance Group or Network Endpoint Group resource using the fully-qualified URL, rather than a partial URL. - - When the BackendService has load balancing scheme INTERNAL, the instance - group must be within the same region as the BackendService. Network Endpoint - Groups are not supported for INTERNAL load balancing scheme. returned: success type: str maxConnections: @@ -130,7 +125,6 @@ items: with either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxConnectionsPerInstance: @@ -140,7 +134,6 @@ items: used in either CONNECTION or UTILIZATION balancing modes. - For CONNECTION mode, either maxConnections or maxConnectionsPerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxRate: @@ -149,7 +142,6 @@ items: - Can be used with either RATE or UTILIZATION balancing modes, but required if RATE mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: int maxRatePerInstance: @@ -158,14 +150,12 @@ items: This is used to calculate the capacity of the group. Can be used in either balancing mode. For RATE mode, either maxRate or maxRatePerInstance must be set. - - This cannot be used for internal load balancing. returned: success type: str maxUtilization: description: - Used when balancingMode is UTILIZATION. This ratio defines the CPU utilization target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - - This cannot be used for internal load balancing. returned: success type: str cdnPolicy: @@ -256,7 +246,6 @@ items: enableCDN: description: - If true, enable Cloud CDN for this BackendService. - - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: bool healthChecks: @@ -264,8 +253,6 @@ items: - The list of URLs to the HttpHealthCheck or HttpsHealthCheck resource for health checking this BackendService. Currently at most one health check can be specified, and a health check is required. - - For internal load balancing, a URL to a HealthCheck resource must be specified - instead. returned: success type: list id: @@ -303,7 +290,8 @@ items: description: - Indicates whether the backend service will be used with internal or external load balancing. A backend service created for one type of load balancing cannot - be used with the other. One of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. + be used with the other. Must be `EXTERNAL` for a global backend service. Defaults + to `EXTERNAL`. returned: success type: str name: @@ -320,15 +308,14 @@ items: description: - Name of backend port. The same name should appear in the instance groups referenced by this service. Required when the load balancing scheme is EXTERNAL. - - When the load balancing scheme is INTERNAL, this field is not used. returned: success type: str protocol: description: - The protocol this BackendService uses to communicate with backends. - - Possible values are HTTP, HTTPS, TCP, and SSL. The default is HTTP. - - For internal load balancing, the possible values are TCP and UDP, and the - default is TCP. + - 'Possible values are HTTP, HTTPS, HTTP2, TCP, and SSL. The default is HTTP. + **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer types and may + result in errors if used with the GA API.' returned: success type: str securityPolicy: @@ -340,8 +327,6 @@ items: description: - Type of session affinity to use. The default is NONE. - When the load balancing scheme is EXTERNAL, can be NONE, CLIENT_IP, or GENERATED_COOKIE. - - When the load balancing scheme is INTERNAL, can be NONE, CLIENT_IP, CLIENT_IP_PROTO, - or CLIENT_IP_PORT_PROTO. - When the protocol is UDP, this field is not used. returned: success type: str @@ -375,7 +360,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 7d727de17ae..18922351b76 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -65,8 +65,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -301,7 +301,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index 6c266d3d00f..073fa6bb99c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -60,8 +60,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -258,7 +258,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index 3df697b98d1..892581f6d08 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -66,8 +66,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -259,7 +259,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) 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 9344e8b7f7c..1f4f45d576e 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 @@ -60,8 +60,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -138,7 +138,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) 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 e4d3c302824..d5d74786f01 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 @@ -60,8 +60,8 @@ EXAMPLES = ''' ''' RETURN = ''' -items: - description: List of items +resources: + description: List of resources returned: always type: complex contains: @@ -189,7 +189,7 @@ def main(): items = items.get('items') else: items = [] - return_value = {'items': items} + return_value = {'resources': items} module.exit_json(**return_value) diff --git a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml index 98421640d30..b8a3f237e34 100644 --- a/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -49,7 +49,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - results['resources'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a dataset that already exists gcp_bigquery_dataset: @@ -93,7 +93,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a dataset that does not exist gcp_bigquery_dataset: diff --git a/test/integration/targets/gcp_bigquery_table/tasks/main.yml b/test/integration/targets/gcp_bigquery_table/tasks/main.yml index 3a1fda0ea5a..86c8282035d 100644 --- a/test/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/test/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -66,7 +66,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length >= 1 + - results['resources'] | length >= 1 # ---------------------------------------------------------------------------- - name: create a table that already exists gcp_bigquery_table: @@ -117,7 +117,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a table that does not exist gcp_bigquery_table: diff --git a/test/integration/targets/gcp_compute_address/tasks/main.yml b/test/integration/targets/gcp_compute_address/tasks/main.yml index 52b7c2357ef..0bffaf6e2f1 100644 --- a/test/integration/targets/gcp_compute_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_address/tasks/main.yml @@ -50,7 +50,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a address that already exists gcp_compute_address: @@ -95,7 +95,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a address that does not exist gcp_compute_address: diff --git a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index 1074135754f..fe5a58a334a 100644 --- a/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -61,7 +61,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a backend bucket that already exists gcp_compute_backend_bucket: @@ -109,7 +109,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a backend bucket that does not exist gcp_compute_backend_bucket: diff --git a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml index 3bdf590fdd7..aa5502b4c74 100644 --- a/test/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/test/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -78,7 +78,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a backend service that already exists gcp_compute_backend_service: @@ -130,7 +130,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a backend service that does not exist gcp_compute_backend_service: diff --git a/test/integration/targets/gcp_compute_disk/tasks/main.yml b/test/integration/targets/gcp_compute_disk/tasks/main.yml index fc9e4dd6a07..778b5e757cb 100644 --- a/test/integration/targets/gcp_compute_disk/tasks/main.yml +++ b/test/integration/targets/gcp_compute_disk/tasks/main.yml @@ -56,7 +56,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a disk that already exists gcp_compute_disk: @@ -107,7 +107,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a disk that does not exist gcp_compute_disk: diff --git a/test/integration/targets/gcp_compute_firewall/tasks/main.yml b/test/integration/targets/gcp_compute_firewall/tasks/main.yml index e88ffd7c6fd..6e3b4ef1627 100644 --- a/test/integration/targets/gcp_compute_firewall/tasks/main.yml +++ b/test/integration/targets/gcp_compute_firewall/tasks/main.yml @@ -65,7 +65,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a firewall that already exists gcp_compute_firewall: @@ -125,7 +125,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a firewall that does not exist gcp_compute_firewall: diff --git a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index 58f6da40113..565279ffccc 100644 --- a/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/test/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -76,7 +76,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a forwarding rule that already exists gcp_compute_forwarding_rule: @@ -129,7 +129,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a forwarding rule that does not exist gcp_compute_forwarding_rule: diff --git a/test/integration/targets/gcp_compute_global_address/tasks/main.yml b/test/integration/targets/gcp_compute_global_address/tasks/main.yml index 65940d4e181..fa633dcd00f 100644 --- a/test/integration/targets/gcp_compute_global_address/tasks/main.yml +++ b/test/integration/targets/gcp_compute_global_address/tasks/main.yml @@ -47,7 +47,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a global address that already exists gcp_compute_global_address: @@ -89,7 +89,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a global address that does not exist gcp_compute_global_address: 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 ca636248437..7fe60b9765b 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 @@ -115,7 +115,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a global forwarding rule that already exists gcp_compute_global_forwarding_rule: @@ -165,7 +165,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a global forwarding rule that does not exist 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 833a2288ebc..7202c9a6e6c 100644 --- a/test/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/test/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -63,7 +63,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 1 + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: create a health check that already exists gcp_compute_health_check: @@ -121,7 +121,7 @@ - name: verify that command succeeded assert: that: - - results['items'] | length == 0 + - results['resources'] | length == 0 # ---------------------------------------------------------------------------- - name: delete a health check that does not exist gcp_compute_health_check: