From fda20c3ade6f94b71b4f1d069b08fe5e3cbfc570 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 8 Jan 2009 21:01:36 +0000 Subject: [PATCH] -Fix problem where explicit nulls were presented subtly differently from implicit nulls git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2585 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 2a3a5ae99..9fe1abc5c 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -7,6 +7,7 @@ #class xcattable package xCAT::Table; use Sys::Syslog; +use Data::Dumper; BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; @@ -1038,6 +1039,10 @@ sub getNodeAttribs foreach $datum (@data) { foreach $attrib (@attribs) { + unless (defined $datum->{$attrib}) { + #skip undefined values, save time + next; + } if ($datum->{$attrib} =~ /^\/.*\/.*\/$/) { @@ -1068,6 +1073,10 @@ sub getNodeAttribs $retval = $node; $retval =~ s/$parts[0]/$parts[1]/; $datum->{$attrib} = $retval; + if ($datum->{$attrib} =~ /^$/) { + #If regex forces a blank, act like a normal blank does + delete $datum->{$attrib}; + } next; #skip the redundancy that follows otherwise } while ($curr) @@ -1098,6 +1107,10 @@ sub getNodeAttribs #print Data::Dumper::Dumper(extract_bracketed($parts[1],'()',qr/[^()]*/)); #use text::balanced extract_bracketed to parse earch atom, make sure nothing but arith operators, parans, and numbers are in it to guard against code execution } + if ($datum->{$attrib} =~ /^$/) { + #If regex forces a blank, act like a normal blank does + delete $datum->{$attrib}; + } } } return wantarray ? @data : $data[0];