diff --git a/contrib/mbs-build b/contrib/mbs-build index 69584f71..bffecf44 100755 --- a/contrib/mbs-build +++ b/contrib/mbs-build @@ -249,7 +249,7 @@ def get_scm_branch(branch): def submit_module_build(scm_url, branch, server, id_provider, pyrpkg, verify=True, optional=None): """ Submits the module defined by `scm_url` to MBS instance defined - by `server`. Returns build_id or negative error code. + by `server`. Returns tuple: build_id or negative error code, error message. """ scm_url = get_scm_url(scm_url, pyrpkg) branch = get_scm_branch(branch) @@ -258,7 +258,11 @@ def submit_module_build(scm_url, branch, server, id_provider, pyrpkg, verify=Tru logging.info("Submitting module build %s", scm_url) body = {'scmurl': scm_url, 'branch': branch} - body.update({x.split("=")[0]: x.split("=")[1] for x in optional}) + try: + optional_dict = {y[0]: y[1] for y in [x.split("=", 1) for x in optional]} + except IndexError: + return -5, "Optional arguments are not in a proper arg=value format." + body.update(optional_dict) resp = send_authorized_request( "POST", server, id_provider, "/module-build-service/1/module-builds/", body, verify=verify)