Todd Scallan was in town for our quarterly user's group meeting and made the suggestion that for every post I make complaining about something, I should make a nice post. I have a lot of catching up to do, but I have to start somewhere.
I have a little utility that will parse an OpenDeploy log that contains multiple runs of a particular deployment (meaning the log file contains lots of logs appended together) and only looks at the most recent execution for any errors and returns those errors. Nothing fancy - just a mechanism to report deployment problems if you think that would make your life a little better. Here's the code (if I knew how to indent in this silly markup language I would, but I don't so pretend it's nicely indented):
=head1 parse_appended_failed($name,$def,$src,$dest)
Parses an open deploy log file that contains multiple run logs for errors
in the last execution of the deployment and returns any errors found
as a string.
Inputs: $name - The name of the deployment
$def - The definition name of the deployment
$src - The source server for the deployment
$dest - The destination server for the deployment
Example:
$deployname = "ZERO_deploy_12345";
$defname = "ZERO_deploy-def";
$src="srcserver";
$dest = "trgserver";
$errors = TeamSite::NikeUtils:
****_appended_failed($deployname,$defname,$src,$dest);
=cut
sub parse_appended_failed {
my ($name,$def,$src,$dest) = @_;
my @latest = ();
my $IWODLOGPATH = "/interwoven/opendeploy/OpenDeployNG/log";
my $errors = '';
my $logfile = "$IWODLOGPATH/src." . $name . "." . $def . "." . $src . ".to." . $dest . ".log";
if (-e $logfile) {
open LOG,"<$logfile";
while (<LOG>) {
if (/Begin logfile/) {
@latest = ();
}
push @latest,$_;
}
foreach (@latest) {
$errors .= "$_" if (/\*\*\*ERROR/ || /\*\*\*WARNING/ || /FAILED/);
}
}
else {
$errors = "Could not open logfile: $logfile\n";
}
return $errors;
}
Dave SmithSr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com