summaryrefslogtreecommitdiffstats
path: root/dcae-policy/dcaepolicyplugin/tasks.py
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2018-03-27 02:18:13 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-27 02:18:13 +0000
commit342c2890e9b46b483244773b2337c8f56ae9bd0d (patch)
treeac21ecf7f6df46674b28960a6f50571d4120d5c8 /dcae-policy/dcaepolicyplugin/tasks.py
parent5536545e42a15d0ab6a389b3856b390d997d3b08 (diff)
parent19470fb77656cd6680058f456fb0f09e86f504dc (diff)
Merge "2.2.0 dcaepolicyplugin and data types"
Diffstat (limited to 'dcae-policy/dcaepolicyplugin/tasks.py')
-rw-r--r--dcae-policy/dcaepolicyplugin/tasks.py5
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}"