mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
Bug fixes for GCP modules (#51574)
This commit is contained in:
parent
6a79468acf
commit
2b0f16443c
10 changed files with 69 additions and 62 deletions
|
@ -207,10 +207,14 @@ options:
|
|||
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
|
||||
task and then set this cluster field to "{{ name-of-resource }}"'
|
||||
required: true
|
||||
zone:
|
||||
location:
|
||||
description:
|
||||
- The zone where the node pool is deployed.
|
||||
- The location where the node pool is deployed.
|
||||
required: true
|
||||
aliases:
|
||||
- region
|
||||
- zone
|
||||
version_added: 2.8
|
||||
extends_documentation_fragment: gcp
|
||||
'''
|
||||
|
||||
|
@ -219,7 +223,7 @@ EXAMPLES = '''
|
|||
gcp_container_cluster:
|
||||
name: "cluster-nodepool"
|
||||
initial_node_count: 4
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
|
@ -231,7 +235,7 @@ EXAMPLES = '''
|
|||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
zone: us-central1-a
|
||||
location: us-central1-a
|
||||
project: "test_project"
|
||||
auth_kind: "serviceaccount"
|
||||
service_account_file: "/tmp/auth.pem"
|
||||
|
@ -415,9 +419,9 @@ cluster:
|
|||
- The cluster this node pool belongs to.
|
||||
returned: success
|
||||
type: str
|
||||
zone:
|
||||
location:
|
||||
description:
|
||||
- The zone where the node pool is deployed.
|
||||
- The location where the node pool is deployed.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
@ -468,7 +472,7 @@ def main():
|
|||
),
|
||||
),
|
||||
cluster=dict(required=True),
|
||||
zone=dict(required=True, type='str'),
|
||||
location=dict(required=True, type='str', aliases=['region', 'zone']),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -542,16 +546,16 @@ def fetch_resource(module, link, allow_not_found=True):
|
|||
def self_link(module):
|
||||
res = {
|
||||
'project': module.params['project'],
|
||||
'zone': module.params['zone'],
|
||||
'location': module.params['location'],
|
||||
'cluster': replace_resource_dict(module.params['cluster'], 'name'),
|
||||
'name': module.params['name'],
|
||||
}
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools/{name}".format(**res)
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools/{name}".format(**res)
|
||||
|
||||
|
||||
def collection(module):
|
||||
res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res)
|
||||
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res)
|
||||
|
||||
|
||||
def return_if_object(module, response, allow_not_found=False):
|
||||
|
@ -630,7 +634,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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue