chef-plugin icon indicating copy to clipboard operation
chef-plugin copied to clipboard

--force-formatter is passed to a version of chef-client that does not support it.

Open aharonha opened this issue 10 years ago • 3 comments

Hey We are using chef 10.30 (in some nodes) which does not support the --force-formatter option Is it possible to add a check box in the advanced section to disable it?

bash -c "export LC_ALL=en_US.UTF-8 && ssh -o 'StrictHostKeyChecking no' -i /var/lib/jenkins/.ssh/id_rsa root@gw 'sudo chef-client --force-formatter -l info -j /tmp/deploy-to-gw-by-root-chef.json   --color'"
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-cli-1.4.0/lib/mixlib/cli.rb:229:in `parse_options': invalid option: --force-formatter (OptionParser::InvalidOption)
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:70:in `configure_chef'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:57:in `reconfigure'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application/client.rb:195:in `reconfigure'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:63:in `run'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/bin/chef-client:26:in `<top (required)>'
    from /usr/bin/chef-client:23:in `load'
    from /usr/bin/chef-client:23:in `<main>'
ERROR:  (Java::Hudson::AbortException)


aharonha avatar Dec 03 '15 08:12 aharonha

Hi. That is not big deal. But will require some time as I am abit occupied with other stuff. My suggestion is add something like "chef10 compatible" check box, which is disabled by default?

melezhik avatar Dec 03 '15 08:12 melezhik

Good enough. I have searched the code, seems that I can fix it myself. I just don't know where to put that flag (where is the code that shows the Advanced section?)

aharonha avatar Dec 03 '15 08:12 aharonha

  • https://github.com/melezhik/chef-plugin/blob/master/views/chef_builder/config.erb - is a view for plugin configuration layout, f.advanced do ... end chunk
  • also be careful with check box / boolean types in jenkins as they are buggy in some way, there was some internal issues related to de-serialization boolean types from job's xml after jenkins restart, , see I HOW I solved this in plugins source code .

Practically this means tow things, adding brand new check box `foo' implies:

  • adding INT wrapper as attr_accessor :foo_int inside models/chef-builder.rb
  • reading check box foo value as instance.get('foo_int') inside views/chef_builder/config.erb

See plugins code for details. I'd appreciate it if you make MR for this. Thanks

melezhik avatar Dec 03 '15 09:12 melezhik