From 779fd3cd2304c9276b65407372ccda6fa9a6b639 Mon Sep 17 00:00:00 2001 From: Alexander Tivelkov Date: Thu, 30 Apr 2015 20:27:40 +0300 Subject: [PATCH] Fixed YAQL tag leakage to YAML loader Implicit yaml tag resolver being registered for YaqlYamlLoader (which is user to load MuranoPL classes as YAML documents with embedded YAQL statements) was being registered in the default YAML Dumper which is used for any YAML serialization. This was leading to inability to load more then one HOT-based package per API service lifetime: the first package which was uploaded was causing the leakage of YAQL statements into the global tag resolver. This global resolver was used for all subsequent load attempts, so plain yaml documents with Heat templates were attempted to be loaded as MuranoPL classes. This patch fixes this behavior by registering the implicit resolver without helper method (which actually registers the resolvers at default Dumper). Change-Id: Icd3b6d354bcb105c2c25f842ede077d539e9c246 Closes-Bug: #1450547 --- murano/engine/yaql_yaml_loader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/murano/engine/yaql_yaml_loader.py b/murano/engine/yaql_yaml_loader.py index 87bee560..bd3a738e 100644 --- a/murano/engine/yaql_yaml_loader.py +++ b/murano/engine/yaql_yaml_loader.py @@ -65,6 +65,6 @@ def yaql_constructor(loader, node): result.source_file_position = build_position(node) return result -yaml.add_constructor(u'!yaql', yaql_constructor, YaqlYamlLoader) -yaml.add_implicit_resolver(u'!yaql', yaql_expression.YaqlExpression, - Loader=YaqlYamlLoader) +YaqlYamlLoader.add_constructor(u'!yaql', yaql_constructor) +YaqlYamlLoader.add_implicit_resolver(u'!yaql', yaql_expression.YaqlExpression, + None)