Bug fixes for GCP modules (#58016)

This commit is contained in:
The Magician 2019-06-18 12:45:48 -07:00 committed by ansibot
parent 158f97bfb2
commit a1128b6b94
8 changed files with 15 additions and 15 deletions

View file

@ -1174,7 +1174,7 @@ def response_to_hash(module, response):
def async_op_url(module, extra_data=None): def async_op_url(module, extra_data=None):
if extra_data is None: if extra_data is None:
extra_data = {} extra_data = {}
url = "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/operations/{op_id}" url = "https://container.googleapis.com/v1/projects/{project}/locations/{location}/operations/{op_id}"
combined = extra_data.copy() combined = extra_data.copy()
combined.update(module.params) combined.update(module.params)
return url.format(**combined) return url.format(**combined)

View file

@ -705,12 +705,12 @@ def self_link(module):
'cluster': replace_resource_dict(module.params['cluster'], 'name'), 'cluster': replace_resource_dict(module.params['cluster'], 'name'),
'name': module.params['name'], 'name': module.params['name'],
} }
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools/{name}".format(**res) return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{name}".format(**res)
def collection(module): def collection(module):
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} 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) return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{cluster}/nodePools".format(**res)
def return_if_object(module, response, allow_not_found=False): def return_if_object(module, response, allow_not_found=False):
@ -773,7 +773,7 @@ def response_to_hash(module, response):
def async_op_url(module, extra_data=None): def async_op_url(module, extra_data=None):
if extra_data is None: if extra_data is None:
extra_data = {} extra_data = {}
url = "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/operations/{op_id}" url = "https://container.googleapis.com/v1/projects/{project}/locations/{location}/operations/{op_id}"
combined = extra_data.copy() combined = extra_data.copy()
combined.update(module.params) combined.update(module.params)
return url.format(**combined) return url.format(**combined)

View file

@ -376,7 +376,7 @@ def main():
def collection(module): def collection(module):
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')} 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) return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{cluster}/nodePools".format(**res)
def fetch_list(module, link): def fetch_list(module, link):

View file

@ -61,7 +61,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'my-cluster' in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a cluster that already exists - name: create a cluster that already exists
gcp_container_cluster: gcp_container_cluster:
@ -116,7 +116,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'my-cluster' not in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a cluster that does not exist - name: delete a cluster that does not exist
gcp_container_cluster: gcp_container_cluster:

View file

@ -62,7 +62,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'my-pool' in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a node pool that already exists - name: create a node pool that already exists
gcp_container_node_pool: gcp_container_node_pool:
@ -108,7 +108,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'my-pool' not in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a node pool that does not exist - name: delete a node pool that does not exist
gcp_container_node_pool: gcp_container_node_pool:

View file

@ -68,7 +68,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'www.testzone-4.com.'in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a resource record set that already exists - name: create a resource record set that already exists
gcp_dns_resource_record_set: gcp_dns_resource_record_set:
@ -121,7 +121,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'www.testzone-4.com.'not in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a resource record set that does not exist - name: delete a resource record set that does not exist
gcp_dns_resource_record_set: gcp_dns_resource_record_set:

View file

@ -56,7 +56,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "\"{{resource_name}}\" in \"{{ results['items'] | map(attribute='name') | list }}\"" - "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a subscription that already exists - name: create a subscription that already exists
gcp_pubsub_subscription: gcp_pubsub_subscription:
@ -98,7 +98,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "\"{{resource_name}}\" not in \"{{ results['items'] | map(attribute='name') | list }}\"" - "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a subscription that does not exist - name: delete a subscription that does not exist
gcp_pubsub_subscription: gcp_pubsub_subscription:

View file

@ -44,7 +44,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'test-topic1' in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'test-topic1' in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: create a topic that already exists - name: create a topic that already exists
gcp_pubsub_topic: gcp_pubsub_topic:
@ -82,7 +82,7 @@
- name: verify that command succeeded - name: verify that command succeeded
assert: assert:
that: that:
- "'test-topic1' not in \"{{ results['items'] | map(attribute='name') | list }}\"" - "'test-topic1' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
- name: delete a topic that does not exist - name: delete a topic that does not exist
gcp_pubsub_topic: gcp_pubsub_topic: