diff --git a/app/models/event.rb b/app/models/event.rb index 3430c4e4..89e3ee57 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,12 +1,13 @@ class Event < ApplicationRecord serialize :body, JSON - enum event_type: { boot: 0, reload_config: 10, load_config: 20, heartbeat: 30, error: 40, start_reboot: 50, } + enum event_type: { boot: 0, reload_config: 10, load_config: 20, heartbeat: 30, error: 40, warn: 45, start_reboot: 50, } belongs_to :pbm_session def self.event_types [ OpenStruct.new(name: :error), + OpenStruct.new(name: :warn), OpenStruct.new(name: :boot), OpenStruct.new(name: :load_config), OpenStruct.new(name: :reload_config), diff --git a/app/services/api/save_event_service.rb b/app/services/api/save_event_service.rb index 84be4e2b..bc200238 100644 --- a/app/services/api/save_event_service.rb +++ b/app/services/api/save_event_service.rb @@ -50,6 +50,8 @@ def self.execute!(session_id: , hostname: , event_type: , body: , device_id: ) end when "error" next pbm_session.events.create!(event_type: :error, body: body) + when "warn" + next pbm_session.events.create!(event_type: :warn, body: body) end end end