diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 5e0f04abb..c6bab0dbe 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -3818,7 +3818,6 @@ sub defrm # the memberlist nodes must be updated. my $numobjects = 0; - my $numobjects_not_removed = 0; my %objTypeLists; foreach my $obj (keys %objhash) { @@ -3832,7 +3831,9 @@ sub defrm my $rsp; $rsp->{data}->[0] = "Could not find an object named \'$obj\' of type \'$objtype\'."; xCAT::MsgUtils->message("E", $rsp, $::callback); - $numobjects_not_removed++; + # Remove the object we could not find from the hash, this way the count of the objects + # and the content of the hash (for the verbose option), can be used for printing results at the end + delete($objhash{$obj}); next; } $numobjects++; @@ -3850,7 +3851,6 @@ sub defrm my $rsp; $rsp->{data}->[0] = "Could not get xCAT object definition for \'$obj\'."; xCAT::MsgUtils->message("I", $rsp, $::callback); - $numobjects_not_removed++; next; } @@ -3890,7 +3890,6 @@ sub defrm my $m = join ',', @nodes; $rsp->{data}->[0] = "Could not get xCAT object definition for \'$m\'."; xCAT::MsgUtils->message("I", $rsp, $::callback); - $numobjects_not_removed++; next; } @@ -3989,7 +3988,7 @@ sub defrm else { my $rsp; - my $nodenum = scalar(keys %objhash) - $numobjects_not_removed; + my $nodenum = scalar(keys %objhash); $rsp->{data}->[0] = "$nodenum object definitions have been removed."; xCAT::MsgUtils->message("I", $rsp, $::callback); }