diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 1744e3bf6..9b475c1f4 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -725,6 +725,9 @@ sub do_main_job { #------------------------------------- sub summary_all_jobs_output { + if ($terminal) { + return 0; + } print "\n======================do summary=====================\n"; my @summary; @@ -787,6 +790,24 @@ sub summary_all_jobs_output { } +#------------------------------------- +# Clean up test environment +# ------------------------------------- +sub cleanup { + my $tmptest = `lsdef xcatmntest 2>&1`; + if ($tmptest =~ /Error: Could not find an object named 'xcatmntest' of type 'node'./) { + if (-e "/etc/hosts.bak.probe") { + `rm /etc/hosts > /dev/null 2>&1`; + `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; + `makedns -n 2>&1`; + } + } else { + `makedhcp -d xcatmntest && rmdef xcatmntest`; + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; + } +} + #------------------------------------- # Each probe sub command is supposed to support hierarchical. # This funtion is used to caclulate which SN should be dispatched which command @@ -894,6 +915,7 @@ if ($test) { $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; + cleanup(); }; #--------------------------------------------