mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bug fixes for GCP modules (#51573)
This commit is contained in:
parent
2b0f16443c
commit
27c5e38e10
24 changed files with 42 additions and 53 deletions
|
@ -329,7 +329,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -371,7 +371,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -486,7 +486,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
region:
|
||||
|
|
|
@ -354,7 +354,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -481,7 +481,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -421,7 +421,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
region:
|
||||
|
|
|
@ -467,7 +467,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -376,7 +376,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -334,7 +334,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
region:
|
||||
|
|
|
@ -556,7 +556,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
extends_documentation_fragment: gcp
|
||||
|
|
|
@ -470,7 +470,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation', False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ requirements:
|
|||
options:
|
||||
filters:
|
||||
description:
|
||||
- A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).)
|
||||
- A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.)
|
||||
- Each additional filter in the list will act be added as an AND condition (filter1
|
||||
and filter2) .
|
||||
region:
|
||||
|
|
|
@ -49,7 +49,7 @@ options:
|
|||
default: present
|
||||
name:
|
||||
description:
|
||||
- The name of this cluster. The name must be unique within this project and zone,
|
||||
- The name of this cluster. The name must be unique within this project and location,
|
||||
and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens
|
||||
only. Must start with a letter. Must end with a number or a letter.
|
||||
required: false
|
||||
|
@ -254,13 +254,11 @@ options:
|
|||
required: false
|
||||
location:
|
||||
description:
|
||||
- The list of Google Compute Engine locations in which the cluster's nodes should
|
||||
be located.
|
||||
required: false
|
||||
zone:
|
||||
description:
|
||||
- The zone where the cluster is deployed.
|
||||
- The location where the cluster is deployed.
|
||||
required: true
|
||||
aliases:
|
||||
- zone
|
||||
version_added: 2.8
|
||||
extends_documentation_fragment: gcp
|
||||
'''
|
||||
|
||||
|
@ -275,7 +273,7 @@ EXAMPLES = '''
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "test_project"
|
||||
auth_kind: "serviceaccount"
|
||||
service_account_file: "/tmp/auth.pem"
|
||||
|
@ -285,7 +283,7 @@ EXAMPLES = '''
|
|||
RETURN = '''
|
||||
name:
|
||||
description:
|
||||
- The name of this cluster. The name must be unique within this project and zone,
|
||||
- The name of this cluster. The name must be unique within this project and location,
|
||||
and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens
|
||||
only. Must start with a letter. Must end with a number or a letter.
|
||||
returned: success
|
||||
|
@ -508,12 +506,6 @@ subnetwork:
|
|||
- The name of the Google Compute Engine subnetwork to which the cluster is connected.
|
||||
returned: success
|
||||
type: str
|
||||
location:
|
||||
description:
|
||||
- The list of Google Compute Engine locations in which the cluster's nodes should
|
||||
be located.
|
||||
returned: success
|
||||
type: list
|
||||
endpoint:
|
||||
description:
|
||||
- The IP address of this cluster's master endpoint.
|
||||
|
@ -567,9 +559,9 @@ expireTime:
|
|||
- The time the cluster will be automatically deleted in RFC3339 text format.
|
||||
returned: success
|
||||
type: str
|
||||
zone:
|
||||
location:
|
||||
description:
|
||||
- The zone where the cluster is deployed.
|
||||
- The location where the cluster is deployed.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
@ -633,8 +625,7 @@ def main():
|
|||
),
|
||||
),
|
||||
subnetwork=dict(type='str'),
|
||||
location=dict(type='list', elements='str'),
|
||||
zone=dict(required=True, type='str'),
|
||||
location=dict(required=True, type='str', aliases=['zone']),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -696,7 +687,6 @@ def resource_to_request(module):
|
|||
u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'),
|
||||
u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(),
|
||||
u'subnetwork': module.params.get('subnetwork'),
|
||||
u'location': module.params.get('location'),
|
||||
}
|
||||
request = encode_request(request, module)
|
||||
return_vals = {}
|
||||
|
@ -713,11 +703,11 @@ def fetch_resource(module, link, allow_not_found=True):
|
|||
|
||||
|
||||
def self_link(module):
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{name}".format(**module.params)
|
||||
return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{name}".format(**module.params)
|
||||
|
||||
|
||||
def collection(module):
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params)
|
||||
return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters".format(**module.params)
|
||||
|
||||
|
||||
def return_if_object(module, response, allow_not_found=False):
|
||||
|
@ -774,7 +764,6 @@ def response_to_hash(module, response):
|
|||
u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'),
|
||||
u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(),
|
||||
u'subnetwork': response.get(u'subnetwork'),
|
||||
u'location': response.get(u'location'),
|
||||
u'endpoint': response.get(u'endpoint'),
|
||||
u'initialClusterVersion': response.get(u'initialClusterVersion'),
|
||||
u'currentMasterVersion': response.get(u'currentMasterVersion'),
|
||||
|
@ -811,7 +800,7 @@ def wait_for_completion(status, op_result, module):
|
|||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri)
|
||||
op_result = fetch_resource(module, op_uri, False)
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
return op_result
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -39,7 +39,7 @@
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -51,7 +51,7 @@
|
|||
- result.changed == true
|
||||
- name: verify that cluster was created
|
||||
gcp_container_cluster_facts:
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -73,7 +73,7 @@
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -94,7 +94,7 @@
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -106,7 +106,7 @@
|
|||
- result.changed == true
|
||||
- name: verify that cluster was deleted
|
||||
gcp_container_cluster_facts:
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -128,7 +128,7 @@
|
|||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
|
Loading…
Reference in a new issue