diff options
author | huangtianhua <huangtianhua@huawei.com> | 2016-09-09 17:08:00 -0400 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2016-09-12 21:40:06 -0400 |
commit | 4a92678f189e02963302121a814bf17797d6d684 (patch) | |
tree | 1173488274fa1910e727e333bac6ddda2632ce80 /heat/engine/template_common.py | |
parent | b67605de2478b303f1fa8a40c768698ede35630a (diff) | |
download | heat-4a92678f189e02963302121a814bf17797d6d684.tar.gz |
Allows condition name using boolean or function
This change supports:
1. Allow boolean value or condition function as
condition name of 'if' function:
resources:
r1:
...
properties:
a: {if: [true, 'value_true', 'value_false']}
r2:
...
properties:
b: {if: [{equals: [...]}, 'value_true', 'value_false']}
2. Allow boolean value or condition function as
condtiion name in resource definition:
resources:
r1:
...
condition: false
r2:
...
condition: {and: [cd1, cd2]}
3. Allow boolean value or condition function as
condition name in outputs:
outputs:
output1:
value: ...
condition: true
output2:
value: ...
condition: {not: cd3}
Change-Id: I2bf9bb0b608788c928d12425cbfdaf658df9e880
Co-Authored-By: Zane Bitter <zbitter@redhat.com>
Blueprint: support-conditions-function
Diffstat (limited to 'heat/engine/template_common.py')
-rw-r--r-- | heat/engine/template_common.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/heat/engine/template_common.py b/heat/engine/template_common.py index f421d18f9..fb5557a07 100644 --- a/heat/engine/template_common.py +++ b/heat/engine/template_common.py @@ -179,9 +179,12 @@ class CommonTemplate(template.Template): description = val.get(self.OUTPUT_DESCRIPTION) if hasattr(self, 'OUTPUT_CONDITION'): - cond_name = val.get(self.OUTPUT_CONDITION) + path = [self.OUTPUTS, key, self.OUTPUT_CONDITION] + cond = self.parse_condition(stack, + val.get(self.OUTPUT_CONDITION), + '.'.join(path)) try: - enabled = conds.is_enabled(cond_name) + enabled = conds.is_enabled(function.resolve(cond)) except ValueError as exc: path = [self.OUTPUTS, key, self.OUTPUT_CONDITION] message = six.text_type(exc) |