Bugfix for db_events. Fixes #2982.

git-svn-id: file:///home/svn/framework3/trunk@10770 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Weeks 2010-10-20 23:32:42 +00:00
parent 3d8a26e409
commit 869d930588
1 changed files with 16 additions and 2 deletions

View File

@ -70,6 +70,20 @@ private
return services return services
end end
def clean_nils(obj)
return '' if obj == nil
if obj.is_a? Hash
obj.each_key do |key|
obj[key] = clean_nils(obj[key])
end
elsif obj.is_a? Array
obj.each_with_index do |ob, i|
obj[i] = clean_nils(ob)
end
end
obj
end
public public
def hosts(token,xopts) def hosts(token,xopts)
@ -909,11 +923,11 @@ public
event[:updated_at] = e.updated_at event[:updated_at] = e.updated_at
event[:name] = e.name event[:name] = e.name
event[:critical] = e.critical if(e.critical) event[:critical] = e.critical if(e.critical)
event[:username] = e.critical if(e.username) event[:username] = e.username if(e.username)
event[:info] = e.info event[:info] = e.info
ret[:events] << event ret[:events] << event
end end
ret clean_nils(ret)
end end
def report_event(token,xopts) def report_event(token,xopts)
authenticate(token) authenticate(token)