summaryrefslogtreecommitdiffstats
path: root/dcae-policy/dcaepolicyplugin
diff options
context:
space:
mode:
authorMiroslav Los <miroslav.los@pantheon.tech>2019-11-26 14:20:36 +0100
committerMiroslav Los <miroslav.los@pantheon.tech>2019-11-26 19:24:24 +0100
commit01a60ff23b979eb676658713748598ba4892163a (patch)
tree1fb1b260c3723ddc42f047796db6b1928171b48c /dcae-policy/dcaepolicyplugin
parent77e27adeab5ff155b690f2e058c06f0a7812e225 (diff)
Support python3 in all plugins
Unify tox/requirements/setup.py requirement specifications. Do not set upper version limits if possible. Drop uuid as dependency included with standard library. Drop import of unmaintained cloudify_importer without python3 version. Use PEP 508 URLs in requirements for non-PyPI (github) releases. Use cloudify-common 5 release; pre-release package for python3. Rewrite uses of map with loops/comprehensions. Signed-off-by: Miroslav Los <miroslav.los@pantheon.tech> Issue-ID: DCAEGEN2-1956 Change-Id: I7b3ceb97a628e3af5bda3178d182f4207069e86d
Diffstat (limited to 'dcae-policy/dcaepolicyplugin')
-rw-r--r--dcae-policy/dcaepolicyplugin/tasks.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/dcae-policy/dcaepolicyplugin/tasks.py b/dcae-policy/dcaepolicyplugin/tasks.py
index 4e3b37a..2e62b15 100644
--- a/dcae-policy/dcaepolicyplugin/tasks.py
+++ b/dcae-policy/dcaepolicyplugin/tasks.py
@@ -1,5 +1,6 @@
# ================================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2019 Pantheon.tech. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -194,11 +195,15 @@ def _policies_find():
policy_required = ctx.node.properties.get(POLICY_REQUIRED)
try:
- policy_filter = copy.deepcopy(dict(
- (k, v) for (k, v) in dict(ctx.node.properties.get(POLICY_FILTER, {})).iteritems()
- if v or isinstance(v, (int, float))
- ))
- _fix_policy_filter(policy_filter)
+ policy_filter = ctx.node.properties.get(POLICY_FILTER)
+ if policy_filter:
+ policy_filter = {
+ k: copy.deepcopy(v) for k, v in policy_filter.items()
+ if v or isinstance(v, (int, float))
+ }
+ _fix_policy_filter(policy_filter)
+ else:
+ policy_filter = {}
if REQUEST_ID not in policy_filter:
policy_filter[REQUEST_ID] = str(uuid.uuid4())