add missing copyright notice
[buildfarm-server.git] / bf-alerts.pl
index 232f11ae6946cbcd96449eb295989effeff4317b..091b55849ce5e9c6269f308fa4def9ff304fd157 100755 (executable)
@@ -1,5 +1,13 @@
 #!/usr/bin/perl
 
+=comment
+
+Copyright (c) 2003-2010, Andrew Dunstan
+
+See accompanying License file for license details
+
+=cut 
+
 use strict;
 
 use Digest::SHA1  qw(sha1_hex);
@@ -108,6 +116,10 @@ print "starting alert run: $lts\n";
 
 foreach my $sysbranch (@last_heard)
 {
+       # not all versions of DBD::Pg decode modern bytea literals nicely. cope.
+       $sysbranch->{config} =~ s/^(\\?x)([a-fA-F0-9]+)$/pack('H*',$2)/e;
+
+
     my $client_conf = thaw $sysbranch->{config};
 
     my %client_alert_settings = %{ $client_conf->{alerts} || {} };
@@ -232,9 +244,9 @@ foreach my $clearme (@need_cleared)
     print "alert cleared $animal $branch\n";
 }
 
-foreach my $clearme (@need_alerts)
+foreach my $needme (@need_alerts)
 {
-    my ($sysbranch, $setting) = @$clearme;
+    my ($sysbranch, $setting) = @$needme;
     my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch});
     my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600);
     my $text = "$sysbranch->{sysname} has not reported " .