diff options
author | Alex Shatov <alexs@att.com> | 2018-03-26 17:16:29 -0400 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2018-03-26 17:16:29 -0400 |
commit | 19470fb77656cd6680058f456fb0f09e86f504dc (patch) | |
tree | a8cbb44de0d6ae9a1196f448f6f6a2ed7ebcaba5 /dcae-policy/dcaepolicyplugin/tasks.py | |
parent | 7d9895ebb2ed0554ed8fafa5c909a9a930c3f962 (diff) |
2.2.0 dcaepolicyplugin and data types
- dcaepolicyplugin to use default policy-handler url
by dns to discover policy-handler under k8s
when policy_handler record not found under consul-service
- pending hardcoding the proper dns based url that is to be
provided by k8s + MSB solution
Change-Id: I8bf49fe29735ec842235c0b58595c7196f5d24ca
Signed-off-by: Alex Shatov <alexs@att.com>
Issue-ID: DCAEGEN2-419
Diffstat (limited to 'dcae-policy/dcaepolicyplugin/tasks.py')
-rw-r--r-- | dcae-policy/dcaepolicyplugin/tasks.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dcae-policy/dcaepolicyplugin/tasks.py b/dcae-policy/dcaepolicyplugin/tasks.py index fd3e37c..b3a29aa 100644 --- a/dcae-policy/dcaepolicyplugin/tasks.py +++ b/dcae-policy/dcaepolicyplugin/tasks.py @@ -50,6 +50,7 @@ class PolicyHandler(object): SERVICE_NAME_POLICY_HANDLER = "policy_handler" X_ECOMP_REQUESTID = 'X-ECOMP-RequestID' STATUS_CODE_POLICIES_NOT_FOUND = 404 + DEFAULT_URL = "http://policy-handler" _url = None @staticmethod @@ -59,6 +60,8 @@ class PolicyHandler(object): return PolicyHandler._url = discover_service_url(PolicyHandler.SERVICE_NAME_POLICY_HANDLER) + if not PolicyHandler._url: + PolicyHandler._url = PolicyHandler.DEFAULT_URL @staticmethod def get_latest_policy(policy_id): @@ -68,7 +71,7 @@ class PolicyHandler(object): ph_path = "{0}/policy_latest/{1}".format(PolicyHandler._url, policy_id) headers = {PolicyHandler.X_ECOMP_REQUESTID: str(uuid.uuid4())} - ctx.logger.info("getting latest policy from {0} headers={1}".format( \ + ctx.logger.info("getting latest policy from {0} headers={1}".format( ph_path, json.dumps(headers))) res = requests.get(ph_path, headers=headers) ctx.logger.info("latest policy for policy_id({0}) status({1}) response: {2}" |