diff options
author | Loys Ollivier <lollivier@baylibre.com> | 2017-12-27 13:59:42 +0100 |
---|---|---|
committer | Loys Ollivier <lollivier@baylibre.com> | 2017-12-27 14:18:08 +0100 |
commit | 5c6cf2bf9c09f379cca28947fe6af0ec413c1fc4 (patch) | |
tree | 256b7f8c56bd41ec982e600ff90a7584cf6e06b6 /utils/agljobtemplate.py | |
parent | 17a84303e0529c121d730d60ab282dd158fbaf34 (diff) |
utils: Verify that callback options are correct
When using callbacks, the user must specify '--callback-to' and
'--callback-from'. Make these two arguments mutually dependant. If one
is specified, the other becomes mandatory as well.
Edit exceptions returns so they give meaningful information to the user
in case something went wrong while reading from the callback
configuration file.
Change-Id: Iaa0de0b6f01ba605407db2f37c3da97aa0cacbc2
Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'utils/agljobtemplate.py')
-rw-r--r-- | utils/agljobtemplate.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index 90bad13..c2e0b4a 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -30,14 +30,14 @@ def parse_callback_file(template_path, lava_callback, kci_callback): kci_callback = cfg.get('default', 'section') cb_data = dict(cfg.items(kci_callback)) return cb_data - except ConfigParser.NoSectionError: - str_err = "Please make sure: --callback-to " + kci_callback - str_err += " is correct and corresponds to a section in: " - str_err += lava_callback + ".cfg" - raise ConfigParser.NoSectionError, str_err - except IOError: - raise IOError, "Unable to read from file {}".format(callback_file_path) - + except (ConfigParser.NoSectionError) as err: + str_err = "'--callback-to {}': must correspond to a section [{}] in the file '{}.cfg'".format( + kci_callback, kci_callback, lava_callback) + raise ConfigParser.NoSectionError(str_err) + except (IOError) as err: + str_err = "\n'--callback-from {}': must correspond to a file located in: ".format(lava_callback) + str_err += "[releng-scripts]/templates/callback/{}.cfg".format(lava_callback) + raise IOError(err, str_err) class Agljobtemplate(object): |