diff --git a/module_utils/decort_utils.py b/module_utils/decort_utils.py index b3cd0be..b920f35 100644 --- a/module_utils/decort_utils.py +++ b/module_utils/decort_utils.py @@ -335,7 +335,8 @@ class DecortController(object): return True - def decort_api_call(self, arg_req_function, arg_api_name, arg_params, arg_files=None): + def decort_api_call(self, arg_req_function, arg_api_name, arg_params, + arg_files=None, not_fail_codes: None | list = None): """Wrapper around DECORT API calls. It uses authorization mode and credentials validated at the class instance creation to properly format API call and send it to the DECORT controller URL. If connection errors are detected, it aborts execution of the script and relay error messages to upstream @@ -386,6 +387,8 @@ class DecortController(object): if api_resp.status_code == 200: return api_resp + elif not_fail_codes and api_resp.status_code in not_fail_codes: + return api_resp elif api_resp.status_code == 503: retry_timeout = 5 + 10 * (max_retries - retry_counter) time.sleep(retry_timeout)