Bug fixes for GCP modules (#65445)

This commit is contained in:
The Magician 2020-01-03 12:36:10 -08:00 committed by ansibot
parent 5bc11caa92
commit d37f00df9b
3 changed files with 15 additions and 7 deletions

View file

@ -89,7 +89,7 @@ options:
type: str
name:
description:
- The ID of the instance or a fully qualified identifier for the instance. .
- The ID of the instance or a fully qualified identifier for the instance.
required: true
type: str
memory_size_gb:
@ -267,7 +267,7 @@ locationId:
type: str
name:
description:
- The ID of the instance or a fully qualified identifier for the instance. .
- The ID of the instance or a fully qualified identifier for the instance.
returned: success
type: str
memorySizeGb:

View file

@ -172,7 +172,7 @@ resources:
type: str
name:
description:
- The ID of the instance or a fully qualified identifier for the instance. .
- The ID of the instance or a fully qualified identifier for the instance.
returned: success
type: str
memorySizeGb:

View file

@ -166,7 +166,7 @@ def main():
if fetch:
if state == 'present':
if is_different(module, fetch):
update(module, self_link(module))
update(module, self_link(module), fetch)
fetch = fetch_resource(module, self_link(module))
changed = True
else:
@ -190,9 +190,17 @@ def create(module, link):
return return_if_object(module, auth.post(link, resource_to_request(module)))
def update(module, link):
delete(module, self_link(module))
create(module, collection(module))
def update(module, link, fetch):
auth = GcpSession(module, 'sourcerepo')
params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))}
request = resource_to_request(module)
del request['name']
return return_if_object(module, auth.patch(link, request, params=params))
def updateMask(request, response):
update_mask = []
return ','.join(update_mask)
def delete(module, link):