From b2debb322d8edfeb19e6c06ae94a6b0256fbd040 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 14 Jan 2009 14:41:38 +0000 Subject: [PATCH] -Fix problem with the noderes sample -Provide sane error when a csv has unrecognized columns, TODO: option to drop unrecognized column on restore git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2598 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/tabutils.pm | 4 ++++ xCAT/templates/e1350/noderes.csv | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 91cd61e61..3a5e69e3b 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -266,6 +266,10 @@ sub tabrestore } $tab->delEntries(); #Yes, delete *all* entries my $header = shift @{$request->{data}}; + unless ($header =~ /^#/) { + $cb->({error => "Data missing header line starting with #",errorcode=>1}); + return; + } $header =~ s/"//g; #Strip " from overzealous CSV apps $header =~ s/^#//; $header =~ s/\s+$//; diff --git a/xCAT/templates/e1350/noderes.csv b/xCAT/templates/e1350/noderes.csv index 5decd5b90..3ebe4ee66 100644 --- a/xCAT/templates/e1350/noderes.csv +++ b/xCAT/templates/e1350/noderes.csv @@ -1,2 +1,2 @@ -#node,servicenode,netboot,tftpserver,nfsserver,kernel,initrd,kcmdline,nfsdir,serialport,installnic,primarynic,xcatmaster,current_osimage,next_osimage,comments,disable +#node,servicenode,netboot,tftpserver,nfsserver,nfsdir,installnic,primarynic,xcatmaster,current_osimage,next_osimage,comments,disable "compute",,pxe,,