From 1858cd314f4cdcdfaf1ac10d65ecfad60239e497 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 10 Feb 2022 18:04:32 -0500 Subject: [PATCH] Assure we can call get_spec and it can return the master spec correctly. --- crc/services/spec_file_service.py | 2 +- crc/services/workflow_spec_service.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crc/services/spec_file_service.py b/crc/services/spec_file_service.py index 21723778..bcbf3e28 100644 --- a/crc/services/spec_file_service.py +++ b/crc/services/spec_file_service.py @@ -62,7 +62,7 @@ class SpecFileService(FileSystemService): if os.path.exists(file_path): break if not os.path.exists(file_path): - raise ApiError("unknown_file", f"So file found with name {file_name} in {workflow_spec.display_name}") + raise ApiError("unknown_file", f"No file found with name {file_name} in {workflow_spec.display_name}") with open(file_path, 'rb') as f_handle: spec_file_data = f_handle.read() return spec_file_data diff --git a/crc/services/workflow_spec_service.py b/crc/services/workflow_spec_service.py index 0b06be3d..2e50692c 100644 --- a/crc/services/workflow_spec_service.py +++ b/crc/services/workflow_spec_service.py @@ -60,8 +60,10 @@ class WorkflowSpecService(FileSystemService): def get_spec(self, spec_id): if not os.path.exists(FileSystemService.root_path()): return # Nothing to scan yet. There are no files. - if spec_id == 'master_spec': - return self.get_master_spec() + + master_spec = self.get_master_spec() + if master_spec.id == spec_id: + return master_spec with os.scandir(FileSystemService.root_path()) as category_dirs: for item in category_dirs: category_dir = item