fix: catch duplicate key error on yaml load (#256)

This commit is contained in:
Robert Kaussow 2022-03-02 22:37:13 +01:00 committed by GitHub
parent d9b0178095
commit 307abeb3cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,8 +66,10 @@ class Parser:
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.constructor.ConstructorError ruamel.yaml.scanner.ScannerError,
ruamel.yaml.constructor.ConstructorError,
ruamel.yaml.constructor.DuplicateKeyError,
) 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(