2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 00:00:12 +00:00

Simplify solution and handle verbose option

This commit is contained in:
Mark Gurevich
2016-06-21 14:57:32 -04:00
parent 17d6cd35d0
commit 52798de7c4

View File

@ -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);
}