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
1 changed files with 4 additions and 2 deletions

View File

@ -66,8 +66,10 @@ class Parser:
for key, value in data.items():
self._data["var"][key] = {"value": {key: value}}
except (
ruamel.yaml.composer.ComposerError, ruamel.yaml.scanner.ScannerError,
ruamel.yaml.constructor.ConstructorError
ruamel.yaml.composer.ComposerError,
ruamel.yaml.scanner.ScannerError,
ruamel.yaml.constructor.ConstructorError,
ruamel.yaml.constructor.DuplicateKeyError,
) as e:
message = "{} {}".format(e.context, e.problem)
self.log.sysexit_with_message(