mirror of https://github.com/zulip/zulip.git
puppet: Support IPv6 nameservers.
The syntax in `/etc/resolv.conf` does not include any brackets: ``` nameserver 2001:db8::a3 ``` However, the format of the nginx `resolver` directive[^1] requires that IPv6 addresses be enclosed in brackets. Adjust the `resolver_ip` puppet function to surround any IPv6 addresses extracted from `/etc/resolv.conf` with square brackets, and any addresses from `application_server.resolver` to gain brackets if necessary. Fixes: #26013. [^1]: http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
This commit is contained in:
parent
92ea4a02a1
commit
7ef05316d5
|
@ -6,6 +6,11 @@ Puppet::Functions.create_function(:resolver_ip) do
|
|||
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
|
||||
parsed[:nameserver][0]
|
||||
resolver = parsed[:nameserver][0]
|
||||
if resolver.include?(':')
|
||||
'[' + resolver + ']'
|
||||
else
|
||||
resolver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,6 +78,9 @@ class zulip::app_frontend_base {
|
|||
# This may fail in the unlikely change that there is no configured
|
||||
# resolver in /etc/resolv.conf, so only call it is unset in zulip.conf
|
||||
$nginx_resolver_ip = resolver_ip()
|
||||
} elsif (':' in $configured_nginx_resolver) and ! ('.' in $configured_nginx_resolver) and ! ('[' in $configured_nginx_resolver) {
|
||||
# Assume this is IPv6, which needs square brackets.
|
||||
$nginx_resolver_ip = "[${configured_nginx_resolver}]"
|
||||
} else {
|
||||
$nginx_resolver_ip = $configured_nginx_resolver
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue