sensu-plugins / sensu-plugins-consul

This plugin provides native instrumentation for monitoring Consul, including: Consul server service and cluster health, and querying the Consul API to check for passing/critical services.
http://sensu-plugins.io
MIT License
13 stars 25 forks source link

can't modify frozen String #36

Open xiii opened 6 years ago

xiii commented 6 years ago

Hello,

I updated my gem to v2.1.0 and I get the following error

➜  ~ check-consul-kv-ttl.rb       

Check failed to run: can't modify frozen String, ["/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:315:in `build_option_arguments'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:269:in `block (2 levels) in opt_parser'", 
"/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:268:in `each'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:268:in `block in opt_parser'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/2.3.0/optparse.rb:1061:in `initialize'", 
"/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:263:in `new'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:263:in `opt_parser'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:230:in `parse_options'", 
"/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:13:in `initialize'", "/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in `new'", 
"/home/xxx/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in `block in <class:CLI>'"]

running

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

I figured that this might be due to the ruby 3.0 preparation work here, because If I remove that line the check is working.

https://github.com/sensu-plugins/sensu-plugins-consul/blob/923a29d9e9426fba7445fcc9798ea4d862d1b20d/bin/check-consul-kv-ttl.rb#L2

Any help is appreciated. Thanks

scalp42 commented 6 years ago

The issue is linked to sensu-plugin => mixlib-cli.

New version was updated with .dup to work around the issue: https://github.com/chef/mixlib-cli/blob/master/lib/mixlib/cli.rb#L314

Sensu seems to be pulling an older version.

cc @majormoses

majormoses commented 6 years ago

@scalp42 that makes sense to me, can you open an issue on https://github.com/sensu-plugins/sensu-plugin so we can address it in our library and then we can work on pulling in the new version. If we want to do this without forcing a breaking change it will take a bit of effort to hotfix the latest 1.x version but I think in this case we just need to do it, its been long enough and we really need to get all the plugins using at least 2.x of sensu-plugin.