Bug fixes for GCP modules (#61251)

pull/61337/head
The Magician 5 years ago committed by ansibot
parent 8ee7d9f598
commit 1631554c1b

@ -99,7 +99,7 @@ EXAMPLES = '''
gcp_sql_database:
name: test_object
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"

@ -53,7 +53,7 @@ extends_documentation_fragment: gcp
EXAMPLES = '''
- name: get info on a database
gcp_sql_database_info:
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"

@ -120,7 +120,7 @@ EXAMPLES = '''
- name: create a bucket access control
gcp_storage_bucket_access_control:
bucket: test_object
bucket: "{{ bucket }}"
entity: user-alexstephen@google.com
role: WRITER
project: test_project
@ -220,10 +220,7 @@ def main():
state = module.params['state']
kind = 'storage#bucketAccessControl'
if module.params['id']:
fetch = fetch_resource(module, self_link(module), kind)
else:
fetch = {}
changed = False
if fetch:
@ -286,11 +283,13 @@ def fetch_resource(module, link, kind, allow_not_found=True):
def self_link(module):
return "https://www.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**module.params)
res = {'bucket': replace_resource_dict(module.params['bucket'], 'name'), 'entity': module.params['entity']}
return "https://www.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**res)
def collection(module):
return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**module.params)
res = {'bucket': replace_resource_dict(module.params['bucket'], 'name')}
return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**res)
def return_if_object(module, response, kind, allow_not_found=False):

@ -32,7 +32,7 @@
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -42,7 +42,7 @@
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -54,7 +54,7 @@
- result.changed == true
- name: verify that database was created
gcp_sql_database_info:
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -70,7 +70,7 @@
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -85,7 +85,7 @@
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -97,7 +97,7 @@
- result.changed == true
- name: verify that database was deleted
gcp_sql_database_info:
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
@ -113,7 +113,7 @@
gcp_sql_database:
name: "{{ resource_name }}"
charset: utf8
instance: "{{ instance }}"
instance: "{{ instance.name }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"

@ -23,7 +23,7 @@
register: bucket
- name: delete a bucket access control
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
bucket: "{{ bucket }}"
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: "{{ resource_name }}"
bucket: "{{ bucket }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
@ -48,7 +48,7 @@
# ----------------------------------------------------------------------------
- name: create a bucket access control that already exists
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
bucket: "{{ bucket }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
@ -63,7 +63,7 @@
#----------------------------------------------------------
- name: delete a bucket access control
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
bucket: "{{ bucket }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"
@ -78,7 +78,7 @@
# ----------------------------------------------------------------------------
- name: delete a bucket access control that does not exist
gcp_storage_bucket_access_control:
bucket: "{{ resource_name }}"
bucket: "{{ bucket }}"
entity: user-alexstephen@google.com
role: WRITER
project: "{{ gcp_project }}"

Loading…
Cancel
Save