From 0c1e01cad4b803b9dab3c9e06d9d132faf58dae3 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Mon, 29 Feb 2016 17:21:53 +0000 Subject: [PATCH] run command: more usefull error message when specifying non-existing agenda path If the specified agenda argument is not found in the file system, WA assumes it is the name of a workload and would then raise an "extension not found error", which may be confusing if the user's intension was to specify a path. Now, WA will first check that neither path separator, nor a '.' are present in the agenda argument before assuming it is a workload name, and will provide a less confusing error in that case. --- wlauto/commands/run.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wlauto/commands/run.py b/wlauto/commands/run.py index 7fbf1c4f..c5432efe 100644 --- a/wlauto/commands/run.py +++ b/wlauto/commands/run.py @@ -20,6 +20,7 @@ import shutil import wlauto from wlauto import Command, settings +from wlauto.exceptions import ConfigError from wlauto.core.agenda import Agenda from wlauto.core.execution import Executor from wlauto.utils.log import add_log_file @@ -76,6 +77,8 @@ class RunCommand(Command): agenda = Agenda(args.agenda) settings.agenda = args.agenda shutil.copy(args.agenda, settings.meta_directory) + elif '.' in args.agenda or os.sep in args.agenda: + raise ConfigError('Agenda "{}" does not exist.'.format(args.agenda)) else: self.logger.debug('{} is not a file; assuming workload name.'.format(args.agenda)) agenda = Agenda()