summaryrefslogtreecommitdiffstats
path: root/onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
diff options
context:
space:
mode:
authorTommy Carpenter <tommy@research.att.com>2018-02-22 14:32:46 -0500
committerTommy Carpenter <tommy@research.att.com>2018-02-22 14:32:49 -0500
commitd1a814370eb3e45368af9d6a76f8ded77cca5c82 (patch)
treedef567f5c53833ba75170517f5d00625438e66b9 /onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py
parent44f0f8f2c3615b19b2c254fc3e2509116433e18a (diff)
Implement the CBS 2.0.0 API
Change-Id: Iadf9e3d071ea24e240599fca2c13d1251e31f729 Issue-ID: DCAEGEN2-351 Signed-off-by: Tommy Carpenter <tommy@research.att.com>
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"]