zulip-puppet-apply: Make --force --noop have an exit code.

This commit is contained in:
Alex Vandiver 2022-03-25 16:16:01 -07:00 committed by Tim Abbott
parent c91725bfb5
commit ecfc23bd0b
1 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,12 @@ if not args.noop and not args.force:
if do_apply == "" or do_apply == "n": if do_apply == "" or do_apply == "n":
sys.exit(0) sys.exit(0)
if args.noop and args.force:
if noop_would_change(puppet_cmd):
sys.exit(1)
else:
sys.exit(0)
ret = subprocess.call([*puppet_cmd, "--detailed-exitcodes"], env=puppet_env) ret = subprocess.call([*puppet_cmd, "--detailed-exitcodes"], env=puppet_env)
# ret = 0 => no changes, no errors # ret = 0 => no changes, no errors
# ret = 2 => changes, no errors # ret = 2 => changes, no errors