tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
571 stars 99 forks source link

Consolr default config busticated #430

Closed byxorna closed 8 years ago

byxorna commented 8 years ago
$ gem install consolr
Successfully installed consolr-1.1.4
Parsing documentation for consolr-1.1.4
Done installing documentation for consolr after 2 seconds
1 gem installed
$ cat ~/.consolr.yml
runners:
  ipmitool:  /usr/bin/ipmitool
dangerous_assets: []
dangerous_status: []
$ consolr -c -t U002065
/Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:185:in `rescue in block in load_runners': undefined method `capitalize' for ["ipmitool", "/usr/bin/ipmitool"]:Array (NoMethodError)
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:181:in `block in load_runners'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:180:in `each'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:180:in `map'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:180:in `load_runners'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/lib/consolr.rb:101:in `start'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/gems/consolr-1.1.4/bin/consolr:37:in `<top (required)>'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/bin/consolr:23:in `load'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/bin/consolr:23:in `<main>'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
        from /Users/gabe/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
schallert commented 8 years ago

I think the reference config is outdated. In the relevant code we treat runners as an array and use its keys to fetch other extra config parameters from the root config object. Tested locally:

$ cat ~/.consolr.yml
runners:
  ipmitool:  /usr/bin/ipmitool
dangerous_assets: []
dangerous_status: []
$ bundle exec ./bin/consolr -c -t test
/Users/mattschallert/code/collins/support/ruby/consolr/lib/consolr.rb:185:in `rescue in block in load_runners': undefined method `capitalize' for ["ipmitool", "/usr/bin/ipmitool"]:Array (NoMethodError)
        from collins/support/ruby/consolr/lib/consolr.rb:181:in `block in load_runners'
        from collins/support/ruby/consolr/lib/consolr.rb:180:in `each'
        from collins/support/ruby/consolr/lib/consolr.rb:180:in `map'
        from collins/support/ruby/consolr/lib/consolr.rb:180:in `load_runners'
        from collins/support/ruby/consolr/lib/consolr.rb:101:in `start'
        from ./bin/consolr:37:in `<main>'

$ cat ~/.consolr.yml
runners:
  - ipmitool
ipmitool: /usr/bin/ipmitool
dangerous_assets: []
dangerous_status: []
$ bundle exec ./bin/consolr -c -t test
Found 0 assets, aborting.

I'll put together a PR to update the readme and clarify that extra configuration can be passed to runners.

byxorna commented 8 years ago

ty @schallert!