diff options
author | Tommy Carpenter <tommy@research.att.com> | 2018-02-23 16:05:45 -0500 |
---|---|---|
committer | Tommy Carpenter <tommy@research.att.com> | 2018-02-23 16:06:42 -0500 |
commit | bfc70e565fd18d10f65d61e233bbf9bf1d770b63 (patch) | |
tree | fa0d0770088d7ceaf27e937d739c3d7241e8ae2b /onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client | |
parent | d1a814370eb3e45368af9d6a76f8ded77cca5c82 (diff) |
Make this compatible with CBS1 and CBS2
Change-Id: I3e221cbc9f7e9554829b2a88f4cc3277a349f1ae
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')
-rw-r--r-- | onap-dcae-cbs-docker-client/onap_dcae_cbs_docker_client/client.py | 15 |
1 files changed, 9 insertions, 6 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 f83111c..f21ad0e 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 @@ -52,9 +52,7 @@ def _get_envs(): return HOSTNAME, CONSUL_HOST -######### -# Public -def get_all(): +def _get_path(path): """ 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. @@ -77,7 +75,7 @@ def get_all(): logger.error("Cannot bind config at this time, cbs is unreachable") else: #get my config - my_config_endpoint = "{0}/service_component_all/{1}".format(cbs_url, HOSTNAME) + my_config_endpoint = "{0}/{1}/{2}".format(cbs_url, path, HOSTNAME) res = requests.get(my_config_endpoint) try: res.raise_for_status() @@ -87,6 +85,11 @@ def get_all(): 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 + +######### +# Public +def get_all(): + return _get_path("service_component_all") + def get_config(): - allk = get_all() - return allk["config"] + return _get_path("service_component") |