mirror of
https://github.com/thegeeklab/ansible-doctor.git
synced 2024-11-22 04:40:43 +00:00
fix: preserve multiline string formatting (#245)
This commit is contained in:
parent
aac0ef5f20
commit
c5106144ad
@ -40,11 +40,13 @@ class Parser:
|
|||||||
UnsafeTag.yaml_constructor,
|
UnsafeTag.yaml_constructor,
|
||||||
constructor=ruamel.yaml.SafeConstructor
|
constructor=ruamel.yaml.SafeConstructor
|
||||||
)
|
)
|
||||||
data = defaultdict(dict, (ruamel.yaml.safe_load(yaml_file) or {}))
|
loader = ruamel.yaml.YAML(typ="rt")
|
||||||
|
data = defaultdict(dict, (loader.load(yaml_file) or {}))
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
self._data["var"][key] = {"value": {key: value}}
|
self._data["var"][key] = {"value": {key: value}}
|
||||||
except (
|
except (
|
||||||
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError
|
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError,
|
||||||
|
ruamel.yaml.constructor.ConstructorError
|
||||||
) as e:
|
) as e:
|
||||||
message = "{} {}".format(e.context, e.problem)
|
message = "{} {}".format(e.context, e.problem)
|
||||||
self.log.sysexit_with_message(
|
self.log.sysexit_with_message(
|
||||||
|
Loading…
Reference in New Issue
Block a user