mirror of https://github.com/zulip/zulip.git
puppet: Allow passing an alternate config path to zulip-puppet-apply.
When temporary configuration changes are desired, this lets one set up an alternate `zulip.conf` to apply while leaving the true one in place.
This commit is contained in:
parent
efe2b6e5cd
commit
17002f2a0e
|
@ -2,7 +2,8 @@ module Puppet::Parser::Functions
|
|||
newfunction(:zulipconf, :type => :rvalue) do |args|
|
||||
default = args.pop
|
||||
joined = args.join(" ")
|
||||
output = `/usr/bin/crudini --get /etc/zulip/zulip.conf #{joined} 2>&1`; result=$?.success?
|
||||
zulip_conf_path = lookupvar('zulip_conf_path')
|
||||
output = `/usr/bin/crudini --get #{zulip_conf_path} #{joined} 2>&1`; result=$?.success?
|
||||
if result
|
||||
output.strip()
|
||||
else
|
||||
|
|
|
@ -14,10 +14,13 @@ 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('--config', action="store",
|
||||
default="/etc/zulip/zulip.conf",
|
||||
help="Alternate zulip.conf path")
|
||||
args, extra_args = parser.parse_known_args()
|
||||
|
||||
config = configparser.RawConfigParser()
|
||||
config.read("/etc/zulip/zulip.conf")
|
||||
config.read(args.config)
|
||||
|
||||
distro_info = parse_os_release()
|
||||
puppet_config = """
|
||||
|
@ -35,6 +38,7 @@ puppet_cmd += extra_args
|
|||
|
||||
# Set the scripts path to be a factor so it can be used by puppet code
|
||||
puppet_env = os.environ.copy()
|
||||
puppet_env["FACTER_zulip_conf_path"] = args.config
|
||||
puppet_env["FACTER_zulip_scripts_path"] = scripts_path
|
||||
|
||||
# This is to suppress puppet warnings with ruby 2.7.
|
||||
|
|
Loading…
Reference in New Issue