diff --git a/module_build_service/common/scm.py b/module_build_service/common/scm.py index cfb6429d..c639702b 100644 --- a/module_build_service/common/scm.py +++ b/module_build_service/common/scm.py @@ -333,11 +333,12 @@ class SCM(object): with open(path_to_yaml): return path_to_yaml except IOError: - log.error( + msg = ( "get_module_yaml: The SCM repository doesn't contain a modulemd file. " "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 def is_full_commit_hash(scheme, commit): diff --git a/module_build_service/web/views.py b/module_build_service/web/views.py index a9c37077..65e01b76 100644 --- a/module_build_service/web/views.py +++ b/module_build_service/web/views.py @@ -522,8 +522,9 @@ class SCMHandler(BaseHandler): raise Forbidden("The submitted scmurl %s is not allowed" % url) if not get_scm_url_re().match(url): - log.error("The submitted scmurl %r is not valid" % url) - raise ValidationError("The submitted scmurl %s is not valid" % url) + msg = "Expected format is '%s?[module-path]#[revision]'" % 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: log.error("Missing branch") diff --git a/tests/test_web/test_views.py b/tests/test_web/test_views.py index 68909780..31f23e6e 100644 --- a/tests/test_web/test_views.py +++ b/tests/test_web/test_views.py @@ -1239,7 +1239,9 @@ class TestSubmitBuild: data = json.loads(rv.data) assert data["message"] == ( "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["error"] == "Bad Request"