mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-19 14:50:21 -07:00
* Fix linting errors.
* Fix bugs.
* Another linter error ignored.
* More fixes.
* Ignore sanity errors with older versions.
ci_complete
* Forgot to commit more changes.
(cherry picked from commit a54af8909c
)
This commit is contained in:
parent
54bf6ef6de
commit
e4eead189b
52 changed files with 115 additions and 94 deletions
|
@ -233,10 +233,11 @@ import json
|
|||
try:
|
||||
from requests import Request, Session
|
||||
except ImportError:
|
||||
HAS_ANOTHER_LIBRARY = False
|
||||
ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc()
|
||||
HAS_REQUESTS = False
|
||||
REQUESTS_IMPORT_ERROR = traceback.format_exc()
|
||||
else:
|
||||
HAS_ANOTHER_LIBRARY = True
|
||||
HAS_REQUESTS = True
|
||||
REQUESTS_IMPORT_ERROR = None
|
||||
|
||||
|
||||
def build_url(account, key, is_sandbox):
|
||||
|
@ -261,7 +262,7 @@ def iterate_data(module, request_object):
|
|||
request_object.url = base_url + '&page=' + str(page)
|
||||
new_results = Session().send(request_object)
|
||||
data = data + new_results.json()["data"]
|
||||
return(data)
|
||||
return data
|
||||
else:
|
||||
module.fail_json('API Call failed, check ID, key and sandbox values')
|
||||
|
||||
|
@ -305,11 +306,10 @@ def main():
|
|||
params['api_key'],
|
||||
params['sandbox'])
|
||||
|
||||
if not HAS_ANOTHER_LIBRARY:
|
||||
# Needs: from ansible.module_utils.basic import missing_required_lib
|
||||
if not HAS_REQUESTS:
|
||||
module.exit_json(
|
||||
msg=missing_required_lib('another_library'),
|
||||
exception=ANOTHER_LIBRARY_IMPORT_ERROR)
|
||||
msg=missing_required_lib('requests'),
|
||||
exception=REQUESTS_IMPORT_ERROR)
|
||||
|
||||
# At minimum we need account and key
|
||||
if params['account_id'] and params['api_key']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue