aboutsummaryrefslogtreecommitdiffstats
path: root/snmptrap/mod/trapd_get_cbs_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'snmptrap/mod/trapd_get_cbs_config.py')
-rw-r--r--snmptrap/mod/trapd_get_cbs_config.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/snmptrap/mod/trapd_get_cbs_config.py b/snmptrap/mod/trapd_get_cbs_config.py
index 8bdff15..272aabe 100644
--- a/snmptrap/mod/trapd_get_cbs_config.py
+++ b/snmptrap/mod/trapd_get_cbs_config.py
@@ -1,7 +1,5 @@
# ============LICENSE_START=======================================================
-# org.onap.dcae
-# ================================================================================
-# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2018-2020 AT&T Intellectual Property. 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.
@@ -15,9 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
"""
Look for CBS broker and return application config; if not present, look for
env variable that specifies JSON equiv of CBS config (typically used for
@@ -74,47 +69,52 @@ def get_cbs_config():
except Exception as e:
msg = "CBS_SIM_JSON not defined - FATAL ERROR, exiting"
stdout_logger(msg)
- cleanup_and_exit(1,None)
+ cleanup_and_exit(1, None)
if _cbs_sim_json_file == "None":
msg = "CBS_SIM_JSON not defined - FATAL ERROR, exiting"
stdout_logger(msg)
- cleanup_and_exit(1,None)
+ cleanup_and_exit(1, None)
else:
msg = ("ONAP controller override specified via CBS_SIM_JSON: %s" %
_cbs_sim_json_file)
stdout_logger(msg)
try:
tds.c_config = json.load(open(_cbs_sim_json_file))
- msg = ("%s loaded and parsed successfully" % _cbs_sim_json_file)
+ msg = ("%s loaded and parsed successfully" %
+ _cbs_sim_json_file)
stdout_logger(msg)
except Exception as e:
msg = "Unable to load CBS_SIM_JSON " + _cbs_sim_json_file + \
" (invalid json?) - FATAL ERROR, exiting"
stdout_logger(msg)
- cleanup_and_exit(1,None)
+ cleanup_and_exit(1, None)
+
+ # display consul config returned, regardless of source
+ msg = "cbs config: %s" % json.dumps(tds.c_config)
+ stdout_logger(msg)
# recalc timeout, set default if not present
try:
- tds.timeout_seconds = tds.c_config['publisher']['http_milliseconds_timeout'] / 1000.0
+ tds.timeout_seconds = float(tds.c_config['publisher']['http_milliseconds_timeout'] / 1000.0)
except Exception as e:
- tds.timeout_seconds = 1.5
+ tds.timeout_seconds = float(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 = float(tds.c_config['publisher']['http_milliseconds_between_retries'] / 1000.0)
except Exception as e:
- tds.seconds_between_retries = .750
+ tds.seconds_between_retries = float(.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 = int(tds.c_config['files']['minimum_severity_to_log'])
except Exception as e:
- tds.minimum_severity_to_log = 3
+ tds.minimum_severity_to_log = int(3)
try:
- tds.publisher_retries = tds.c_config['publisher']['http_retries']
+ tds.publisher_retries = int(tds.c_config['publisher']['http_retries'])
except Exception as e:
- tds.publisher_retries = 2
+ tds.publisher_retries = int(2)
return True