snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
25
puppet/zulip/lib/facter/container_memory_limit.rb
Normal file
25
puppet/zulip/lib/facter/container_memory_limit.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
Facter.add(:container_memory_limit_mb) do
|
||||
confine kernel: 'Linux'
|
||||
|
||||
setcode do
|
||||
begin
|
||||
memory_limit_mb = nil
|
||||
|
||||
# Check for cgroup v2
|
||||
if File.exist?('/sys/fs/cgroup/memory.max')
|
||||
val = File.read('/sys/fs/cgroup/memory.max').strip
|
||||
memory_limit_mb = val.to_i / 1024 / 1024 unless val == 'max'
|
||||
|
||||
# Fallback to cgroup v1
|
||||
elsif File.exist?('/sys/fs/cgroup/memory/memory.limit_in_bytes')
|
||||
val = File.read('/sys/fs/cgroup/memory/memory.limit_in_bytes').strip.to_i
|
||||
memory_limit_mb = val / 1024 / 1024 if val < 9223372036854771712
|
||||
end
|
||||
|
||||
memory_limit_mb
|
||||
rescue => e
|
||||
Facter.debug("container_memory_limit_mb error: #{e}")
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
16
puppet/zulip/lib/facter/io_uring_available.rb
Normal file
16
puppet/zulip/lib/facter/io_uring_available.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
Facter.add(:io_uring_available) do
|
||||
confine :kernel => 'Linux'
|
||||
setcode do
|
||||
# Syscall 425 is io_uring_setup
|
||||
# https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/#x86_64_425
|
||||
# https://manpages.debian.org/trixie/liburing-dev/io_uring_setup.2.en.html
|
||||
#
|
||||
# We get ENOSYS if the kernel doesn't have the syscall, or EPERM
|
||||
# if it's disabled or restricted via seccomp (i.e. in Docker)
|
||||
result = Facter::Core::Execution.execute(
|
||||
"perl -MErrno=EPERM,ENOSYS -e 'syscall(425); exit((\$! != EPERM and \$! != ENOSYS) ? 0 : 1)'",
|
||||
:on_fail => :failed
|
||||
)
|
||||
result != :failed && $?.success?
|
||||
end
|
||||
end
|
||||
17
puppet/zulip/lib/facter/zulip_version.rb
Normal file
17
puppet/zulip/lib/facter/zulip_version.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
require "open3"
|
||||
|
||||
Facter.add(:zulip_version) do
|
||||
setcode do
|
||||
Dir.chdir(File.expand_path("../../../../", __dir__)) do
|
||||
output, stderr, status = Open3.capture3(
|
||||
"python3", "-c", "import version; print(version.ZULIP_VERSION_WITHOUT_COMMIT)"
|
||||
)
|
||||
if not status.success?
|
||||
Facter.debug("zulip_version error: #{stderr}")
|
||||
nil
|
||||
else
|
||||
output.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
27
puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb
Normal file
27
puppet/zulip/lib/puppet/functions/get_django_setting_slow.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require "open3"
|
||||
|
||||
# Note that this is very slow (~350ms) and may get values which will
|
||||
# rapidly go out of date, since settings are changed much more
|
||||
# frequently than deploys -- in addition to potentially just not
|
||||
# working if we're not on the application server. We should generally
|
||||
# avoid using this if at all possible.
|
||||
|
||||
Puppet::Functions.create_function(:get_django_setting_slow) do
|
||||
def get_django_setting_slow(name)
|
||||
return nil unless File.exist?("/etc/zulip/settings.py")
|
||||
if Dir.exist?("/home/zulip/deployments/current")
|
||||
deploy_dir = "current"
|
||||
elsif Dir.exist?("/home/zulip/deployments/next")
|
||||
# First puppet runs during install don't have a "current" yet, only a "next"
|
||||
deploy_dir = "next"
|
||||
else
|
||||
return nil
|
||||
end
|
||||
output, _stderr, status = Open3.capture3("/home/zulip/deployments/#{deploy_dir}/scripts/get-django-setting", name)
|
||||
if status.success?
|
||||
output.strip
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
16
puppet/zulip/lib/puppet/functions/resolver_ip.rb
Normal file
16
puppet/zulip/lib/puppet/functions/resolver_ip.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
require "resolv"
|
||||
|
||||
Puppet::Functions.create_function(:resolver_ip) do
|
||||
def resolver_ip()
|
||||
parsed = Resolv::DNS::Config.default_config_hash()
|
||||
if parsed[:nameserver].empty?
|
||||
raise 'No nameservers found in /etc/resolv.conf! Configure one by setting application_server.nameserver in /etc/zulip/zulip.conf'
|
||||
end
|
||||
resolver = parsed[:nameserver][0]
|
||||
if resolver.include?(':')
|
||||
'[' + resolver + ']'
|
||||
else
|
||||
resolver
|
||||
end
|
||||
end
|
||||
end
|
||||
19
puppet/zulip/lib/puppet/functions/zulipconf.rb
Normal file
19
puppet/zulip/lib/puppet/functions/zulipconf.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require "open3"
|
||||
|
||||
Puppet::Functions.create_function(:zulipconf) do
|
||||
def zulipconf(section, key, default)
|
||||
zulip_conf_path = Facter.value("zulip_conf_path")
|
||||
output, _stderr, status = Open3.capture3("/usr/bin/crudini", "--get", "--", zulip_conf_path, section, key)
|
||||
if status.success?
|
||||
if [true, false].include? default
|
||||
# If the default is a bool, coerce into a bool. This list is also
|
||||
# maintained in scripts/lib/zulip_tools.py
|
||||
["1", "y", "t", "true", "yes", "enable", "enabled"].include? output.strip.downcase
|
||||
else
|
||||
output.strip
|
||||
end
|
||||
else
|
||||
default
|
||||
end
|
||||
end
|
||||
end
|
||||
13
puppet/zulip/lib/puppet/functions/zulipconf_keys.rb
Normal file
13
puppet/zulip/lib/puppet/functions/zulipconf_keys.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
require "open3"
|
||||
|
||||
Puppet::Functions.create_function(:zulipconf_keys) do
|
||||
def zulipconf_keys(section)
|
||||
zulip_conf_path = Facter.value("zulip_conf_path")
|
||||
output, _stderr, status = Open3.capture3("/usr/bin/crudini", "--get", "--", zulip_conf_path, section)
|
||||
if status.success?
|
||||
return output.lines.map { |l| l.strip }
|
||||
else
|
||||
return []
|
||||
end
|
||||
end
|
||||
end
|
||||
23
puppet/zulip/lib/puppet/functions/zulipconf_nagios_hosts.rb
Normal file
23
puppet/zulip/lib/puppet/functions/zulipconf_nagios_hosts.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require "open3"
|
||||
|
||||
Puppet::Functions.create_function(:zulipconf_nagios_hosts) do
|
||||
def zulipconf_nagios_hosts
|
||||
section = "nagios"
|
||||
prefix = "hosts_"
|
||||
zulip_conf_path = Facter.value("zulip_conf_path")
|
||||
keys, _stderr, status = Open3.capture3("/usr/bin/crudini", "--get", "--", zulip_conf_path, section)
|
||||
if status.success?
|
||||
filtered_keys = keys.lines.map { |l| l.strip }.select { |l| l.start_with?(prefix) }
|
||||
all_values = []
|
||||
filtered_keys.each do |key|
|
||||
values, _stderr, success = Open3.capture3("/usr/bin/crudini", "--get", "--", zulip_conf_path, section, key)
|
||||
if status.success?
|
||||
all_values += values.strip.split(/,\s*/)
|
||||
end
|
||||
end
|
||||
return all_values
|
||||
else
|
||||
return []
|
||||
end
|
||||
end
|
||||
end
|
||||
12
puppet/zulip/lib/puppet/functions/zulipsecret.rb
Normal file
12
puppet/zulip/lib/puppet/functions/zulipsecret.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
require "open3"
|
||||
|
||||
Puppet::Functions.create_function(:zulipsecret) do
|
||||
def zulipsecret(section, key, default)
|
||||
output, _stderr, status = Open3::capture3("/usr/bin/crudini", "--get", "--", "/etc/zulip/zulip-secrets.conf", section, key)
|
||||
if status.success?
|
||||
output.strip()
|
||||
else
|
||||
default
|
||||
end
|
||||
end
|
||||
end
|
||||
21
puppet/zulip/lib/puppet/type/apache2conf.rb
Normal file
21
puppet/zulip/lib/puppet/type/apache2conf.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
Puppet::Type.newtype(:apache2conf) do
|
||||
ensurable
|
||||
newparam(:name) do
|
||||
desc "The name of the conf to enable"
|
||||
isnamevar
|
||||
end
|
||||
end
|
||||
|
||||
Puppet::Type.type(:apache2conf).provide(:apache2conf) do
|
||||
def exists?
|
||||
File.exists?("/etc/apache2/conf-enabled/" + resource[:name] + ".conf")
|
||||
end
|
||||
|
||||
def create
|
||||
system("a2enconf #{@resource[:name]}")
|
||||
end
|
||||
|
||||
def destroy
|
||||
system("a2disconf #{@resource[:name]}")
|
||||
end
|
||||
end
|
||||
21
puppet/zulip/lib/puppet/type/apache2mod.rb
Normal file
21
puppet/zulip/lib/puppet/type/apache2mod.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
Puppet::Type.newtype(:apache2mod) do
|
||||
ensurable
|
||||
newparam(:name) do
|
||||
desc "The name of the module to enable"
|
||||
isnamevar
|
||||
end
|
||||
end
|
||||
|
||||
Puppet::Type.type(:apache2mod).provide(:apache2mod) do
|
||||
def exists?
|
||||
File.exists?("/etc/apache2/mods-enabled/" + resource[:name] + ".load")
|
||||
end
|
||||
|
||||
def create
|
||||
system("a2enmod #{@resource[:name]}")
|
||||
end
|
||||
|
||||
def destroy
|
||||
system("a2dismod #{@resource[:name]}")
|
||||
end
|
||||
end
|
||||
21
puppet/zulip/lib/puppet/type/apache2site.rb
Normal file
21
puppet/zulip/lib/puppet/type/apache2site.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
Puppet::Type.newtype(:apache2site) do
|
||||
ensurable
|
||||
newparam(:name) do
|
||||
desc "The name of the site to enable"
|
||||
isnamevar
|
||||
end
|
||||
end
|
||||
|
||||
Puppet::Type.type(:apache2site).provide(:apache2site) do
|
||||
def exists?
|
||||
File.exists?("/etc/apache2/sites-enabled/" + resource[:name] + ".conf")
|
||||
end
|
||||
|
||||
def create
|
||||
system("a2ensite #{@resource[:name]}")
|
||||
end
|
||||
|
||||
def destroy
|
||||
system("a2ensite #{@resource[:name]}")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user