mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-05 02:10:27 -07:00
This commit is contained in:
parent
56199b760a
commit
0e9c32fcde
2 changed files with 10 additions and 6 deletions
2
changelogs/gcp_pubsub_subscription_bugfix.yaml
Normal file
2
changelogs/gcp_pubsub_subscription_bugfix.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- gcp_pubsub_subscription - improper subscription uprade PATCH request
|
|
@ -634,8 +634,9 @@ def create(module, link):
|
|||
def update(module, link, fetch):
|
||||
auth = GcpSession(module, 'pubsub')
|
||||
params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))}
|
||||
request = resource_to_request(module)
|
||||
del request['name']
|
||||
subscription = resource_to_request(module)
|
||||
del subscription['name']
|
||||
request = { 'subscription': subscription }
|
||||
return return_if_object(module, auth.patch(link, request, params=params))
|
||||
|
||||
|
||||
|
@ -651,7 +652,7 @@ def updateMask(request, response):
|
|||
update_mask.append('messageRetentionDuration')
|
||||
if request.get('retainAckedMessages') != response.get('retainAckedMessages'):
|
||||
update_mask.append('retainAckedMessages')
|
||||
if request.get('expirationPolicy') != response.get('expirationPolicy'):
|
||||
if request.get('expirationPolicy') and request.get('expirationPolicy') != response.get('expirationPolicy'):
|
||||
update_mask.append('expirationPolicy')
|
||||
if request.get('deadLetterPolicy') != response.get('deadLetterPolicy'):
|
||||
update_mask.append('deadLetterPolicy')
|
||||
|
@ -664,7 +665,6 @@ def delete(module, link):
|
|||
auth = GcpSession(module, 'pubsub')
|
||||
return return_if_object(module, auth.delete(link))
|
||||
|
||||
|
||||
def resource_to_request(module):
|
||||
request = {
|
||||
u'name': name_pattern(module.params.get('name'), module),
|
||||
|
@ -838,7 +838,9 @@ class SubscriptionExpirationpolicy(object):
|
|||
self.request = {}
|
||||
|
||||
def to_request(self):
|
||||
return remove_nones_from_dict({u'ttl': self.request.get('ttl')})
|
||||
ttl = self.request.get('ttl')
|
||||
ttl = None if ttl == "" else ttl
|
||||
return remove_nones_from_dict({u'ttl': ttl})
|
||||
|
||||
def from_response(self):
|
||||
return remove_nones_from_dict({u'ttl': self.request.get(u'ttl')})
|
||||
|
|
Loading…
Add table
Reference in a new issue