diff --git a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py index 4bcee8b3d50..3e0d482a9db 100644 --- a/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py +++ b/lib/ansible/modules/cloud/google/gcp_sourcerepo_repository.py @@ -153,7 +153,7 @@ def delete(module, link): def resource_to_request(module): - request = {u'name': name_partial_to_full(module.params.get('name'), module.params)} + request = {u'name': name_pattern(module.params.get('name'), module)} return_vals = {} for k, v in request.items(): if v or v is False: @@ -217,17 +217,17 @@ def is_different(module, response): # Remove unnecessary properties from the response. # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): - return {u'name': name_partial_to_full(module.params.get('name'), module.params), u'url': response.get(u'url'), u'size': response.get(u'size')} + return {u'name': name_pattern(module.params.get('name'), module), u'url': response.get(u'url'), u'size': response.get(u'size')} -def name_partial_to_full(name, params): +def name_pattern(name, module): if name is None: return - url = r"projects/.*/repos/.*" + regex = r"projects/.*/repos/.*" - if not re.match(url, name): - name = "projects/{project}/repos/{name}".format(**params) + if not re.match(regex, name): + name = "projects/{project}/repos/{name}".format(**module.params) return name diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index 6c9f732e2e1..9b300adc689 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -97,7 +97,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that database was deleted gcp_sql_database_facts: instance: "{{ instance }}" @@ -126,7 +125,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index 0bee3e3c82b..96aa398a45f 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance was deleted gcp_sql_instance_facts: project: "{{ gcp_project }}" @@ -134,4 +133,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index ec342de0a6c..78e10059910 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that user was deleted gcp_sql_user_facts: instance: "{{ instance }}" @@ -131,7 +130,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/test/integration/targets/gcp_storage_bucket/tasks/main.yml b/test/integration/targets/gcp_storage_bucket/tasks/main.yml index 1f3fe22aa4d..dcf45d5569b 100644 --- a/test/integration/targets/gcp_storage_bucket/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket/tasks/main.yml @@ -61,7 +61,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False # ---------------------------------------------------------------------------- - name: delete a bucket that does not exist gcp_storage_bucket: @@ -75,4 +74,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 52c63b638a6..c37b4397c72 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -77,7 +77,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: @@ -93,7 +92,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook!