use Encode;
my $hostfw_conf_filename = "/etc/pve/local/host.fw";
-my $clusterfw_conf_filename = "/etc/pve/firewall/cluster.fw";
+my $pvefw_conf_dir = "/etc/pve/firewall";
+my $clusterfw_conf_filename = "$pvefw_conf_dir/cluster.fw";
# dynamically include PVE::QemuServer and PVE::OpenVZ
# to avoid dependency problems
my $vmfw_conf = {};
- $dir = "/etc/pve/firewall" if !defined($dir);
+ $dir = $pvefw_conf_dir if !defined($dir);
my $filename = "$dir/$vmid.fw";
if (my $fh = IO::File->new($filename, O_RDONLY)) {
$raw .= "\n";
}
- my $filename = "/etc/pve/firewall/$vmid.fw";
+ mkdir $pvefw_conf_dir;
+
+ my $filename = "$pvefw_conf_dir/$vmid.fw";
PVE::Tools::file_set_contents($filename, $raw);
}
}
}
+ mkdir $pvefw_conf_dir;
PVE::Tools::file_set_contents($clusterfw_conf_filename, $raw);
}