Bug fixes for GCP modules (#60723)

pull/60723/merge
The Magician 5 years ago committed by ansibot
parent 2f033b6169
commit 73623c0029

@ -111,12 +111,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/iam']
items = fetch_list(module, collection(module))
if items.get('accounts'):
items = items.get('accounts')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -126,8 +121,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'iam')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='accounts')
def return_if_object(module, response):

@ -120,12 +120,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
items = fetch_list(module, collection(module))
if items.get('models'):
items = items.get('models')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -135,8 +130,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'mlengine')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='models')
def return_if_object(module, response):

@ -211,12 +211,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
items = fetch_list(module, collection(module))
if items.get('versions'):
items = items.get('versions')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -227,8 +222,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'mlengine')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='versions')
def return_if_object(module, response):

@ -190,12 +190,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']
items = fetch_list(module, collection(module))
if items.get('subscriptions'):
items = items.get('subscriptions')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -205,8 +200,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'pubsub')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='subscriptions')
def return_if_object(module, response):

@ -117,12 +117,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/pubsub']
items = fetch_list(module, collection(module))
if items.get('topics'):
items = items.get('topics')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -132,8 +127,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'pubsub')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='topics')
def return_if_object(module, response):

@ -188,12 +188,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
items = fetch_list(module, collection(module))
if items.get('instances'):
items = items.get('instances')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -203,8 +198,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'redis')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='instances')
def return_if_object(module, response):

@ -138,12 +138,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
items = fetch_list(module, collection(module))
if items.get('projects'):
items = items.get('projects')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -153,8 +148,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'resourcemanager')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='projects')
def return_if_object(module, response):

@ -98,12 +98,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
items = fetch_list(module, collection(module))
if items.get('repos'):
items = items.get('repos')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -113,8 +108,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'sourcerepo')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='repos')
def return_if_object(module, response):

@ -111,12 +111,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
items = fetch_list(module, collection(module))
if items.get('databases'):
items = items.get('databases')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -127,8 +122,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'spanner')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='databases')
def return_if_object(module, response):

@ -114,12 +114,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/spanner.admin']
items = fetch_list(module, collection(module))
if items.get('instances'):
items = items.get('instances')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -129,8 +124,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'spanner')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='instances')
def return_if_object(module, response):

@ -108,12 +108,7 @@ def main():
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
items = fetch_list(module, collection(module))
if items.get('items'):
items = items.get('items')
else:
items = []
return_value = {'resources': items}
return_value = {'resources': fetch_list(module, collection(module))}
module.exit_json(**return_value)
@ -123,8 +118,7 @@ def collection(module):
def fetch_list(module, link):
auth = GcpSession(module, 'sql')
response = auth.get(link)
return return_if_object(module, response)
return auth.list(link, return_if_object, array_name='items')
def return_if_object(module, response):

Loading…
Cancel
Save