Don't change pyyaml behavior

When an application load heatclient, the default pyyaml behavior change.

This ensures only heatclient use it's custom pyyaml stuffs.

This currently breaks the telemetry gate if the tempest heat plugin is
loaded with the telemetry.

Change-Id: I5d7d1a1999e762f2285a0effc081252570f24de8
This commit is contained in:
Mehdi Abaakouk 2018-09-04 10:30:10 +02:00
parent dcab4084c3
commit 6ef3e8761e
1 changed files with 13 additions and 4 deletions

View File

@ -16,14 +16,23 @@ import yaml
from heatclient._i18n import _
if hasattr(yaml, 'CSafeLoader'):
yaml_loader = yaml.CSafeLoader
yaml_loader_base = yaml.CSafeLoader
else:
yaml_loader = yaml.SafeLoader
yaml_loader_base = yaml.SafeLoader
if hasattr(yaml, 'CSafeDumper'):
yaml_dumper = yaml.CSafeDumper
yaml_dumper_base = yaml.CSafeDumper
else:
yaml_dumper = yaml.SafeDumper
yaml_dumper_base = yaml.SafeDumper
# We create custom class to not overriden the default yaml behavior
class yaml_loader(yaml_loader_base):
pass
class yaml_dumper(yaml_dumper_base):
pass
def _construct_yaml_str(self, node):