]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/SectionConfig.pm
register new standard option pve-config-digest
[pve-common.git] / data / PVE / SectionConfig.pm
index c338a9332d7c71e5b4a3e6c98a072cc2667eec52..5a6dcb1b16cb29c092c07ee979957c09db559c1b 100644 (file)
@@ -84,12 +84,7 @@ sub updateSchema {
        }
     }
 
-    $props->{digest} = {
-       type => 'string',
-       description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
-       maxLength => 40,
-       optional => 1,
-    };
+    $props->{digest} = get_standard_option('pve-config-digest');
 
     $props->{delete} = {
        type => 'string', format => 'pve-configid-list',
@@ -428,9 +423,7 @@ sub write_config {
 sub assert_if_modified {
     my ($cfg, $digest) = @_;
 
-    if ($digest && ($cfg->{digest} ne $digest)) {
-       die "detected modified configuration - file change by other user? Try again.\n";
-    }
+    PVE::Tools::assert_if_modified($cfg->{digest}, $digest);
 }
 
 1;