mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-26 22:51:30 -07:00
Bug fixes for GCP modules (as of 2019-01-22T12:43:52-08:00) (#51245)
This commit is contained in:
parent
a81d110422
commit
6c246c99d6
24 changed files with 660 additions and 869 deletions
|
@ -18,15 +18,14 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
################################################################################
|
||||
# Documentation
|
||||
################################################################################
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ["preview"],
|
||||
'supported_by': 'community'}
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
|
@ -269,7 +268,7 @@ def main():
|
|||
next_hop_gateway=dict(type='str'),
|
||||
next_hop_instance=dict(),
|
||||
next_hop_ip=dict(type='str'),
|
||||
next_hop_vpn_tunnel=dict()
|
||||
next_hop_vpn_tunnel=dict(),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -330,7 +329,7 @@ def resource_to_request(module):
|
|||
u'nextHopGateway': module.params.get('next_hop_gateway'),
|
||||
u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'),
|
||||
u'nextHopIp': module.params.get('next_hop_ip'),
|
||||
u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink')
|
||||
u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'),
|
||||
}
|
||||
return_vals = {}
|
||||
for k, v in request.items():
|
||||
|
@ -365,8 +364,8 @@ def return_if_object(module, response, kind, allow_not_found=False):
|
|||
try:
|
||||
module.raise_for_status(response)
|
||||
result = response.json()
|
||||
except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst:
|
||||
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
|
||||
except getattr(json.decoder, 'JSONDecodeError', ValueError):
|
||||
module.fail_json(msg="Invalid JSON response with error: %s" % response.text)
|
||||
|
||||
if navigate_hash(result, ['error', 'errors']):
|
||||
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
|
||||
|
@ -406,7 +405,7 @@ def response_to_hash(module, response):
|
|||
u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'),
|
||||
u'nextHopIp': module.params.get('next_hop_ip'),
|
||||
u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'),
|
||||
u'nextHopNetwork': response.get(u'nextHopNetwork')
|
||||
u'nextHopNetwork': response.get(u'nextHopNetwork'),
|
||||
}
|
||||
|
||||
|
||||
|
@ -432,7 +431,7 @@ def wait_for_completion(status, op_result, module):
|
|||
op_id = navigate_hash(op_result, ['name'])
|
||||
op_uri = async_op_url(module, {'op_id': op_id})
|
||||
while status != 'DONE':
|
||||
raise_if_errors(op_result, ['error', 'errors'], 'message')
|
||||
raise_if_errors(op_result, ['error', 'errors'], module)
|
||||
time.sleep(1.0)
|
||||
op_result = fetch_resource(module, op_uri, 'compute#operation')
|
||||
status = navigate_hash(op_result, ['status'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue