diff options
Diffstat (limited to 'miss_htbt_service/mod/trapd_get_cbs_config.py')
-rw-r--r-- | miss_htbt_service/mod/trapd_get_cbs_config.py | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/miss_htbt_service/mod/trapd_get_cbs_config.py b/miss_htbt_service/mod/trapd_get_cbs_config.py index 70dac53..f9fd4c3 100644 --- a/miss_htbt_service/mod/trapd_get_cbs_config.py +++ b/miss_htbt_service/mod/trapd_get_cbs_config.py @@ -1,10 +1,8 @@ # ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ # Copyright (c) 2018-2021 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. -# Copyright 2020 Deutsche Telekom. All rights reserved. -# Copyright 2021 Samsung Electronics. All rights reserved. +# Copyright (c) 2020 Deutsche Telekom. All rights reserved. +# Copyright (c) 2021 Samsung Electronics. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +23,7 @@ env variable that specifies JSON equiv of CBS config (typically used for testing purposes) """ -__docformat__ = 'restructuredtext' +__docformat__ = "restructuredtext" import json import os @@ -36,7 +34,7 @@ import traceback import collections.abc from onap_dcae_cbs_docker_client.client import get_config from mod import trapd_settings as tds -from mod.trapd_exit import cleanup,cleanup_and_exit +from mod.trapd_exit import cleanup, cleanup_and_exit from mod.trapd_io import stdout_logger prog_name = os.path.basename(__file__) @@ -75,46 +73,44 @@ def get_cbs_config(): _cbs_sim_json_file = os.getenv("CBS_HTBT_JSON", "None") except Exception as e: stdout_logger(msg) - cleanup(1,None) + cleanup(1, None) return False msg = "CBS_HTBT_JSON not defined - FATAL ERROR, exiting" if _cbs_sim_json_file == "None": stdout_logger(msg) - cleanup(1,None) + cleanup(1, None) return False else: - msg = ("ONAP controller override specified via CBS_HTBT_JSON: %s" % - _cbs_sim_json_file) + msg = "ONAP controller override specified via CBS_HTBT_JSON: %s" % _cbs_sim_json_file stdout_logger(msg) - msg = "Unable to load CBS_HTBT_JSON " + _cbs_sim_json_file + \ - " (invalid json?) - FATAL ERROR, exiting" + msg = "Unable to load CBS_HTBT_JSON " + _cbs_sim_json_file + " (invalid json?) - FATAL ERROR, exiting" try: tds.c_config = json.load(open(_cbs_sim_json_file)) except Exception as e: stdout_logger(msg) - cleanup_and_exit(0,None) + cleanup_and_exit(0, None) # recalc timeout, set default if not present try: - tds.timeout_seconds = tds.c_config['publisher.http_timeout_milliseconds'] / 1000.0 + tds.timeout_seconds = tds.c_config["publisher.http_timeout_milliseconds"] / 1000.0 except Exception as e: tds.timeout_seconds = 1.5 # recalc seconds_between_retries, set default if not present try: - tds.seconds_between_retries = tds.c_config['publisher.http_milliseconds_between_retries'] / 1000.0 + tds.seconds_between_retries = tds.c_config["publisher.http_milliseconds_between_retries"] / 1000.0 except Exception as e: - tds.seconds_between_retries = .750 + tds.seconds_between_retries = 0.750 # recalc min_severity_to_log, set default if not present try: - tds.minimum_severity_to_log = tds.c_config['files.minimum_severity_to_log'] + tds.minimum_severity_to_log = tds.c_config["files.minimum_severity_to_log"] except Exception as e: tds.minimum_severity_to_log = 3 try: - tds.publisher_retries = tds.c_config['publisher.http_retries'] + tds.publisher_retries = tds.c_config["publisher.http_retries"] except Exception as e: tds.publisher_retries = 3 |