From 51ee162a253d9b98cdc378ea3f530e7ba4f620f9 Mon Sep 17 00:00:00 2001 From: Karel Srot Date: Wed, 28 Aug 2024 23:07:39 +0200 Subject: [PATCH] Support loading recipe from a file --- newa/__init__.py | 2 +- newa/cli.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/newa/__init__.py b/newa/__init__.py index 3d2ed88..4ccc99c 100644 --- a/newa/__init__.py +++ b/newa/__init__.py @@ -393,7 +393,7 @@ def load_data_from_location(location: str, else: stack = [location] data: dict[str, Any] = {} - if location.startswith('https://'): + if re.search('^https?://', location): data = yaml_parser().load(get_request( url=location, response_content=ResponseContentType.TEXT)) diff --git a/newa/cli.py b/newa/cli.py index 446a194..df6ec87 100644 --- a/newa/cli.py +++ b/newa/cli.py @@ -487,7 +487,10 @@ def cmd_schedule(ctx: CLIContext, arch: str) -> None: environment=ctx.cli_environment, context=ctx.cli_context) - config = RecipeConfig.from_yaml_url(jira_job.recipe.url) + if re.search('^https?://', jira_job.recipe.url): + config = RecipeConfig.from_yaml_url(jira_job.recipe.url) + else: + config = RecipeConfig.from_yaml_file(Path(jira_job.recipe.url)) # extend dimensions with system architecture but do not override existing settings if 'arch' not in config.dimensions: config.dimensions['arch'] = []