Fixes for git module when it fails.
* module.fail_json *must* have msg argument Using http://github.com/ rather than git://github.com/ as it gets through more firewalls
This commit is contained in:
parent
d79ba6f2aa
commit
e863ba0cec
2 changed files with 5 additions and 5 deletions
|
@ -165,24 +165,24 @@ def main():
|
||||||
if not os.path.exists(gitconfig):
|
if not os.path.exists(gitconfig):
|
||||||
(rc, out, err) = clone(repo, dest)
|
(rc, out, err) = clone(repo, dest)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(out=out, err=err, rc=rc)
|
module.fail_json(msg=err)
|
||||||
else:
|
else:
|
||||||
# else do a pull
|
# else do a pull
|
||||||
before = get_version(dest)
|
before = get_version(dest)
|
||||||
(rc, out, err) = reset(dest)
|
(rc, out, err) = reset(dest)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(out=out, err=err, rc=rc)
|
module.fail_json(msg=err)
|
||||||
(rc, out, err) = pull(module, repo, dest, version)
|
(rc, out, err) = pull(module, repo, dest, version)
|
||||||
|
|
||||||
# handle errors from clone or pull
|
# handle errors from clone or pull
|
||||||
if out.find('error') != -1 or err.find('ERROR') != -1:
|
if out.find('error') != -1 or err.find('ERROR') != -1:
|
||||||
module.fail_json(out=out, err=err)
|
module.fail_json(msg=err)
|
||||||
|
|
||||||
# switch to version specified regardless of whether
|
# switch to version specified regardless of whether
|
||||||
# we cloned or pulled
|
# we cloned or pulled
|
||||||
(rc, out, err) = switch_version(module, dest, remote, version)
|
(rc, out, err) = switch_version(module, dest, remote, version)
|
||||||
if err.find('error') != -1:
|
if err.find('error') != -1:
|
||||||
module.fail_json(out=out, err=err)
|
module.fail_json(msg=err)
|
||||||
|
|
||||||
# determine if we changed anything
|
# determine if we changed anything
|
||||||
after = get_version(dest)
|
after = get_version(dest)
|
||||||
|
|
|
@ -191,7 +191,7 @@ class TestRunner(unittest.TestCase):
|
||||||
def test_git(self):
|
def test_git(self):
|
||||||
if not get_binary("yum"):
|
if not get_binary("yum"):
|
||||||
raise SkipTest
|
raise SkipTest
|
||||||
repo = 'git://github.com/ansible/ansible.git'
|
repo = 'http://github.com/ansible/ansible.git'
|
||||||
dest = tempfile.mkdtemp()
|
dest = tempfile.mkdtemp()
|
||||||
result = self._run('git', ['repo=%s' % repo, 'dest=%s' % dest])
|
result = self._run('git', ['repo=%s' % repo, 'dest=%s' % dest])
|
||||||
assert 'failed' not in result
|
assert 'failed' not in result
|
||||||
|
|
Loading…
Reference in a new issue