diff options
author | Tommy Carpenter <tommy@research.att.com> | 2018-02-15 21:10:17 -0500 |
---|---|---|
committer | Tommy Carpenter <tommy@research.att.com> | 2018-02-15 21:10:35 -0500 |
commit | 3a3543f74d74d4410c3e4d414bebf3d1daba5a59 (patch) | |
tree | ff978a94aeee9a4c4db6fede7f592a67bfe27c1b /config_binding_service | |
parent | 857c41af07fd88b50c2e960071611f425268e486 (diff) |
More Unit Testing, Fix Liscenses
Issue-ID: DCAEGEN2-341
Change-Id: I9ecbb020775f7dca812e38691a27ef3966f260e6
Signed-off-by: Tommy Carpenter <tommy@research.att.com>
Diffstat (limited to 'config_binding_service')
-rw-r--r-- | config_binding_service/__init__.py | 2 | ||||
-rw-r--r-- | config_binding_service/client.py | 14 | ||||
-rw-r--r-- | config_binding_service/controller.py | 2 | ||||
-rw-r--r-- | config_binding_service/swagger/swagger.yaml | 4 |
4 files changed, 7 insertions, 15 deletions
diff --git a/config_binding_service/__init__.py b/config_binding_service/__init__.py index c50f47f..5f09f1e 100644 --- a/config_binding_service/__init__.py +++ b/config_binding_service/__init__.py @@ -1,6 +1,4 @@ # ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/config_binding_service/client.py b/config_binding_service/client.py index 6b53996..a78a993 100644 --- a/config_binding_service/client.py +++ b/config_binding_service/client.py @@ -1,6 +1,4 @@ # ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,11 +53,8 @@ def _consul_get_key(key): return json.loads(base64.b64decode(D["Value"]).decode("utf-8")) def _get_config_rels_dmaap(service_component_name): - try: - config = _consul_get_key(service_component_name) #not ok if no config - except requests.exceptions.HTTPError as e: - #might be a 404, or could be not even able to reach consul (503?), bubble up the requests error - raise CantGetConfig(e.response.status_code, e.response.text) + #this one is critical, if we hit an error, blow up and raise to the caller + config = _consul_get_key(service_component_name) #not ok if no config rels = [] dmaap = {} @@ -177,7 +172,10 @@ def resolve(service_component_name): """ Return the bound config of service_component_name """ - config, rels, dmaap = _get_config_rels_dmaap(service_component_name) + try: + config, rels, dmaap = _get_config_rels_dmaap(service_component_name) + except requests.exceptions.HTTPError as e: + raise CantGetConfig(e.response.status_code, e.response.text) _logger.info("Fetching {0}: config={1}, rels={2}".format(service_component_name, json.dumps(config), rels)) return _recurse(config, rels, dmaap) diff --git a/config_binding_service/controller.py b/config_binding_service/controller.py index ec6f05e..1841bed 100644 --- a/config_binding_service/controller.py +++ b/config_binding_service/controller.py @@ -1,6 +1,4 @@ # ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/config_binding_service/swagger/swagger.yaml b/config_binding_service/swagger/swagger.yaml index 31fc42a..ce6cf7d 100644 --- a/config_binding_service/swagger/swagger.yaml +++ b/config_binding_service/swagger/swagger.yaml @@ -1,6 +1,4 @@ # ============LICENSE_START======================================================= -# org.onap.dcae -# ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +20,7 @@ --- swagger: "2.0" info: - version: "1.3.0" + version: "1.3.1" title: "Config Binding Service" paths: /service_component/{service_component_name}: |