You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2022/04/22 21:51:08 UTC
[whimsy] branch master updated: Intercept ruby warnings
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new fb6a1b7c Intercept ruby warnings
fb6a1b7c is described below
commit fb6a1b7c5c8246507881e2137f78cc0c35a7d802
Author: Sebb <se...@apache.org>
AuthorDate: Fri Apr 22 22:51:02 2022 +0100
Intercept ruby warnings
---
www/status/monitors/public_json.rb | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/www/status/monitors/public_json.rb b/www/status/monitors/public_json.rb
index 81981c25..b66c4a0a 100644
--- a/www/status/monitors/public_json.rb
+++ b/www/status/monitors/public_json.rb
@@ -43,20 +43,20 @@ def Monitor.public_json(previous_status)
contents_save = contents.dup # in case we need to send an email
# Ignore Wunderbar logging for normal messages (may occur multiple times)
- contents.gsub! /^(_INFO|_DEBUG) .*?\n+/, ''
+ contents.gsub!(/^(_INFO|_DEBUG) .*?\n+/, '')
# diff -u output: (may have additional \n at end)
- if contents.gsub! /^--- .*?\n\n?(\n|\Z)/m, ''
+ if contents.gsub!(/^--- .*?\n\n?(\n|\Z)/m, '')
status[name].merge! level: 'info', title: 'updated'
end
# Wunderbar warning
warnings = contents.scan(/^_WARN (.*?)\n+/)
if warnings.length == 1
- contents.sub! /^_WARN (.*?)\n+/, ''
+ contents.sub!(/^_WARN (.*?)\n+/, '')
status[name].merge! level: 'warning', data: $1
elsif warnings.length > 0
- contents.gsub! /^_WARN (.*?)\n+/, ''
+ contents.gsub!(/^_WARN (.*?)\n+/, '')
status[name].merge! level: 'warning', data: warnings.flatten,
title: "#{warnings.length} warnings"
end
@@ -73,6 +73,11 @@ def Monitor.public_json(previous_status)
data: "Last updated: #{File.mtime(log).to_s} (more than 24 hours old)"
end
+ # Ruby warnings
+ if contents.gsub!(%r{^/var/lib/\S+: (warning:.*?)\n+}, '')
+ status[name].merge! level: 'warning', data: $1
+ end
+
# Treat everything left as an error to be reported
unless contents.empty?
status[name].merge! level: 'danger', data: contents.split("\n")