From: Dietmar Maurer Date: Thu, 10 Apr 2014 07:42:21 +0000 (+0200) Subject: move assert_if_modified to PVE::Tools X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=a345b9d584c60ec3535270062e105fc05a94d24b;hp=97ffb83b4d00f709e0f8e7d9d8c8c7beb6d8cfdc move assert_if_modified to PVE::Tools --- diff --git a/data/PVE/SectionConfig.pm b/data/PVE/SectionConfig.pm index c338a93..f0bf23f 100644 --- a/data/PVE/SectionConfig.pm +++ b/data/PVE/SectionConfig.pm @@ -428,9 +428,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; diff --git a/data/PVE/Tools.pm b/data/PVE/Tools.pm index 622f8ad..7448183 100644 --- a/data/PVE/Tools.pm +++ b/data/PVE/Tools.pm @@ -998,4 +998,12 @@ sub dir_glob_foreach { } } +sub assert_if_modified { + my ($digest1, $digest2) = @_; + + if ($digest1 && $digest2 && ($digest1 ne $digest2)) { + die "detected modified configuration - file change by other user? Try again.\n"; + } +} + 1;