sdn: dnsmasq: extract function that generates the ethers file path

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>
This commit is contained in:
Stefan Lendl 2024-04-05 15:18:00 +02:00 committed by Thomas Lamprecht
parent cac88dfa47
commit 23e7fe3197

View 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;