From 024d4735a2894915bb36e9926fa0d0af26c2beee Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Feb 2009 23:52:00 +0000 Subject: [PATCH] fix 1.7 -> 1.9 config upgrade for new "image" config type --- FS/FS/Conf.pm | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 39ab389e7..8c5b296e0 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -334,7 +334,7 @@ sub import_config_item { warn "Inserting $key\n" if $DEBUG; local $/; my $value = readline(new IO::File "$dir/$key"); - if ($item->type eq 'binary') { + if ($item->type =~ /^(binary|image)$/ ) { $self->set_binary($key, $value); }else{ $self->set($key, $value); @@ -363,7 +363,8 @@ sub verify_config_item { $error .= "$key fails existential comparison; " if $self->exists($key) xor $compat->exists($key); - unless ($type eq 'binary') { + if ( $type !~ /^(binary|image)$/ ) { + { no warnings; $error .= "$key fails scalar comparison; " @@ -380,22 +381,24 @@ sub verify_config_item { $error .= "$key fails list comparison; " unless $r; } - } - if ($type eq 'binary') { + } else { + $error .= "$key fails binary comparison; " unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key)); - } - if ($error =~ /existential comparison/ && $item->section eq 'deprecated') { - my $proto; - for ( @config_items ) { $proto = $_; last if $proto->key eq $key; } - unless ($proto->key eq $key) { - warn "removed config item $error\n" if $DEBUG; - $error = ''; - } } +#remove deprecated config on our own terms, not freeside-upgrade's +# if ($error =~ /existential comparison/ && $item->section eq 'deprecated') { +# my $proto; +# for ( @config_items ) { $proto = $_; last if $proto->key eq $key; } +# unless ($proto->key eq $key) { +# warn "removed config item $error\n" if $DEBUG; +# $error = ''; +# } +# } + $error; } @@ -479,7 +482,7 @@ sub config_items { =item init-config DIR -Imports the non-deprecated configuration items from DIR (1.7 compatible) +Imports the configuration items from DIR (1.7 compatible) to conf records in the database. =cut -- 2.11.0