From e91f4fdea6fad1e8602e9574be5141aaeeada37e Mon Sep 17 00:00:00 2001 From: mprahl Date: Fri, 3 Nov 2017 16:18:40 -0400 Subject: [PATCH] Revert "added git option which will return correct return code" This caused an issue when the modulemd had the ref's for its components as commit hashes instead of branches. This reverts commit 15f332e60f013d390d14790761d0622b4f94a746. --- module_build_service/scm.py | 4 ++-- tests/test_scm.py | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/module_build_service/scm.py b/module_build_service/scm.py index a15d62bd..bf7f0fc1 100644 --- a/module_build_service/scm.py +++ b/module_build_service/scm.py @@ -134,7 +134,7 @@ class SCM(object): if stderr: log.warning(stderr) if proc.returncode != 0: - raise UnprocessableEntity("Failed on %r, retcode %r, out %r, err %r" % ( + raise RuntimeError("Failed on %r, retcode %r, out %r, err %r" % ( cmd, proc.returncode, stdout, stderr)) return proc.returncode, stdout, stderr @@ -186,7 +186,7 @@ class SCM(object): """ if self.scheme == "git": log.debug("Getting/verifying commit hash for %s" % self.repository) - output = SCM._run(["git", "ls-remote", "--exit-code", self.repository, branch])[1] + output = SCM._run(["git", "ls-remote", self.repository, branch])[1] if output: self.commit = output.split("\t")[0] return self.commit diff --git a/tests/test_scm.py b/tests/test_scm.py index 7162a03b..2f500a2e 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -65,10 +65,8 @@ class TestSCMModule(unittest.TestCase): scm = module_build_service.scm.SCM(repo_path) assert scm.scheme == 'git', scm.scheme fname = tempfile.mktemp(suffix='mbs-scm-test') - try: - scm.get_latest(branch='master; touch %s' % fname) - except UnprocessableEntity: - assert not os.path.exists(fname), "%r exists! Vulnerable." % fname + scm.get_latest(branch='master; touch %s' % fname) + assert not os.path.exists(fname), "%r exists! Vulnerable." % fname def test_local_extract_name(self): scm = module_build_service.scm.SCM(repo_path) @@ -117,8 +115,3 @@ class TestSCMModule(unittest.TestCase): scm.checkout(self.tempdir) scm.verify() scm.get_module_yaml() - - @raises(UnprocessableEntity) - def test_get_latest_incorect_component_branch(self): - scm = module_build_service.scm.SCM(repo_path) - scm.get_latest(branch='foobar')