This is an automated email from the ASF dual-hosted git repository. mxmrlv pushed a commit to branch ARIA-422-Parsing-CSARs-is-broken in repository https://gitbox.apache.org/repos/asf/incubator-ariatosca.git
commit 7e5d811b6c3648793bf618da802c21ab13360b8d Author: max-orlov <[email protected]> AuthorDate: Mon Dec 4 16:10:25 2017 +0200 ARIA-422 Parsing CSARs is broken --- aria/cli/csar.py | 2 +- aria/utils/yaml.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/aria/cli/csar.py b/aria/cli/csar.py index ba80bad..5017ab9 100644 --- a/aria/cli/csar.py +++ b/aria/cli/csar.py @@ -77,7 +77,6 @@ def write(service_template_path, destination, logger): logger.debug('Writing new metadata file to {0}'.format(META_FILE)) f.writestr(META_FILE, yaml.dump(metadata, default_flow_style=False)) - class _CSARReader(object): def __init__(self, source, destination, logger): @@ -143,6 +142,7 @@ class _CSARReader(object): raise ValueError('Metadata file {0} is missing from the CSAR'.format(csar_metafile)) self.logger.debug('CSAR metadata file: {0}'.format(csar_metafile)) self.logger.debug('Attempting to parse CSAR metadata YAML') + with open(csar_metafile) as f: self.metadata.update(yaml.load(f, Loader=yaml.SafeLoader)) self.logger.debug('CSAR metadata:{0}{1}'.format(os.linesep, pprint.pformat(self.metadata))) diff --git a/aria/utils/yaml.py b/aria/utils/yaml.py index 4c9c557..0bf58a7 100644 --- a/aria/utils/yaml.py +++ b/aria/utils/yaml.py @@ -48,3 +48,7 @@ except ImportError: finally: from ruamel import yaml # pylint: disable=unused-import + + +# Enables support for writing python unicode class with yaml +yaml.SafeLoader.add_constructor('tag:yaml.org,2002:python/unicode', lambda _, node: node.value) -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
