versioning and compatibility check for default configuration file
This commit is contained in:
parent
bc2f8bd4e9
commit
293d83bdaa
12
sanoid
12
sanoid
|
@ -5,6 +5,7 @@
|
|||
# project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE.
|
||||
|
||||
$::VERSION = '1.4.17';
|
||||
my $MINIMUM_DEFAULTS_VERSION = 2;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -568,6 +569,17 @@ sub init {
|
|||
my @istrue=(1,"true","True","TRUE","yes","Yes","YES","on","On","ON");
|
||||
my @isfalse=(0,"false","False","FALSE","no","No","NO","off","Off","OFF");
|
||||
|
||||
# check if default configuration file is up to date
|
||||
my $defaults_version = 1;
|
||||
if (defined $defaults{'version'}{'version'}) {
|
||||
$defaults_version = $defaults{'version'}{'version'};
|
||||
delete $defaults{'version'};
|
||||
}
|
||||
|
||||
if ($defaults_version < $MINIMUM_DEFAULTS_VERSION) {
|
||||
die "FATAL: you're using sanoid.defaults.conf v$defaults_version, this version of sanoid requires a minimum sanoid.defaults.conf v$MINIMUM_DEFAULTS_VERSION";
|
||||
}
|
||||
|
||||
foreach my $section (keys %ini) {
|
||||
|
||||
# first up - die with honor if unknown parameters are set in any modules or templates by the user.
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# #
|
||||
# you have been warned. #
|
||||
###################################################################################
|
||||
[version]
|
||||
version = 2
|
||||
|
||||
[template_default]
|
||||
|
||||
|
|
Loading…
Reference in New Issue