Bug fixes for GCP modules (#54765)

This commit is contained in:
The Magician 2019-04-03 10:31:08 -07:00 committed by ansibot
parent 688409128a
commit 9908b2fbf6
9 changed files with 55 additions and 53 deletions

View file

@ -62,16 +62,9 @@ def replace_resource_dict(item, value):
else:
if not item:
return item
if isinstance(item, dict):
else:
return item.get(value)
# Item could be a string or a string representing a dictionary.
try:
new_item = ast.literal_eval(item)
return replace_resource_dict(new_item, value)
except ValueError:
return item
# Handles all authentication and HTTP sessions for GCP API calls.
class GcpSession(object):

View file

@ -63,9 +63,10 @@ options:
description:
- The instance to create the database on.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
notes:
@ -117,7 +118,7 @@ instance:
description:
- The instance to create the database on.
returned: success
type: str
type: dict
'''
################################################################################
@ -140,7 +141,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str'),
extra_statements=dict(type='list', elements='str'),
instance=dict(required=True),
instance=dict(required=True, type='dict'),
)
)

View file

@ -44,9 +44,10 @@ options:
description:
- The instance to create the database on.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_spanner_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_spanner_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
'''
@ -85,7 +86,7 @@ items:
description:
- The instance to create the database on.
returned: success
type: str
type: dict
'''
################################################################################
@ -100,7 +101,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(instance=dict(required=True)))
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']

View file

@ -64,9 +64,10 @@ options:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
'''
@ -120,7 +121,7 @@ instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
type: dict
'''
################################################################################
@ -145,7 +146,7 @@ def main():
charset=dict(type='str'),
collation=dict(type='str'),
name=dict(type='str'),
instance=dict(required=True),
instance=dict(required=True, type='dict'),
)
)

View file

@ -44,9 +44,10 @@ options:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
'''
@ -87,7 +88,7 @@ items:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
type: dict
'''
################################################################################
@ -102,7 +103,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(instance=dict(required=True)))
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']

View file

@ -61,9 +61,10 @@ options:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
password:
description:
@ -118,7 +119,7 @@ instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
type: dict
password:
description:
- The password for the user.
@ -147,7 +148,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'),
host=dict(required=True, type='str'),
name=dict(required=True, type='str'),
instance=dict(required=True),
instance=dict(required=True, type='dict'),
password=dict(type='str'),
)
)

View file

@ -44,9 +44,10 @@ options:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
}}"'
required: true
extends_documentation_fragment: gcp
'''
@ -83,7 +84,7 @@ items:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
type: dict
password:
description:
- The password for the user.
@ -103,7 +104,7 @@ import json
def main():
module = GcpModule(argument_spec=dict(instance=dict(required=True)))
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']

View file

@ -61,9 +61,10 @@ options:
description:
- The name of the bucket.
- 'This field represents a link to a Bucket resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value
of your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"'
required: true
entity:
description:
@ -140,9 +141,10 @@ options:
description:
- The name of the bucket.
- 'This field represents a link to a Bucket resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a
string Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value
of your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"'
required: true
entity:
description:
@ -359,7 +361,7 @@ acl:
description:
- The name of the bucket.
returned: success
type: str
type: dict
domain:
description:
- The domain associated with the entity.
@ -453,7 +455,7 @@ defaultObjectAcl:
description:
- The name of the bucket.
returned: success
type: str
type: dict
domain:
description:
- The domain associated with the entity.
@ -740,7 +742,7 @@ def main():
type='list',
elements='dict',
options=dict(
bucket=dict(required=True),
bucket=dict(required=True, type='dict'),
entity=dict(required=True, type='str'),
entity_id=dict(type='str'),
project_team=dict(
@ -763,7 +765,7 @@ def main():
type='list',
elements='dict',
options=dict(
bucket=dict(required=True),
bucket=dict(required=True, type='dict'),
entity=dict(required=True, type='str'),
object=dict(type='str'),
role=dict(required=True, type='str', choices=['OWNER', 'READER']),

View file

@ -60,9 +60,10 @@ options:
description:
- The name of the bucket.
- 'This field represents a link to a Bucket resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket
task and then set this bucket field to "{{ name-of-resource }}"'
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource
}}"'
required: true
entity:
description:
@ -131,7 +132,7 @@ bucket:
description:
- The name of the bucket.
returned: success
type: str
type: dict
domain:
description:
- The domain associated with the entity.
@ -203,7 +204,7 @@ def main():
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
bucket=dict(required=True),
bucket=dict(required=True, type='dict'),
entity=dict(required=True, type='str'),
entity_id=dict(type='str'),
project_team=dict(type='dict', options=dict(project_number=dict(type='str'), team=dict(type='str', choices=['editors', 'owners', 'viewers']))),