Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for git module when it fails. #732

Merged
merged 1 commit into from
Jul 31, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/git
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,24 @@ def main():
if not os.path.exists(gitconfig):
(rc, out, err) = clone(repo, dest)
if rc != 0:
module.fail_json(out=out, err=err, rc=rc)
module.fail_json(msg=err)
else:
# else do a pull
before = get_version(dest)
(rc, out, err) = reset(dest)
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)

# handle errors from clone or pull
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
# we cloned or pulled
(rc, out, err) = switch_version(module, dest, remote, version)
if err.find('error') != -1:
module.fail_json(out=out, err=err)
module.fail_json(msg=err)

# determine if we changed anything
after = get_version(dest)
Expand Down
2 changes: 1 addition & 1 deletion test/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_yum(self):
def test_git(self):
if not get_binary("yum"):
raise SkipTest
repo = 'git://github.com/ansible/ansible.git'
repo = 'http://github.com/ansible/ansible.git'
dest = tempfile.mkdtemp()
result = self._run('git', ['repo=%s' % repo, 'dest=%s' % dest])
assert 'failed' not in result
Expand Down