mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-06-27 23:46:33 +08:00
PR#1724: Improve error messaging for module submission.
Merges #1724 https://pagure.io/fm-orchestrator/pull-request/1724 Fixes: #1098 https://pagure.io/fm-orchestrator/issue/1098 [RFE] Improve the error messages when a user submits a module
This commit is contained in:
@@ -333,11 +333,12 @@ class SCM(object):
|
|||||||
with open(path_to_yaml):
|
with open(path_to_yaml):
|
||||||
return path_to_yaml
|
return path_to_yaml
|
||||||
except IOError:
|
except IOError:
|
||||||
log.error(
|
msg = (
|
||||||
"get_module_yaml: The SCM repository doesn't contain a modulemd file. "
|
"get_module_yaml: The SCM repository doesn't contain a modulemd file. "
|
||||||
"Couldn't access: %s" % path_to_yaml
|
"Couldn't access: %s" % path_to_yaml
|
||||||
)
|
)
|
||||||
raise UnprocessableEntity("The SCM repository doesn't contain a modulemd file")
|
log.error(msg)
|
||||||
|
raise UnprocessableEntity(msg)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_full_commit_hash(scheme, commit):
|
def is_full_commit_hash(scheme, commit):
|
||||||
|
|||||||
@@ -522,8 +522,9 @@ class SCMHandler(BaseHandler):
|
|||||||
raise Forbidden("The submitted scmurl %s is not allowed" % url)
|
raise Forbidden("The submitted scmurl %s is not allowed" % url)
|
||||||
|
|
||||||
if not get_scm_url_re().match(url):
|
if not get_scm_url_re().match(url):
|
||||||
log.error("The submitted scmurl %r is not valid" % url)
|
msg = "Expected format is '%s?[module-path]#[revision]'" % url
|
||||||
raise ValidationError("The submitted scmurl %s is not valid" % url)
|
log.error("The submitted scmurl %r is not valid. %s" % (url, msg))
|
||||||
|
raise ValidationError("The submitted scmurl %s is not valid. %s" % (url, msg))
|
||||||
|
|
||||||
if not skip_branch and "branch" not in self.data:
|
if not skip_branch and "branch" not in self.data:
|
||||||
log.error("Missing branch")
|
log.error("Missing branch")
|
||||||
|
|||||||
@@ -1239,7 +1239,9 @@ class TestSubmitBuild:
|
|||||||
data = json.loads(rv.data)
|
data = json.loads(rv.data)
|
||||||
assert data["message"] == (
|
assert data["message"] == (
|
||||||
"The submitted scmurl https://src.stg.fedoraproject.org"
|
"The submitted scmurl https://src.stg.fedoraproject.org"
|
||||||
"/modules/testmodule.git is not valid"
|
"/modules/testmodule.git is not valid. Expected format is "
|
||||||
|
"'https://src.stg.fedoraproject.org/modules/testmodule.git?"
|
||||||
|
"[module-path]#[revision]'"
|
||||||
)
|
)
|
||||||
assert data["status"] == 400
|
assert data["status"] == 400
|
||||||
assert data["error"] == "Bad Request"
|
assert data["error"] == "Bad Request"
|
||||||
|
|||||||
Reference in New Issue
Block a user