puppet: add zulipconf function for reading settings from zulip.conf.

This makes it convenient for us to have optional user-defined settings
in the main Zulip puppet configuration.
This commit is contained in:
Tim Abbott 2016-07-30 19:48:46 -07:00
parent 98ae0516d2
commit 63c757eac3
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,12 @@
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?
if result
output
else
default
end
end
end

View File

@ -19,7 +19,7 @@ VIRTUALENV_NEEDED="${VIRTUALENV_NEEDED:-yes}"
apt-get update apt-get update
apt-get -y dist-upgrade $APT_OPTIONS apt-get -y dist-upgrade $APT_OPTIONS
apt-get install -y puppet git python python-six $ADDITIONAL_PACKAGES apt-get install -y puppet git python python-six crudini $ADDITIONAL_PACKAGES
# Create and activate a virtualenv # Create and activate a virtualenv
if [ "$VIRTUALENV_NEEDED" = "yes" ]; then if [ "$VIRTUALENV_NEEDED" = "yes" ]; then