Improve yaml fault tolerance and handle check_config border cases (#3159)

This commit is contained in:
Johann Kellerman authored and GitHub committed 2016-09-08 22:20:38 +02:00
1 parent 267cda447e
commit e8ad76c816
5 files changed
+90 -59

No files matched your search

+6 -2
View File
@@ -221,14 +221,18 @@ def check(config_path):
try:
bootstrap.from_config_file(config_path, skip_pip=True)
res['secret_cache'] = yaml.__SECRET_CACHE
return res
res['secret_cache'] = dict(yaml.__SECRET_CACHE)
except Exception as err: # pylint: disable=broad-except
print(color('red', 'Fatal error while loading config:'), str(err))
finally:
# Stop all patches
for pat in PATCHES.values():
pat.stop()
# Ensure !secrets point to the original function
yaml.yaml.SafeLoader.add_constructor('!secret', yaml._secret_yaml)
bootstrap.clear_secret_cache()
return res
def dump_dict(layer, indent_count=1, listi=False, **kwargs):