From fd47f6296e209ed594318eed34d7adb7328cbe57 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Tue, 31 Jan 2023 12:40:13 -0500 Subject: [PATCH] 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." --- scripts/zulip-puppet-apply | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-apply index a1ffc356d5..b6238ef856 100755 --- a/scripts/zulip-puppet-apply +++ b/scripts/zulip-puppet-apply @@ -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)