2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 01:56:39 +00:00

Cleanup boot configuration files when processing rmdef

This commit is contained in:
Mark Gurevich 2016-08-02 14:46:04 -04:00
parent 5cd203cdf5
commit 560d01ab84

View File

@ -55,6 +55,8 @@ $Getopt::Long::ignorecase = 0;
#@::objfilelist; # list of object names from the "-f" option
#@::allobjnames; # combined list
my $doreq;
#@::noderange; # list of nodes derived from command line
#------------------------------------------------------------------------------
@ -137,6 +139,7 @@ sub process_request
$::request = shift;
$::callback = shift;
$doreq = shift;
my $ret;
my $msg;
@ -4239,6 +4242,26 @@ sub defrm
}
}
# Call nodeset offline on each node to cleanup its boot configuration files from /tftpboot directory
if ($doreq) {
# Go through each object and make sure it is a node type
my @allnodes;
foreach my $single_object (keys %objhash) {
if ($objhash{$single_object} eq "node") {
# build a list of nodes to offline
push @allnodes, $single_object;
}
}
# Run nodeset offline and capture output.
# But the output can be ignored since we do not want to prevent user from doing rmdef if
# nodeset returns some error.
my @output = xCAT::Utils->runxcmd({
command => ['nodeset'],
node => [@allnodes],
arg => ['offline'],
}, $doreq, 0 ,1);
}
# remove the objects
if (xCAT::DBobjUtils->rmobjdefs(\%objhash) != 0)
{