Assure we can call get_spec and it can return the master spec correctly.

This commit is contained in:
Dan 2022-02-10 18:04:32 -05:00
parent a047c63c32
commit 1858cd314f
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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