added extra debug when post fails with 400

This commit is contained in:
mischa 2022-06-21 12:24:59 +02:00
parent 545129c8a5
commit 6d353317f0
1 changed files with 8 additions and 3 deletions

11
push.py
View File

@ -90,18 +90,21 @@ url_exceptions = {
"ftntfw": "ftnt-fw-", "ftntfw": "ftnt-fw-",
"chkpfw": "chkp-fw-", "chkpfw": "chkp-fw-",
"ocivcnconnectors": "oci-vcn-connectors", "ocivcnconnectors": "oci-vcn-connectors",
"ftntfwservices": "ftnt-fw-services" "ftntfwservices": "ftnt-fw-services",
"chkpfwservices": "chkp-fw-services"
} }
# URL Exceptions creating credentials # URL Exceptions creating credentials
service_credentials = { service_credentials = {
"panfwservices": "pan", "panfwservices": "pan",
"ftntfwservices": "ftntfw" "ftntfwservices": "ftntfw",
"chkpfwservices": "chkp-fw"
} }
# URL Exceptions creating instance credentials # URL Exceptions creating instance credentials
service_instance_credentials = { service_instance_credentials = {
"ftntfwservices": "ftntfw-" "ftntfwservices": "ftntfw-",
"chkpfwservices": "chkp-fw-"
} }
# Credential Types # Credential Types
@ -123,6 +126,8 @@ def alkira_post(session, uri, body):
url = f'{ALKIRA_BASE_URI}{uri}' url = f'{ALKIRA_BASE_URI}{uri}'
try: try:
response = session.post(url, data=json.dumps(body), headers=headers) response = session.post(url, data=json.dumps(body), headers=headers)
if response.status_code == 400:
logging.debug(response.content)
response.raise_for_status() response.raise_for_status()
except Exception as e: except Exception as e:
logging.error(f'Error: {str(e)}') logging.error(f'Error: {str(e)}')