fix: trailing whitespaces and updated documented min python req from 2.6 to 2.7

This commit is contained in:
Tze Liang 2023-07-11 01:42:31 +00:00
parent db55e4afb7
commit 8b88a27cdf

View file

@ -23,9 +23,9 @@ module: gcp_secretmanager_info.py
description: description:
- Gather info for GCP Secret Manager - Gather info for GCP Secret Manager
short_description: Gather info for GCP Secret Manager - List secrets and versions metadata. short_description: Gather info for GCP Secret Manager - List secrets and versions metadata.
author: Tze L. (https://github.com/tl-aiyor) author: Tze L. (https://gitlab.com/tze)
requirements: requirements:
- python >= 2.6 - python >= 2.7
- requests >= 2.18.4 - requests >= 2.18.4
- google-auth >= 1.3.0 - google-auth >= 1.3.0
options: options:
@ -141,9 +141,10 @@ resources:
type: str type: str
''' '''
def main(): def main():
module = GcpModule(argument_spec=dict( module = GcpModule(argument_spec=dict(
project=dict(default=os.environ['GCP_PROJECT'], type='str'))) project=dict(default=os.environ.get('GCP_PROJECT'), type='str')))
if not module.params['scopes']: if not module.params['scopes']:
module.params['scopes'] = [ module.params['scopes'] = [
@ -165,10 +166,12 @@ def main():
return_value = {'resources': results} return_value = {'resources': results}
module.exit_json(**return_value) module.exit_json(**return_value)
def get_secret_metadata(link, auth): def get_secret_metadata(link, auth):
response = auth.get(link) response = auth.get(link)
return response.json() return response.json()
def fetch_list(link, auth, array_name): def fetch_list(link, auth, array_name):
return auth.list(link, return_if_object, array_name=array_name) return auth.list(link, return_if_object, array_name=array_name)
@ -196,4 +199,3 @@ def return_if_object(module, response):
if __name__ == "__main__": if __name__ == "__main__":
main() main()