]> git.proxmox.com Git - pve-client.git/blobdiff - PVE/APIClient/Config.pm
adopt code for changes in pve-common
[pve-client.git] / PVE / APIClient / Config.pm
index 3878425dfff62ea1eecf558889185f7e25463c2e..5437be656ea1e2588f3d5528b434a0404f4f731e 100644 (file)
@@ -28,14 +28,6 @@ my $complete_remote_name = sub {
     return $list;
 };
 
-PVE::APIClient::JSONSchema::register_standard_option('pveclient-output-format', {
-    type => 'string',
-    description => 'Output format.',
-    enum => [ 'text', 'json' ],
-    optional => 1,
-    default => 'text',
-});
-
 PVE::APIClient::JSONSchema::register_standard_option('pveclient-remote-name', {
     description => "The name of the remote.",
     type => 'string',
@@ -64,6 +56,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) = @_;