You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/04/15 19:20:08 UTC
[whimsy] branch master updated: use utf-8 for puppet status
This is an automated email from the ASF dual-hosted git repository.
rubys 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 819eb07 use utf-8 for puppet status
819eb07 is described below
commit 819eb0783552c36740bd1efaad48d6c137f484a8
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Apr 15 15:19:52 2017 -0400
use utf-8 for puppet status
---
www/status/monitors/system.rb | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/www/status/monitors/system.rb b/www/status/monitors/system.rb
index 67a77ae..db1a49c 100644
--- a/www/status/monitors/system.rb
+++ b/www/status/monitors/system.rb
@@ -11,25 +11,33 @@ def Monitor.system(previous_status)
status[name] = {
command: 'service puppet status',
}
+
begin
- puppet = `service puppet status`.strip
+ env['LC_ALL'] = 'en_US.UTF-8'
+ env['LANG'] = 'en_US.UTF-8'
+ env['LANGUAGE'] = 'en_US.UTF-8'
+
+ puppet = `service puppet status`.force_encoding('utf-8').strip
+
if puppet.include? '* agent is running'
status[name].merge! level: 'success', data: puppet
else
status[name].merge! level: 'warning', data: puppet
end
- rescue Exception => e
- status[name] = {
- level: 'danger',
- data: {
- exception: {
- level: 'danger',
- text: e.inspect,
- data: e.backtrace
- }
- }
+
+ rescue Exception => e
+ status[name] = {
+ level: 'danger',
+ data: {
+ exception: {
+ level: 'danger',
+ text: e.inspect,
+ data: e.backtrace
+ }
}
+ }
end
+
{data: status}
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].