From ca5a8e36f07a7387cd49636ba66e625b86d1628d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 4 Feb 2008 16:34:45 +0000 Subject: [PATCH] -Stop-gap band-aid to have blade set XCATCFG for non-default operation -Have Table attempt to fill in 'missing' columns for a result before returning undef, restoring intended behavior -Have getAttribs return a single entry or an array depending on calling context git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@381 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Table.pm | 8 +++++++- xCAT-server-2.0/share/xcat/cons/blade | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/perl-xCAT-2.0/xCAT/Table.pm b/perl-xCAT-2.0/xCAT/Table.pm index 745c8ba63..95d17e238 100644 --- a/perl-xCAT-2.0/xCAT/Table.pm +++ b/perl-xCAT-2.0/xCAT/Table.pm @@ -994,6 +994,12 @@ sub getNodeAttribs_nosub { $return = 1; $datum->{$_} = $tent->{$_}; + } else { #attempt to fill in gapped attributes + my $sent = $self->getNodeAttribs_nosub_returnany($node, [$_]); + if ($sent and defined($sent->{$_})) { + $return = 1; + $datum->{$_} = $sent->{$_}; + } } } push(@data,$datum); @@ -1484,7 +1490,7 @@ sub getAttribs $query->finish(); if (@return) { - return @return; + return wantarray ? @return : $return[0]; } return undef; } diff --git a/xCAT-server-2.0/share/xcat/cons/blade b/xCAT-server-2.0/share/xcat/cons/blade index a1b74a4f1..dfb7cbbaa 100755 --- a/xCAT-server-2.0/share/xcat/cons/blade +++ b/xCAT-server-2.0/share/xcat/cons/blade @@ -5,6 +5,18 @@ BEGIN $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; } use lib "$::XCATROOT/lib/perl"; +my $xcatcfg; +open($xcatcfg,"<","/etc/sysconfig/xcat"); +while (<$xcatcfg>) { + if (/^\s*XCATCFG/) { + (my $jnk,$ENV{XCATCFG})=split /=/,$_,2; + chomp($ENV{XCATCFG}); + $ENV{XCATCFG} =~ s/^'//; + $ENV{XCATCFG} =~ s/'$//; + last; + } +} +close($xcatcfg); use xCAT::Table; use File::Basename;