From 6a79468acfeacff20743b26b966c8ff4df47de41 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Thu, 31 Jan 2019 14:02:56 -0800 Subject: [PATCH] Bug fixes for GCP modules (#51576) --- lib/ansible/modules/cloud/google/gcp_sql_instance.py | 2 +- lib/ansible/modules/cloud/google/gcp_sql_user.py | 2 +- lib/ansible/modules/cloud/google/gcp_storage_bucket.py | 2 +- .../cloud/google/gcp_storage_bucket_access_control.py | 2 +- .../gcp_storage_bucket_access_control/tasks/main.yml | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 67fd0dff78..470cc21ed9 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -789,7 +789,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, 'sql#operation') + op_result = fetch_resource(module, op_uri, 'sql#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index e782613888..e1d6d94049 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -335,7 +335,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, 'sql#operation') + op_result = fetch_resource(module, op_uri, 'sql#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py index 717a309b92..691b216100 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket.py @@ -1281,7 +1281,7 @@ class BucketCondition(object): def from_response(self): return remove_nones_from_dict( { - u'age': self.request.get(u'ageDays'), + u'age': self.request.get(u'age'), u'createdBefore': self.request.get(u'createdBefore'), u'isLive': self.request.get(u'isLive'), u'matchesStorageClass': self.request.get(u'matchesStorageClass'), diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index fd87e8fc4e..f0507f8be8 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -117,7 +117,7 @@ EXAMPLES = ''' - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "test_object" entity: user-alexstephen@google.com role: WRITER project: "test_project" 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 c4a28f0c85..f71247cc6a 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 @@ -23,7 +23,7 @@ register: bucket - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -33,7 +33,7 @@ #---------------------------------------------------------- - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -49,7 +49,7 @@ # ---------------------------------------------------------------------------- - name: create a bucket access control that already exists gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -65,7 +65,7 @@ #---------------------------------------------------------- - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -81,7 +81,7 @@ # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: - bucket: "{{ bucket }}" + bucket: "{{ resource_name }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}"