From d1a814370eb3e45368af9d6a76f8ded77cca5c82 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Thu, 22 Feb 2018 14:32:46 -0500 Subject: Implement the CBS 2.0.0 API Change-Id: Iadf9e3d071ea24e240599fca2c13d1251e31f729 Issue-ID: DCAEGEN2-351 Signed-off-by: Tommy Carpenter --- .../onap_dcae_cbs_docker_client/client.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client') 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"] -- cgit 1.2.3-korg