From: Stefan Lendl Date: Fri, 5 Apr 2024 13:18:00 +0000 (+0200) Subject: sdn: dnsmasq: extract function that generates the ethers file path X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=23e7fe3197145e8ba5702ff832df11389a3a1f6a;p=matthieu%2Fpve-network.git 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 Reviewed-by: Max Carrara Tested-by: Max Carrara Reviewed-by: Stefan Hanreich Tested-by: Stefan Hanreich --- diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm index f9f1c39..5a227ba 100644 --- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm +++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm @@ -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;