From cd6b41903790bebdcfda8f4c77313b0fdad55c86 Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 18 Nov 2008 18:07:46 +0000 Subject: [PATCH] fix chdef -m option. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2504 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 12 ++++++++++++ xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 6 +----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 380d1a84f..68b6a6279 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -765,6 +765,9 @@ sub setobjdefs # get the object type decription from Schema.pm my $datatype = $xCAT::Schema::defspec{$type}; + # get the key to look for, for this object type + my $objkey = $datatype->{'objkey'}; + # get a list of valid attr names # for this type object my %attrlist; @@ -779,6 +782,11 @@ sub setobjdefs foreach my $attr (keys %{$objhash{$objname}}) { + if ($attr eq $objkey) + { + next; + } + if ($attr eq "objtype") { @@ -818,6 +826,10 @@ sub setobjdefs my ($lookup_table, $lookup_attr); my $attr_name = $this_attr->{attr_name}; + if ($attr_name eq $objkey) + { + next; + } # if we have a value for this attribute then process it # - otherwise go to the next attr diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index cd34deee7..921f69ce2 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2456,10 +2456,6 @@ sub defls { $attrval = $defhash{$obj}{$showattr}; } - else - { - $attrval = " "; - } # if an attr list was provided then just display those if ($::opt_i) @@ -2513,7 +2509,7 @@ sub defls { # don't print unless set - if ( (defined $attrval) && ($attrval ne " ")) + if ($attrval) { my $rsp; $rsp->{data}->[0] =