diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2011-07-13 16:02:50 +0100 |
commit | e140af144e987ff7f6d767f2dc48b9cf685803fd (patch) | |
tree | 4a01971890865b4b3ca837d563bc673cbb787de8 /lib/mauve/web_interface.rb | |
parent | d28af4ec946c6aa4b645b73cef47d7e0c680bc0d (diff) |
Big commit
* Added manpages for all binaries
* Added log-reopening for mauvealert-server, and logrotate snippet
* mauveserver now adds a user on install, and runs as that user
* Big logging tidy-up
* Alert subjects are only overwritten by the source, when the subject in the databse is empty
* Removed various attr_writer methods that were being redifined
* Added a notes box to the acknowledge form, but this doesn't work yet
Diffstat (limited to 'lib/mauve/web_interface.rb')
-rw-r--r-- | lib/mauve/web_interface.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/mauve/web_interface.rb b/lib/mauve/web_interface.rb index 3770924..4594e10 100644 --- a/lib/mauve/web_interface.rb +++ b/lib/mauve/web_interface.rb @@ -185,6 +185,7 @@ EOF n_hours = params[:n_hours] || 2 type_hours = params[:type_hours] || "daylight" alerts = params[:alerts] || [] + note = params[:note] || nil n_hours = (n_hours.to_i > 188 ? 188 : n_hours.to_i) @@ -196,18 +197,28 @@ EOF succeeded = [] failed = [] - + alerts.each do |k,v| begin a = Alert.get!(k.to_i) rescue DataMapper::ObjectNotFoundError => ex failed << ex + next end + logger.debug "arse" + begin a.acknowledge!(@person, ack_until) + logger.debug note + unless note.to_s.empty? + h = History.new(:alert_id => a.id, :type => "note", :event => note.to_s) + logger.debug h.errors unless h.save + end succeeded << a rescue StandardError => ex + logger.error "Caught #{ex.to_s} when trying to save #{a.inspect}" + logger.debug ex.backtrace.join("\n") failed << ex end end @@ -454,14 +465,15 @@ EOF result = begin auth.authenticate(usr,pwd) rescue Exception => ex - @logger.debug "Caught exception during Bytemark auth for #{usr} (#{ex.to_s})" + logger.error "Caught exception during Bytemark auth for #{usr} (#{ex.to_s})" + logger.debug ex.backtrace.join("\n") false end if true == result return true else - @logger.debug "Bytemark authentication failed for #{usr}" + logger.warn "Bytemark authentication failed for #{usr}" end # @@ -472,14 +484,15 @@ EOF Digest::SHA1.hexdigest(params['password']) == Configuration.current.people[usr].password end rescue Exception => ex - @logger.debug "Caught exception during local auth for #{usr} (#{ex.to_s})" + logger.error "Caught exception during local auth for #{usr} (#{ex.to_s})" + logger.debug ex.backtrace.join("\n") false end if true == result return true else - @logger.debug "Local authentication failed for #{usr}" + logger.warn "Local authentication failed for #{usr}" end # |