Merge pull request #790 from sfromm/fixgit
Fix error handling when switching versions
This commit is contained in:
commit
ae7e1928df
1 changed files with 2 additions and 7 deletions
|
@ -58,11 +58,6 @@ def reset(dest):
|
||||||
rc = cmd.returncode
|
rc = cmd.returncode
|
||||||
return (rc, out, err)
|
return (rc, out, err)
|
||||||
|
|
||||||
def switchLocalBranch( branch ):
|
|
||||||
cmd = "git checkout %s" % branch
|
|
||||||
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
return cmd.communicate()
|
|
||||||
|
|
||||||
def get_branches(module, dest):
|
def get_branches(module, dest):
|
||||||
os.chdir(dest)
|
os.chdir(dest)
|
||||||
branches = []
|
branches = []
|
||||||
|
@ -156,7 +151,7 @@ def main():
|
||||||
|
|
||||||
gitconfig = os.path.join(dest, '.git', 'config')
|
gitconfig = os.path.join(dest, '.git', 'config')
|
||||||
|
|
||||||
out, err, status = (None, None, None)
|
rc, out, err, status = (0, None, None, None)
|
||||||
|
|
||||||
# if there is no git configuration, do a clone operation
|
# if there is no git configuration, do a clone operation
|
||||||
# else pull and switch the version
|
# else pull and switch the version
|
||||||
|
@ -180,7 +175,7 @@ def main():
|
||||||
# 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 rc != 0:
|
||||||
module.fail_json(msg=err)
|
module.fail_json(msg=err)
|
||||||
|
|
||||||
# determine if we changed anything
|
# determine if we changed anything
|
||||||
|
|
Loading…
Reference in a new issue