summaryrefslogtreecommitdiff
path: root/grc/core
diff options
context:
space:
mode:
authorJosh Morman <jmorman@perspectalabs.com>2019-07-30 12:54:19 -0400
committerMarcus Müller <marcus@hostalia.de>2019-08-05 16:04:58 +0200
commit86b86a9d7c9ab10f82b78aa80c49dbac69f158ed (patch)
treea8a216966a0c8507542ee2e61be984019f834762 /grc/core
parent86f3d3c13b38440235cd899c408f03e67b96040e (diff)
grc: prevent yaml parser errors from crashing grc
Moves the yaml file load inside the try block Fixes #2668
Diffstat (limited to 'grc/core')
-rw-r--r--grc/core/platform.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/grc/core/platform.py b/grc/core/platform.py
index 6aeaef2367..46a795bd0b 100644
--- a/grc/core/platform.py
+++ b/grc/core/platform.py
@@ -151,7 +151,6 @@ class Platform(Element):
with Cache(Constants.CACHE_FILE) as cache:
for file_path in self._iter_files_in_block_path(path):
- data = cache.get_or_load(file_path)
if file_path.endswith('.block.yml'):
loader = self.load_block_description
@@ -167,6 +166,7 @@ class Platform(Element):
try:
checker = schema_checker.Validator(scheme)
+ data = cache.get_or_load(file_path)
passed = checker.run(data)
for msg in checker.messages:
logger.warning('{:<40s} {}'.format(os.path.basename(file_path), msg))