{"action":"created","issue":{"url":"https://api.github.com/repos/sensu/sensu/issues/1529","repository_url":"https://api.github.com/repos/sensu/sensu","labels_url":"https://api.github.com/repos/sensu/sensu/issues/1529/labels{/name}","comments_url":"https://api.github.com/repos/sensu/sensu/issues/1529/comments","events_url":"https://api.github.com/repos/sensu/sensu/issues/1529/events","html_url":"https://github.com/sensu/sensu/issues/1529","id":200665310,"number":1529,"title":"Sensu Spits out stack trace of Ruby gems instead of logging what the error is","user":{"login":"DRrawlins","id":12188758,"avatar_url":"https://avatars.githubusercontent.com/u/12188758?v=3","gravatar_id":"","url":"https://api.github.com/users/DRrawlins","html_url":"https://github.com/DRrawlins","followers_url":"https://api.github.com/users/DRrawlins/followers","following_url":"https://api.github.com/users/DRrawlins/following{/other_user}","gists_url":"https://api.github.com/users/DRrawlins/gists{/gist_id}","starred_url":"https://api.github.com/users/DRrawlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DRrawlins/subscriptions","organizations_url":"https://api.github.com/users/DRrawlins/orgs","repos_url":"https://api.github.com/users/DRrawlins/repos","events_url":"https://api.github.com/users/DRrawlins/events{/privacy}","received_events_url":"https://api.github.com/users/DRrawlins/received_events","type":"User","site_admin":false},"labels":[{"id":33371770,"url":"https://api.github.com/repos/sensu/sensu/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":460342808,"url":"https://api.github.com/repos/sensu/sensu/labels/ready","name":"ready","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"portertech","id":149630,"avatar_url":"https://avatars.githubusercontent.com/u/149630?v=3","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false},"assignees":[{"login":"portertech","id":149630,"avatar_url":"https://avatars.githubusercontent.com/u/149630?v=3","gravatar_id":"","url":"https://api.github.com/users/portertech","html_url":"https://github.com/portertech","followers_url":"https://api.github.com/users/portertech/followers","following_url":"https://api.github.com/users/portertech/following{/other_user}","gists_url":"https://api.github.com/users/portertech/gists{/gist_id}","starred_url":"https://api.github.com/users/portertech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/portertech/subscriptions","organizations_url":"https://api.github.com/users/portertech/orgs","repos_url":"https://api.github.com/users/portertech/repos","events_url":"https://api.github.com/users/portertech/events{/privacy}","received_events_url":"https://api.github.com/users/portertech/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/sensu/sensu/milestones/5","html_url":"https://github.com/sensu/sensu/milestone/5","labels_url":"https://api.github.com/repos/sensu/sensu/milestones/5/labels","id":1886453,"number":5,"title":"0.28","description":"","creator":{"login":"cwjohnston","id":148017,"avatar_url":"https://avatars.githubusercontent.com/u/148017?v=3","gravatar_id":"","url":"https://api.github.com/users/cwjohnston","html_url":"https://github.com/cwjohnston","followers_url":"https://api.github.com/users/cwjohnston/followers","following_url":"https://api.github.com/users/cwjohnston/following{/other_user}","gists_url":"https://api.github.com/users/cwjohnston/gists{/gist_id}","starred_url":"https://api.github.com/users/cwjohnston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cwjohnston/subscriptions","organizations_url":"https://api.github.com/users/cwjohnston/orgs","repos_url":"https://api.github.com/users/cwjohnston/repos","events_url":"https://api.github.com/users/cwjohnston/events{/privacy}","received_events_url":"https://api.github.com/users/cwjohnston/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":3,"state":"open","created_at":"2016-07-15T19:01:44Z","updated_at":"2017-01-31T20:03:40Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2017-01-13T15:58:41Z","updated_at":"2017-02-02T22:43:23Z","closed_at":null,"body":"In sensu 0.26.5-2 for when making a client.json, certain expected arrays will throw ruby stack trace rather than tell you its an issue with the file.\r\n\r\n## Expected Behavior\r\n\r\n```\r\n\"timestamp\":\"2017-01-13T15:51:41.522272+0000\",\"level\":\"fatal\",\"message\":\"config file must be valid json\",\"file\":\"/etc/sensu/conf.d/client.json\",\"error\":\"unexpected character at line 9, column 18 [parse.c:652]\"}\r\n```\r\n**When handlers are not an array**\r\n```\r\n{\"timestamp\":\"2017-01-13T15:53:21.636106+0000\",\"level\":\"fatal\",\"message\":\"client subscriptions must be an array\",\"object\":{\"name\":\"vagrant\",\"address\":\"localhost\",\"subscriptions\":\"default\",\"os\":\"Placeholder\",\"osrelease\":\"Placeholder\",\"safe_mode\":false,\"handlers\":[\"default\"],\"keepalive\":{\"thresholds\":{\"handlers\":[\"default\"],\"warning\":40,\"critical\":60}}}}\r\n```\r\n**When subscriptions are not an array**\r\n\r\n## Current Behavior\r\n```\r\n{\"timestamp\":\"2017-01-13T15:53:21.636131+0000\",\"level\":\"fatal\",\"message\":\"SENSU NOT RUNNING!\"}\r\n/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:180:in `load_client_overrides': undefined method `uniq!' for \"defaultclient:vagrant\":String (NoMethodError)\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:187:in `load_overrides!'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:32:in `load'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:48:in `get'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/daemon.rb:133:in `load_settings'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/daemon.rb:53:in `initialize'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:29:in `initialize'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:17:in `new'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:17:in `run'\r\n        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-client:10:in `<top (required)>'\r\n        from /opt/sensu/bin/sensu-client:22:in `load'\r\n        from /opt/sensu/bin/sensu-client:22:in `<main>'\r\n```\r\n**When subscriptions are not an array**\r\n```\r\n{\"timestamp\":\"2017-01-13T15:56:45.420419+0000\",\"level\":\"fatal\",\"message\":\"config file must be valid json\",\"file\":\"/etc/sensu/conf.d/client.json\",\"error\":\"unexpected character at line 9, column 18 [parse.c:652]\"}\r\n{\"timestamp\":\"2017-01-13T15:56:45.420439+0000\",\"level\":\"fatal\",\"message\":\"SENSU NOT RUNNING!\"}\r\n```\r\n**when handlers are not an array**\r\n"},"comment":{"url":"https://api.github.com/repos/sensu/sensu/issues/comments/277108703","html_url":"https://github.com/sensu/sensu/issues/1529#issuecomment-277108703","issue_url":"https://api.github.com/repos/sensu/sensu/issues/1529","id":277108703,"user":{"login":"baweaver","id":979723,"avatar_url":"https://avatars.githubusercontent.com/u/979723?v=3","gravatar_id":"","url":"https://api.github.com/users/baweaver","html_url":"https://github.com/baweaver","followers_url":"https://api.github.com/users/baweaver/followers","following_url":"https://api.github.com/users/baweaver/following{/other_user}","gists_url":"https://api.github.com/users/baweaver/gists{/gist_id}","starred_url":"https://api.github.com/users/baweaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baweaver/subscriptions","organizations_url":"https://api.github.com/users/baweaver/orgs","repos_url":"https://api.github.com/users/baweaver/repos","events_url":"https://api.github.com/users/baweaver/events{/privacy}","received_events_url":"https://api.github.com/users/baweaver/received_events","type":"User","site_admin":false},"created_at":"2017-02-02T22:43:23Z","updated_at":"2017-02-02T22:43:23Z","body":"@portertech: It'd be easier to do this:\r\n\r\n```ruby\r\n[1] pry(main)> Array(1)                                                                                                \r\n=> [1]\r\n[2] pry(main)> Array([1])\r\n=> [1]\r\n[3] pry(main)> Array(nil).compact\r\n=> []\r\n```\r\n\r\n...which would make the code:\r\n\r\n```ruby\r\ndef load_client_overrides\r\n  @settings[:client][:subscriptions] =\r\n    Array(@settings[:client][:subscriptions])\r\n      .concat(\"client:#{@settings[:client][:name]}\")\r\n      .compact\r\n      .uniq\r\n      \r\n  warning(\"applied sensu client overrides\", :client => @settings[:client])\r\nend\r\n```"}}
{"actor":{"display_login":"baweaver"}}