puppet: Make zulipconf() understand coercion to bool.

If the default is a bool, coerce the value into a bool as well.  For
backwards compatibility, this does not adjust any existing callsites.

`queue_workers_multiprocess` is the only setting which is passed a
bool default, but it was already documented to take `true` or `false`;
simplify it to no longer add the now-unnecessary Boolean conversion.

(cherry picked from part of commit 2c5fc1827c)
This commit is contained in:
Alex Vandiver
2022-01-05 10:45:12 -08:00
committed by Tim Abbott
parent 868180a25d
commit cb24f93bba
2 changed files with 7 additions and 2 deletions

View File

@@ -5,7 +5,12 @@ module Puppet::Parser::Functions
zulip_conf_path = lookupvar("zulip_conf_path")
output = `/usr/bin/crudini --get #{zulip_conf_path} #{joined} 2>&1`; result = $?.success?
if result
output.strip()
if [true, false].include? default
# If the default is a bool, coerce into a bool
['1','y','t','true','yes','enable','enabled'].include? output.strip.downcase
else
output.strip
end
else
default
end

View File

@@ -73,7 +73,7 @@ class zulip::app_frontend_base {
# multiprocess. Multiprocess scales much better, but requires more
# RAM; we just auto-detect based on available system RAM.
$queues_multiprocess_default = $zulip::common::total_memory_mb > 3500
$queues_multiprocess = Boolean(zulipconf('application_server', 'queue_workers_multiprocess', $queues_multiprocess_default))
$queues_multiprocess = zulipconf('application_server', 'queue_workers_multiprocess', $queues_multiprocess_default)
$queues = [
'deferred_work',
'digest_emails',