Merge branch 'master' of github.com:warpc/rosa-build

This commit is contained in:
George Vinogradov 2011-10-29 19:55:44 +04:00
commit 2acc098b08
3 changed files with 11 additions and 5 deletions

View File

@ -117,6 +117,10 @@ class BuildList < ActiveRecord::Base
self.status == BUILD_PENDING
end
def event_log_message
{:project => project.name, :version => project_version, :arch => arch.name}.inspect
end
private
def set_default_status
self.status = WAITING_FOR_RESPONSE unless self.status.present?

View File

@ -4,8 +4,8 @@ end
Warden::Manager.before_failure do |env, opts|
# raise env.inspect
ActiveSupport::Notifications.instrument("event_log.observer", :kind => 'error',
:message => env['action_dispatch.request.request_parameters']['user'].delete_if{|k,v| k == 'password'}.inspect)
ActiveSupport::Notifications.instrument "event_log.observer", :kind => 'error',
:message => (env['action_dispatch.request.request_parameters']['user'].delete_if{|k,v| k == 'password'}.inspect rescue nil)
end
Warden::Manager.before_logout do |user,auth,opts|
@ -14,7 +14,9 @@ end
ActiveSupport::Notifications.subscribe "event_log.observer" do |name, start, finish, id, payload|
if c = EventLog.current_controller
EventLog.create_with_current_controller :kind => (payload[:kind].presence || 'info'), :message => payload[:message].presence,
:object => payload[:object], :object_name => payload[:object_name].presence
object = payload[:object]
message = payload[:message].presence; message ||= object.event_log_message if object.respond_to?(:event_log_message)
EventLog.create_with_current_controller :kind => (payload[:kind].presence || 'info'), :message => message,
:object => object, :object_name => payload[:object_name].presence
end
end

View File

@ -76,7 +76,7 @@ class BuildServer
self.client.call('delete_build_list', idlist)
end
def get_status
def self.get_status
self.client.call('get_status')
end