nixos/unbound: Fix deprecation warnings

This commit is contained in:
Ashish SHUKLA 2023-11-13 08:34:41 +00:00
parent ebb42ada24
commit 61f957f876
No known key found for this signature in database

View file

@ -106,8 +106,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
{ {
name = "."; name = ".";
forward-addr = [ forward-addr = [
(lib.head nodes.authoritative.config.networking.interfaces.eth1.ipv6.addresses).address (lib.head nodes.authoritative.networking.interfaces.eth1.ipv6.addresses).address
(lib.head nodes.authoritative.config.networking.interfaces.eth1.ipv4.addresses).address (lib.head nodes.authoritative.networking.interfaces.eth1.ipv4.addresses).address
]; ];
} }
]; ];
@ -168,8 +168,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
"unbound-extra1.conf".text = '' "unbound-extra1.conf".text = ''
forward-zone: forward-zone:
name: "example.local." name: "example.local."
forward-addr: ${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv6.addresses).address} forward-addr: ${(lib.head nodes.resolver.networking.interfaces.eth1.ipv6.addresses).address}
forward-addr: ${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv4.addresses).address} forward-addr: ${(lib.head nodes.resolver.networking.interfaces.eth1.ipv4.addresses).address}
''; '';
"unbound-extra2.conf".text = '' "unbound-extra2.conf".text = ''
auth-zone: auth-zone:
@ -187,8 +187,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
client = { lib, nodes, ... }: { client = { lib, nodes, ... }: {
imports = [ common ]; imports = [ common ];
networking.nameservers = [ networking.nameservers = [
(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv6.addresses).address (lib.head nodes.resolver.networking.interfaces.eth1.ipv6.addresses).address
(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv4.addresses).address (lib.head nodes.resolver.networking.interfaces.eth1.ipv4.addresses).address
]; ];
networking.interfaces.eth1.ipv4.addresses = [ networking.interfaces.eth1.ipv4.addresses = [
{ address = "192.168.0.10"; prefixLength = 24; } { address = "192.168.0.10"; prefixLength = 24; }
@ -276,7 +276,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
resolver.wait_for_unit("multi-user.target") resolver.wait_for_unit("multi-user.target")
with subtest("client should be able to query the resolver"): with subtest("client should be able to query the resolver"):
test(client, ["${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv6.addresses).address}", "${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv4.addresses).address}"], doh=True) test(client, ["${(lib.head nodes.resolver.networking.interfaces.eth1.ipv6.addresses).address}", "${(lib.head nodes.resolver.networking.interfaces.eth1.ipv4.addresses).address}"], doh=True)
# discard the client we do not need anymore # discard the client we do not need anymore
client.shutdown() client.shutdown()
@ -298,7 +298,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
).strip() ).strip()
# Thank you black! Can't really break this line into a readable version. # Thank you black! Can't really break this line into a readable version.
expected = "example.local. IN forward ${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv6.addresses).address} ${(lib.head nodes.resolver.config.networking.interfaces.eth1.ipv4.addresses).address}" expected = "example.local. IN forward ${(lib.head nodes.resolver.networking.interfaces.eth1.ipv6.addresses).address} ${(lib.head nodes.resolver.networking.interfaces.eth1.ipv4.addresses).address}"
assert out == expected, f"Expected `{expected}` but got `{out}` instead." assert out == expected, f"Expected `{expected}` but got `{out}` instead."
local_resolver.fail("sudo -u unauthorizeduser -- unbound-control list_forwards") local_resolver.fail("sudo -u unauthorizeduser -- unbound-control list_forwards")