xCAT_plugin::DBobjectdefs::defrm: check whether the object is in the table before try to delete it
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3545 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
1970d80dc1
commit
ca77e78e8f
@ -2790,8 +2790,21 @@ sub defrm
|
||||
# the memberlist nodes must be updated.
|
||||
|
||||
my $numobjects = 0;
|
||||
my %objTypeLists;
|
||||
foreach my $obj (keys %objhash)
|
||||
{
|
||||
my $objtype = $objhash{$obj};
|
||||
if (!defined($objTypeLists{$objtype})) # Do no call getObjectsOfType for the same objtype more than once.
|
||||
{
|
||||
@{$objTypeLists{$objtype}} = xCAT::DBobjUtils->getObjectsOfType($objtype);
|
||||
}
|
||||
if (!grep(/^$obj$/, @{$objTypeLists{$objtype}})) #Object is not in the db, do not need to delete
|
||||
{
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Could not find an object named \'$obj\' of type \'$objtype\'.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
next;
|
||||
}
|
||||
$numobjects++;
|
||||
|
||||
if ($objhash{$obj} eq 'group')
|
||||
|
Loading…
Reference in New Issue
Block a user