From f69c8fbda1d08fb3ddbc995a2871382fa763e079 Mon Sep 17 00:00:00 2001 From: nott Date: Mon, 28 Jan 2008 13:06:39 +0000 Subject: [PATCH] Use the correct key value when the getting info from the DB. It is not always "node" even when the type of object is "node". git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@335 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/DBobjUtils.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/DBobjUtils.pm b/perl-xCAT-2.0/xCAT/DBobjUtils.pm index 8afd50026..9d8e0ff2c 100644 --- a/perl-xCAT-2.0/xCAT/DBobjUtils.pm +++ b/perl-xCAT-2.0/xCAT/DBobjUtils.pm @@ -207,7 +207,7 @@ sub getobjdefs my $attr = $this_attr->{attr_name}; # skip the key attr ??? - if ($attr eq $objkey) + if ($attr eq $objkey) { next; } @@ -225,7 +225,6 @@ sub getobjdefs # if the object value is not the value we need # to match then try the next only_if value - # ndebug next if ( !grep(/$check_value/, $objhash{$objname}{$check_attr})); @@ -294,8 +293,7 @@ sub getobjdefs # attr val is defined if (ref($ent) and defined $ent->{$tabattr}) { - $objhash{$objname}{$attr} = $ent->{$tabattr}; - + $objhash{$objname}{$attr} = $ent->{$tabattr}; } $thistable->commit; @@ -307,7 +305,6 @@ sub getobjdefs { # look up attr values - my @rows = xCAT::DBobjUtils->getDBtable($lookup_table); if (defined(@rows)) { @@ -315,10 +312,11 @@ sub getobjdefs foreach (@rows) { - if ($_->{$objkey} eq $objname) + + if ($_->{$lookup_attr} eq $objname) { - $objhash{$objname}{$attr} = $_->{$tabattr}; + $objhash{$objname}{$attr} = $_->{$tabattr}; } } }