From 86b86a9d7c9ab10f82b78aa80c49dbac69f158ed Mon Sep 17 00:00:00 2001
From: Josh Morman <jmorman@perspectalabs.com>
Date: Tue, 30 Jul 2019 12:54:19 -0400
Subject: grc: prevent yaml parser errors from crashing grc

Moves the yaml file load inside the try block

Fixes #2668
---
 grc/core/platform.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'grc/core')

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))
-- 
cgit v1.2.3