summaryrefslogtreecommitdiffstats
path: root/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py')
-rw-r--r--onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py b/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
index 3abf447..f83111c 100644
--- a/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
+++ b/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
@@ -24,6 +24,9 @@ import logging
root = logging.getLogger()
logger = root.getChild(__name__)
+#########
+# HELPERS
+
def _get_uri_from_consul(consul_url, name):
"""
Call consul's catalog
@@ -48,8 +51,10 @@ def _get_envs():
CONSUL_HOST = os.environ["CONSUL_HOST"]
return HOSTNAME, CONSUL_HOST
-#Public
-def get_config():
+
+#########
+# Public
+def get_all():
"""
This call does not raise an exception if Consul or the CBS cannot complete the request.
It logs an error and returns {} if the config is not bindable.
@@ -72,7 +77,7 @@ def get_config():
logger.error("Cannot bind config at this time, cbs is unreachable")
else:
#get my config
- my_config_endpoint = "{0}/service_component/{1}".format(cbs_url, HOSTNAME)
+ my_config_endpoint = "{0}/service_component_all/{1}".format(cbs_url, HOSTNAME)
res = requests.get(my_config_endpoint)
try:
res.raise_for_status()
@@ -82,3 +87,6 @@ def get_config():
logger.error("in get_config, the config binding service endpoint {0} blew up on me. Error code: {1}, Error text: {2}".format(my_config_endpoint, res.status_code, res.text))
return config
+def get_config():
+ allk = get_all()
+ return allk["config"]