root/lib/Resmon/Module/SIMPLESVN.pm

Revision 6f9fa4a252cc7d1271cdb56a3591d6744197d4d3, 0.9 kB (checked in by Mark Harrison <mark@omniti.com>, 6 years ago)

Adding a SIMPLESVN subversion check for use on bluestreak servers that has
fewer requirements than the FRESHSVN module.

git-svn-id: https://labs.omniti.com/resmon/trunk@100 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

  • Property mode set to 100644
Line 
1 package Resmon::Module::SIMPLESVN;
2 use Resmon::ExtComm qw/cache_command/;
3 use vars qw/@ISA/;
4 @ISA = qw/Resmon::Module/;
5
6 # A 'simple' subversion checkout freshness check. Unlike FRESHSVN, this check
7 # doesn't have a grace period, nor does it check for the correct URL being
8 # checked out. Because of this, this module can be used with an older version
9 # of subversion that doesn't have support for 'svn info' on remote URLs.
10 #
11 # Example config:
12 #
13 # SIMPLESVN {
14 #   /path/to/working/copy : noop
15 # }
16
17 sub handler {
18     my $arg = shift;
19     my $os = $arg->fresh_status();
20     return $os if $os;
21     my $wc = $arg->{'object'};
22     my $output = cache_command("svn st -u -q $wc", 60);
23     my @lines = grep { $_ !~ /^\?/ } split(/\n/, $output);
24     my $status = scalar(@lines)>1 ? "BAD" : "OK";
25     my $revision = 0;
26     if($lines[-1] =~ /^Status against revision:\s+(\d+)/) {
27       $revision = $1;
28     }
29     return $status, "rev:$revision";
30 }
31
32 1;
Note: See TracBrowser for help on using the browser.