From b9d2723e866f984afa5774f1edefad7f0a3039a5 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 28 Apr 2014 22:13:31 -0700 Subject: [PATCH] fix bug 3934: mkdef/chdef -u needs better doc and 1 fix --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 34 ++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e97670de3..b9c2f3364 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2468,15 +2468,21 @@ sub defch # give results my $rsp; - $rsp->{data}->[0] = - "The database was updated for the following objects:"; - xCAT::MsgUtils->message("I", $rsp, $::callback); + my $nodenum = scalar(keys %::FINALATTRS); + if ($nodenum) { + $rsp->{data}->[0] = + "The database was updated for the following objects:"; + xCAT::MsgUtils->message("I", $rsp, $::callback); - my $n = 1; - foreach my $o (sort(keys %::FINALATTRS)) - { - $rsp->{data}->[$n] = "$o\n"; - $n++; + my $n = 1; + foreach my $o (sort(keys %::FINALATTRS)) + { + $rsp->{data}->[$n] = "$o\n"; + $n++; + } + } else { + $rsp->{data}->[0] = + "No database was updated"; } xCAT::MsgUtils->message("I", $rsp, $::callback); } @@ -2484,8 +2490,13 @@ sub defch { my $rsp; my $nodenum = scalar(keys %::FINALATTRS); - $rsp->{data}->[0] = - "$nodenum object definitions have been created or modified."; + if ($nodenum) { + $rsp->{data}->[0] = + "$nodenum object definitions have been created or modified."; + } else { + $rsp->{data}->[0] = + "No object definitions have been created or modified."; + } xCAT::MsgUtils->message("I", $rsp, $::callback); if (scalar(keys %newobjects) > 0) { @@ -2633,6 +2644,9 @@ sub setFINALattrs { # special case for the nic* attributes # merge nic*.eth0, nic*.eth1 + unless(exists($::CLIATTRS{$objname})) { + next; + } if ($::CLIATTRS{$objname}{objtype} eq 'node') { # Even if only the nicips.eth0 is specified with CLI,