#!/usr/software/bin/perl # $Id: //depot/prod/test/Rsierranevada/storage/hdd/NADQ_SEA/NDATE/SUPPORT_SCRIPTS/post_job.thpl#3 $ # Copyright (c) 2005 Network Appliance, Inc. # All rights reserved # ## @summary Mode ## Delete extra log files ## @description ## Delete send_result_to_console.log file ## @param LOGDIR Location of the log file to be deleted ## @param LOGLVL Log level (delete logs if log level is less thsn 4) ## @status public ## @author maji@netapp.com #use strict; use Cwd qw(abs_path); use HTML::Mail; use NATE::TestInfo; use San; use Data::Dumper; use Net::SCP::Expect; use Storage::Common_Lib; sub clean_up_subdir(); my $status; my $Home = $ENV{HOME}; my $san_obj = new San( \*ntest::NTEST_STDOUT ); if ( $san_obj->error() ) { logresult( 'FATAL', "Failed to instantiate San object" . $san_obj->errmsg() ); } ######################################## ### Initialization/declaration ######################################### use vars qw( $LOGLVL $LOGDIR $TEST_CONFIG $RUNPYTH $PYTHPATH $AUTO_PUSH $MAILTO $MAILFROM $RUNID ); param( 'LOGDIR', '-default', '' ); param( 'LOGLVL', '-default', '2' ); param( 'RUNPYTH', '-default', '2' ); param( 'PYTHPATH', '-default', '/usr/software/bin/python' ); param( 'AUTO_PUSH', '-default', '0' ); param( 'MAILTO', '-default', '0' ); param( 'MAILFROM', '-default', '0' ); param( 'RUNID', '-default', '0' ); opendir( IMD, $LOGDIR ) || die("Cannot open directory"); logcomment("LOGDIR - $LOGDIR"); my @thefiles = readdir(IMD); logcomment("Files present in DIR: @thefiles"); my $consolefilename; closedir(IMD); my @par_log; my $mail_subject = "Final NVME CLI Test Result : $LOGDIR"; my $mail_body; foreach my $file (@thefiles) { my $final_log; if ( $file =~ /NVCLI/ ) { open( MAIN_LOG, "$LOGDIR" . "/" . "$file" ); $final_log = "$LOGDIR" . "/" . "PARSED_" . "$file"; my @total_data = ; logcomment( "Toatl number of actual lines " . scalar @total_data ); close MAIN_LOG; foreach my $line (@total_data) { #logcomment("$line"); #next if ( $line =~ /_mkpat|closed\s+filehandle|deprecated|redefined|/ ); $line =~ s/\[\S+\]//g; $line =~ s/X;X/ /g; $line =~ s/\[\.\]//g; logcomment("AFTER PAR SEEEE : $line"); next if ( $line =~ /closed filehandle|deprecated|redefined|Prototype|mkpat|Unrecognized|NOTE\:\:END|NOTE\:\:Log|eval\s+\{|error creating/ ); next if ( $line =~ /dpg_automation|GNOTE|uninitialized|Attempt to DESTROY|just omit|read: Failed/ ); push( @par_log, $line ); } logcomment("FILE : $final_log"); logcomment( "Total line : " . scalar @par_log ); open( PARS, ">$final_log" ); print( PARS @par_log ); close(PARS); } } my %mail_params = ( HTML => $mail_body, Text => $mail_body, From => $MAIL_FROM, To => $MAIL_TO, Subject => $mail_subject, ); $mail_params{HTML} = "
$mail_params{Text}<\\HTML>";
my $mail = HTML::Mail->new(%mail_params);
$mail->send() or logresult( "CONFIG", "trouble sending mail" );