prometheus: Unbreak IPv6 listenAddress

The format of the listenAddress option was recently changed to separate
the address and the port parts. There is now a legacy check that
tells users to update to the new format. This legacy check produces
a false positive on IPv6 addresses, since they contain colons.

Fix the regex to make it not match colons within IPv6 addresses.
This commit is contained in:
Kirill Elagin 2020-09-20 17:38:46 -04:00 committed by Bjørn Forsman
parent 799f149bbf
commit a4afd525cb

View file

@ -629,7 +629,9 @@ in {
config = mkIf cfg.enable {
assertions = [
( let
legacy = builtins.match "(.*):(.*)" cfg.listenAddress;
# Match something with dots (an IPv4 address) or something ending in
# a square bracket (an IPv6 addresses) followed by a port number.
legacy = builtins.match "(.*\\..*|.*]):([[:digit:]]+)" cfg.listenAddress;
in {
assertion = legacy == null;
message = ''