mirror of https://github.com/zulip/zulip.git
zulip-puppet-apply: Exit status code 2 on puppet failure.
This allows us, when run with `--noop -f`, to differentiate between "there are unapplied changes" and "there were puppet errors."
This commit is contained in:
parent
22712f634d
commit
fd47f6296e
|
@ -83,6 +83,8 @@ def noop_would_change(puppet_cmd: List[str]) -> bool:
|
|||
with open(lastrun_file.name) as lastrun:
|
||||
lastrun_data = yaml.safe_load(lastrun)
|
||||
return lastrun_data.get("resources", {}).get("out_of_sync", 0) != 0
|
||||
except subprocess.CalledProcessError:
|
||||
sys.exit(2)
|
||||
finally:
|
||||
lastrun_file.close()
|
||||
|
||||
|
@ -111,4 +113,4 @@ ret = subprocess.call([*puppet_cmd, "--detailed-exitcodes"], env=puppet_env)
|
|||
# ret = 4 => no changes, yes errors
|
||||
# ret = 6 => changes, yes errors
|
||||
if ret != 0 and ret != 2:
|
||||
sys.exit(1)
|
||||
sys.exit(2)
|
||||
|
|
Loading…
Reference in New Issue