Extracted to a function so it can be mocked in tests. Signed-off-by: Stefan Lendl <s.le...@proxmox.com> Reviewed-by: Max Carrara <m.carr...@proxmox.com> Tested-by: Max Carrara <m.carr...@proxmox.com> --- src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
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; -- 2.44.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel