-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
This commit is contained in:
jbjohnso 2008-02-04 16:34:45 +00:00
parent e452d1d7b0
commit ca5a8e36f0
2 changed files with 19 additions and 1 deletions

View File

@ -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;
}

View File

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