mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Check rc instead of parsing for errors. This now catches the case where the remote branch has been deleted and you're still trying to pull against it.
This commit is contained in:
parent
dfaef8061a
commit
6042419624
1 changed files with 4 additions and 2 deletions
|
@ -155,7 +155,7 @@ def pull(module, repo, dest, version):
|
||||||
if b.startswith('* '):
|
if b.startswith('* '):
|
||||||
cur_branch = b
|
cur_branch = b
|
||||||
if is_local_branch(module, dest, version) and not is_current_branch(module, dest, version):
|
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)
|
||||||
|
|
||||||
cmd = "git pull -u origin"
|
cmd = "git pull -u origin"
|
||||||
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
@ -219,9 +219,11 @@ def main():
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(msg=err)
|
module.fail_json(msg=err)
|
||||||
(rc, out, err) = pull(module, repo, dest, version)
|
(rc, out, err) = pull(module, repo, dest, version)
|
||||||
|
if rc != 0:
|
||||||
|
module.fail_json(msg=err)
|
||||||
|
|
||||||
# handle errors from clone or pull
|
# handle errors from clone or pull
|
||||||
if out.find('error') != -1 or err.find('ERROR') != -1:
|
if rc != 0:
|
||||||
module.fail_json(msg=err)
|
module.fail_json(msg=err)
|
||||||
|
|
||||||
# switch to version specified regardless of whether
|
# switch to version specified regardless of whether
|
||||||
|
|
Loading…
Reference in a new issue