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

Check rc instead of parsing for errors. #1314

Merged
merged 2 commits into from
Oct 13, 2012
Merged
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
10 changes: 5 additions & 5 deletions library/git
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ def pull(module, repo, dest, version):
if b.startswith('* '):
cur_branch = b
if is_local_branch(module, dest, version) and not is_current_branch(module, dest, version):
(out, err) = switch_version(module, dest, remote, version)
(rc, out, err) = switch_version(module, dest, remote, version)
if rc != 0:
module.fail_json(msg=err)

cmd = "git pull -u origin"
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand Down Expand Up @@ -219,10 +221,8 @@ def main():
if rc != 0:
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(msg=err)
if rc != 0:
module.fail_json(msg=err)

# switch to version specified regardless of whether
# we cloned or pulled
Expand Down