]> git.proxmox.com Git - pve-network.git/commitdiff
sdn: dnsmasq: extract function that generates the ethers file path
authorStefan Lendl <s.lendl@proxmox.com>
Fri, 5 Apr 2024 13:18:00 +0000 (15:18 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 8 Apr 2024 15:57:18 +0000 (17:57 +0200)
Extracted to a function so it can be mocked in tests.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
src/PVE/Network/SDN/Dhcp/Dnsmasq.pm

index f9f1c399f94be1655d06cb8aa1aae4be0d8152d7..5a227ba015d74eb6ab950f92d5c862121f72e1a7 100644 (file)
@@ -33,10 +33,15 @@ my sub assert_dnsmasq_installed {
     return 1;
 }
 
+sub ethers_file {
+    my ($dhcpid) = @_;
+    return "$DNSMASQ_CONFIG_ROOT/$dhcpid/ethers";
+}
+
 sub add_ip_mapping {
     my ($class, $dhcpid, $macdb, $mac, $ip4, $ip6) = @_;
 
-    my $ethers_file = "$DNSMASQ_CONFIG_ROOT/$dhcpid/ethers";
+    my $ethers_file = ethers_file($dhcpid);
     my $ethers_tmp_file = "$ethers_file.tmp";
 
     my $reload = undef;