From 951aa06963a4832aeb4748a7ed97c0509e962c80 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 3 May 2016 22:43:11 -0400 Subject: [PATCH] nodelist table object should not fetch the attribs in groups This patch intent to fix the undef reference for nodelist temporarily. partial-issue #1011 --- perl-xCAT/xCAT/Table.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index cfbdd6896..43d0c14be 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -2564,7 +2564,7 @@ sub getNodeAttribs_nosub_returnany if(defined{$data}) { #if there was some data for the node, loop through and check it foreach $result (@results) { foreach $attrib (keys %attribsToDo) { - if (defined($result) && defined($result->{$attrib}) + if (defined($result) && defined($result->{$attrib}) && $self->{tabname} ne 'nodelist' && @hierarchy_attrs && grep (/^$attrib$/, @hierarchy_attrs) ) { $result->{$attrib} .= ',+=NEXTRECORD'; } @@ -2580,6 +2580,16 @@ sub getNodeAttribs_nosub_returnany return @results; } + if ($self->{tabname} eq 'nodelist') { + return @results; + } + + # As self->nodelist is a weak reference, if error haddpens, log it. + if (!defined($self->{nodelist})) { + xCAT::MsgUtils->message("S","xcat Table: Unexpected error, nodelist object is undef."); + return undef; + } + #find the groups for this node my ($nodeghash) = $self->{nodelist}->getAttribs({node => $node}, 'groups');