mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 10:51:24 -07:00
Fix dangerous default args. (#29839)
This commit is contained in:
parent
5caa47feb9
commit
68aeaa58a8
50 changed files with 253 additions and 87 deletions
|
@ -295,7 +295,7 @@ def gcp_connect(module, provider, get_driver, user_agent_product, user_agent_ver
|
|||
return gcp
|
||||
|
||||
|
||||
def get_google_cloud_credentials(module, scopes=[]):
|
||||
def get_google_cloud_credentials(module, scopes=None):
|
||||
"""
|
||||
Get credentials object for use with Google Cloud client.
|
||||
|
||||
|
@ -324,6 +324,8 @@ def get_google_cloud_credentials(module, scopes=[]):
|
|||
params dict {'service_account_email': '...', 'credentials_file': '...', 'project_id': ...}
|
||||
:rtype: ``tuple``
|
||||
"""
|
||||
scopes = [] if scopes is None else scopes
|
||||
|
||||
if not HAS_GOOGLE_AUTH:
|
||||
module.fail_json(msg='Please install google-auth.')
|
||||
|
||||
|
@ -348,7 +350,7 @@ def get_google_cloud_credentials(module, scopes=[]):
|
|||
return (None, None)
|
||||
|
||||
|
||||
def get_google_api_auth(module, scopes=[], user_agent_product='ansible-python-api', user_agent_version='NA'):
|
||||
def get_google_api_auth(module, scopes=None, user_agent_product='ansible-python-api', user_agent_version='NA'):
|
||||
"""
|
||||
Authentication for use with google-python-api-client.
|
||||
|
||||
|
@ -384,6 +386,8 @@ def get_google_api_auth(module, scopes=[], user_agent_product='ansible-python-ap
|
|||
params dict {'service_account_email': '...', 'credentials_file': '...', 'project_id': ...}
|
||||
:rtype: ``tuple``
|
||||
"""
|
||||
scopes = [] if scopes is None else scopes
|
||||
|
||||
if not HAS_GOOGLE_API_LIB:
|
||||
module.fail_json(msg="Please install google-api-python-client library")
|
||||
if not scopes:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue