sonian/sensu — Issue #59: The validate_config method should be refactored
Author: jamtur01
Created: 2011-11-04 06:04:50+00:00
State: open

Currently if the config.json file is malformed you get some ugly and confusing errors, for example not including a checks section returns:

```ruby
vagrant@sensu:/etc/sensu$ sudo sensu-server -c /etc/sensu/config.json
/var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/config.rb:24:in `validate_config': undefined method `each' for nil:NilClass (#!/usr/bin/env ruby NoMethodError)
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/config.rb:20:in `initialize'
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/server.rb:34:in `new'
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/server.rb:34:in `initialize'
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/server.rb:11:in `new'
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/server.rb:11:in `run'
from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from /var/lib/gems/1.8/gems/sensu-0.8.0/lib/sensu/server.rb:10:in `run'
from /var/lib/gems/1.8/gems/sensu-0.8.0/bin/sensu-server:9
from /usr/local/bin/sensu-server:19:in `load'
from /usr/local/bin/sensu-server:19
```