From 7112eaed3fe5056bd22607c921ac98c83c98c9e0 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 a5a75d23b..e18a5f707 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2464,15 +2464,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); } @@ -2480,8 +2486,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) { @@ -2629,6 +2640,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,