]> git.proxmox.com Git - pve-client.git/blobdiff - PVE/APIClient/Config.pm
Use a different path for the lock file
[pve-client.git] / PVE / APIClient / Config.pm
index 3878425dfff62ea1eecf558889185f7e25463c2e..a783ab3870a4f01bdd9fe85988c40c50e3427173 100644 (file)
@@ -64,6 +64,21 @@ sub config_filename {
     return "$dir/config";
 }
 
+sub lock_config {
+    my ($class, $timeout, $code, @param) = @_;
+
+    my $dir = PVE::APIClient::Helpers::configuration_directory();
+    make_path($dir);
+
+    my $filename = "$dir/.config.lck";
+
+    my $res = PVE::APIClient::Tools::lock_file($filename, $timeout, $code, @param);
+
+    die $@ if $@;
+
+    return $res;
+}
+
 sub format_section_header {
     my ($class, $type, $sectionId, $scfg, $done_hash) = @_;