]>
git.proxmox.com Git - pve-firewall.git/blob - src/PVE/Firewall/Helpers.pm
3112ebcfef36d57303850e4892da25fd24d743d0
1 package PVE
::Firewall
::Helpers
;
6 use PVE
::Tools
qw(file_get_contents file_set_contents);
14 my $pvefw_conf_dir = "/etc/pve/firewall";
16 sub remove_vmfw_conf
{
19 my $vmfw_conffile = "$pvefw_conf_dir/$vmid.fw";
21 unlink $vmfw_conffile;
25 my ($vmid, $newid) = @_;
27 my $sourcevm_conffile = "$pvefw_conf_dir/$vmid.fw";
28 my $clonevm_conffile = "$pvefw_conf_dir/$newid.fw";
30 lock_vmfw_conf
($newid, 10, sub {
31 if (-f
$clonevm_conffile) {
32 unlink $clonevm_conffile;
34 if (-f
$sourcevm_conffile) {
35 my $data = file_get_contents
($sourcevm_conffile);
36 file_set_contents
($clonevm_conffile, $data);