mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Merge pull request #1314 from apenney/bugfix/git
Check rc instead of parsing for errors.
This commit is contained in:
10
library/git
10
library/git
@@ -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)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user