mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
puppet: --noop implies --force (i.e. no prompt).
The combination of `--force --noop` is potentially confusing, but currently `--noop` makes no sense without `--force`, as it will prompt and then not make changes. Make `--noop` skip the prompt as well.
This commit is contained in:
committed by
Tim Abbott
parent
b3ae3d6de9
commit
c1923e19b0
@@ -327,7 +327,7 @@ has_class() {
|
|||||||
# The home directory here should match what's declared in base.pp.
|
# The home directory here should match what's declared in base.pp.
|
||||||
id -u zulip &>/dev/null || useradd -m zulip --home-dir /home/zulip
|
id -u zulip &>/dev/null || useradd -m zulip --home-dir /home/zulip
|
||||||
if [ -n "$NO_OVERWRITE_SETTINGS" ] && [ -e "/etc/zulip/zulip.conf" ]; then
|
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 \
|
--write-catalog-summary \
|
||||||
--classfile=/var/lib/puppet/classes.txt \
|
--classfile=/var/lib/puppet/classes.txt \
|
||||||
>/dev/null
|
>/dev/null
|
||||||
@@ -351,7 +351,7 @@ EOF
|
|||||||
crudini --set /etc/zulip/zulip.conf postgresql missing_dictionaries true
|
crudini --set /etc/zulip/zulip.conf postgresql missing_dictionaries true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$ZULIP_PATH"/scripts/zulip-puppet-apply --force --noop \
|
"$ZULIP_PATH"/scripts/zulip-puppet-apply --noop \
|
||||||
--write-catalog-summary \
|
--write-catalog-summary \
|
||||||
--classfile=/var/lib/puppet/classes.txt \
|
--classfile=/var/lib/puppet/classes.txt \
|
||||||
>/dev/null
|
>/dev/null
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||||||
parser = argparse.ArgumentParser(description="Run puppet")
|
parser = argparse.ArgumentParser(description="Run puppet")
|
||||||
parser.add_argument('--force', '-f', action="store_true",
|
parser.add_argument('--force', '-f', action="store_true",
|
||||||
help="Do not prompt with proposed changes")
|
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",
|
parser.add_argument('--config', action="store",
|
||||||
default="/etc/zulip/zulip.conf",
|
default="/etc/zulip/zulip.conf",
|
||||||
help="Alternate zulip.conf path")
|
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")
|
scripts_path = os.path.join(BASE_DIR, "scripts")
|
||||||
puppet_module_path = os.path.join(BASE_DIR, "puppet")
|
puppet_module_path = os.path.join(BASE_DIR, "puppet")
|
||||||
puppet_cmd = ["puppet", "apply", "--modulepath", puppet_module_path, "-e", puppet_config]
|
puppet_cmd = ["puppet", "apply", "--modulepath", puppet_module_path, "-e", puppet_config]
|
||||||
|
if args.noop:
|
||||||
|
puppet_cmd += ["--noop"]
|
||||||
puppet_cmd += extra_args
|
puppet_cmd += extra_args
|
||||||
|
|
||||||
# Set the scripts path to be a factor so it can be used by puppet code
|
# 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')]:
|
if (distro_info['ID'], distro_info['VERSION_ID']) in [('ubuntu', '20.04')]:
|
||||||
puppet_env["RUBYOPT"] = "-W0"
|
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)
|
subprocess.check_call(puppet_cmd + ['--noop', '--show_diff'], env=puppet_env)
|
||||||
|
|
||||||
do_apply = None
|
do_apply = None
|
||||||
|
|||||||
Reference in New Issue
Block a user