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];