Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: --noop implies --force (i.e. no prompt).

Alex Vandiverc1923e19b096
diff --git a/scripts/lib/install b/scripts/lib/install
index 289b5a2fbee..9a0ae1ca428 100755
--- a/scripts/lib/install
+++ b/scripts/lib/install
@@ -327,7 +327,7 @@ has_class() {
# The home directory here should match what's declared in base.pp.
id -u zulip &>/dev/null || useradd -m zulip --home-dir /home/zulip
if [ -n "$NO_OVERWRITE_SETTINGS" ] && [ -e "/etc/zulip/zulip.conf" ]; then
- "$ZULIP_PATH"/scripts/zulip-puppet-apply --force --noop \
+ "$ZULIP_PATH"/scripts/zulip-puppet-apply --noop \
--write-catalog-summary \
--classfile=/var/lib/puppet/classes.txt \
>/dev/null
@@ -351,7 +351,7 @@ EOF
crudini --set /etc/zulip/zulip.conf postgresql missing_dictionaries true
fi
- "$ZULIP_PATH"/scripts/zulip-puppet-apply --force --noop \
+ "$ZULIP_PATH"/scripts/zulip-puppet-apply --noop \
--write-catalog-summary \
--classfile=/var/lib/puppet/classes.txt \
>/dev/null
diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-apply
index bfc2ae93ff5..60442b64173 100755
--- a/scripts/zulip-puppet-apply
+++ b/scripts/zulip-puppet-apply
@@ -14,6 +14,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
parser = argparse.ArgumentParser(description="Run puppet")
parser.add_argument('--force', '-f', action="store_true",
help="Do not prompt with proposed changes")
+parser.add_argument('--noop', action="store_true",
+ help="Do not apply the changes")
parser.add_argument('--config', action="store",
default="/etc/zulip/zulip.conf",
help="Alternate zulip.conf path")
@@ -34,6 +36,8 @@ for pclass in re.split(r'\s*,\s*', config.get('machine', 'puppet_classes')):
scripts_path = os.path.join(BASE_DIR, "scripts")
puppet_module_path = os.path.join(BASE_DIR, "puppet")
puppet_cmd = ["puppet", "apply", "--modulepath", puppet_module_path, "-e", puppet_config]
+if args.noop:
+ puppet_cmd += ["--noop"]
puppet_cmd += extra_args
# Set the scripts path to be a factor so it can be used by puppet code
@@ -45,7 +49,7 @@ puppet_env["FACTER_zulip_scripts_path"] = scripts_path
if (distro_info['ID'], distro_info['VERSION_ID']) in [('ubuntu', '20.04')]:
puppet_env["RUBYOPT"] = "-W0"
-if not args.force:
+if not args.noop and not args.force:
subprocess.check_call(puppet_cmd + ['--noop', '--show_diff'], env=puppet_env)
do_apply = None