aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-07-19 16:50:49 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-07-19 16:50:49 +0100
commit1c8bf33bd7663fcb67fe854d968670aa475173dd (patch)
treece3362715b27c97fd5525cc3f50d38be1ace4647 /lib
parent72654c0a6bdb83e27f16ea92d31e7127bd19ce19 (diff)
* Fixed supressed spelling mistakes (sic)
* Added require thin_parser to http_server * Fixed spurious thaw attempts in mauve_thread.
Diffstat (limited to 'lib')
-rw-r--r--lib/mauve/http_server.rb4
-rw-r--r--lib/mauve/mauve_thread.rb4
-rw-r--r--lib/mauve/notifiers/sms_aql.rb5
-rw-r--r--lib/mauve/notifiers/templates/email.html.erb4
-rw-r--r--lib/mauve/notifiers/templates/email.txt.erb4
-rw-r--r--lib/mauve/notifiers/templates/xmpp.txt.erb2
6 files changed, 16 insertions, 7 deletions
diff --git a/lib/mauve/http_server.rb b/lib/mauve/http_server.rb
index cb705ea..71261c8 100644
--- a/lib/mauve/http_server.rb
+++ b/lib/mauve/http_server.rb
@@ -8,6 +8,10 @@ require 'mauve/mauve_thread'
require 'digest/sha1'
require 'log4r'
require 'thin'
+#
+# Needed for Lenny version of thin converted by apt-ruby, for some reason.
+#
+require 'thin_parser'
require 'rack'
require 'rack-flash'
require 'rack/handler/webrick'
diff --git a/lib/mauve/mauve_thread.rb b/lib/mauve/mauve_thread.rb
index 55ec446..ca537da 100644
--- a/lib/mauve/mauve_thread.rb
+++ b/lib/mauve/mauve_thread.rb
@@ -50,6 +50,8 @@ module Mauve
end
def freeze
+ return if self.frozen?
+
logger.debug("Freezing")
@frozen = true
@@ -64,6 +66,8 @@ module Mauve
end
def thaw
+ return unless self.frozen?
+
logger.debug("Thawing")
@frozen = false
@thread.wakeup if @thread.stop?
diff --git a/lib/mauve/notifiers/sms_aql.rb b/lib/mauve/notifiers/sms_aql.rb
index d0cf630..9181be3 100644
--- a/lib/mauve/notifiers/sms_aql.rb
+++ b/lib/mauve/notifiers/sms_aql.rb
@@ -58,7 +58,7 @@ module Mauve
template_file = File.join(File.dirname(__FILE__),"templates","sms.txt.erb")
- txt += if File.exists?(template_file)
+ txt = if File.exists?(template_file)
ERB.new(File.read(template_file)).result(binding).chomp
else
logger.error("Could not find sms.txt.erb template")
@@ -74,7 +74,8 @@ module Mauve
#txt += others.map { |alert| alert.summary_one_line }.join(", ")
end
- txt += "link: https://alert.bytemark.co.uk/alerts"
+ # TODO: Fix link to be accurate.
+ # txt += "link: https://alert.bytemark.co.uk/alerts"
## @TODO: Add a link to acknowledge the alert in the text?
#txt += "Acknoweledge alert: "+
diff --git a/lib/mauve/notifiers/templates/email.html.erb b/lib/mauve/notifiers/templates/email.html.erb
index 99f56d5..f0ce1be 100644
--- a/lib/mauve/notifiers/templates/email.html.erb
+++ b/lib/mauve/notifiers/templates/email.html.erb
@@ -19,9 +19,9 @@ end
<h2>Detail</h2>
<div><%= RedCloth.new(alert.detail).to_html %></div>
<hr />
-<% if was_supressed and not is_suppressed %>
+<% if was_suppressed and not is_suppressed %>
<p><strong>Better now. Your notifications have now restarted.</strong></p>
-<% elsif is_supressed and not was_suppressed %>
+<% elsif is_suppressed and not was_suppressed %>
<p><strong>Too noisy! Your notifications have been suppressed.</strong></p>
<% end %>
<address>-- <br />Love mauve<br />xxx.</address></body></html>
diff --git a/lib/mauve/notifiers/templates/email.txt.erb b/lib/mauve/notifiers/templates/email.txt.erb
index a08ec55..dc5762b 100644
--- a/lib/mauve/notifiers/templates/email.txt.erb
+++ b/lib/mauve/notifiers/templates/email.txt.erb
@@ -19,9 +19,9 @@ end
-----------------------------------------------------------------------
-<% if was_supressed and not is_suppressed
+<% if was_suppressed and not is_suppressed
%>Better now. Your notifications have now restarted.<%
-elsif is_supressed and not was_suppressed
+elsif is_suppressed and not was_suppressed
%>Too noisy! Your notifications have been suppressed.<% end %>
--
diff --git a/lib/mauve/notifiers/templates/xmpp.txt.erb b/lib/mauve/notifiers/templates/xmpp.txt.erb
index d39500c..837fd67 100644
--- a/lib/mauve/notifiers/templates/xmpp.txt.erb
+++ b/lib/mauve/notifiers/templates/xmpp.txt.erb
@@ -15,6 +15,6 @@ end
if was_suppressed and not is_suppressed
%> Normal service has resumed.<%
elsif is_suppressed and not was_suppressed
-%> Further alerts supressed until things calm down.<%
+%> Further alerts suppressed until things calm down.<%
end
%>