-Provide graceful error when tabrestore has an unrecognized column defined

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4147 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-09-16 15:38:40 +00:00
parent 1e9bd8b240
commit 4c8c4ff701

View File

@ -289,6 +289,15 @@ sub tabrestore
$header =~ s/^#//;
$header =~ s/\s+$//;
my @colns = split(/,/, $header);
my $tcol;
foreach $tcol (@colns) { #validate the restore data has no invalid column names
unless (grep /^$tcol\z/,@{$xCAT::Schema::tabspec{$table}->{cols}}) {
$cb->({error => "The header line indicates that column '$tcol' should exist, which is not defined in the schema for '$table'",errorcode=>1});
return;
}
print Dumper(grep /^$tcol\z/,@{$xCAT::Schema::tabspec{$table}->{cols}});
}
print "We passed it!\n";
my $line;
my $rollback = 0;