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
This commit is contained in:
Alexander Tivelkov 2015-04-30 20:27:40 +03:00
parent 68494598ef
commit 779fd3cd23

View File

@ -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)