Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knife bootstrap --bootstrap-version command line option not working #8834

Open
ccrebolder opened this issue Aug 20, 2019 · 0 comments · May be fixed by #8844

Comments

@ccrebolder
Copy link

commented Aug 20, 2019

Description

When running knife bootstrap with --bootstrap-version option, the option if set in ~/.chef/config.rb takes precedence. According to https://docs.chef.io/config_rb.html#optional-settings the command line option should take precedence. The code at https://github.com/chef/chef/blob/master/lib/chef/knife/core/bootstrap_context.rb#L189-L205 in the knife_config method only appears to check @chef_config for the value used in version_to_install.

Chef Version

$ chef --version
Chef Development Kit Version: 3.11.3
chef-client version: 14.13.11
delivery version: master (9d07501a3b347cc687c902319d23dc32dd5fa621)
berks version: 7.0.8
kitchen version: 1.25.0
inspec version: 3.9.3

Platform Version

Ubuntu 16.04 (both workstation and client)

Replication Case

  • add knife[:bootstrap_version] = '13.9.4' to ~/.chef/config.rb
  • run knife bootstrap --bootstrap-version '14.12.9' $HOST
  • expected result: -----> Installing Chef Omnibus (-v 14.12.9)
  • actual result: -----> Installing Chef Omnibus (-v 13.9.4)

Client Output

$ knife bootstrap -VV --bootstrap-version '14.12.9' --no-host-key-verify --ssh-user vagrant -N test 192.168.121.194
INFO: Using configuration from /home/myusername/.chef/config.rb
Creating new client for test
Creating new node for test
Connecting to 192.168.121.194
DEBUG: Adding 192.168.121.194
vagrant@192.168.121.194's password:
192.168.121.194 -----> Installing Chef Omnibus (-v 13.9.4)
192.168.121.194 downloading https://omnitruck.chef.io/chef/install.sh
192.168.121.194   to file /tmp/install.sh.1645/install.sh
ccrebolder added a commit to ccrebolder/chef that referenced this issue Aug 20, 2019
Give --bootstrap-version cli option precedence
When knife bootstrap specifies --bootstrap-version on the command line,
the value in config.rb is still used.

Fixes chef#8834

Signed-off-by: Chris Crebolder <ccrebolder@gmail.com>
@ccrebolder ccrebolder referenced this issue Aug 20, 2019
5 of 10 tasks complete
ccrebolder added a commit to ccrebolder/chef that referenced this issue Aug 22, 2019
Fix option parsing order for knife commands
* https://docs.chef.io/plugin_knife_custom.html#config-rb-settings

A common pattern for mixlib-cli procs is to set the Chef::Config[:knife]
setting to the same as the command line argument, however Chef::Config
has not been fully populated at the time the options are parsed. This
commit fixes that ordering.

Fixes chef#8834

Signed-off-by: Chris Crebolder <ccrebolder@gmail.com>
ccrebolder added a commit to ccrebolder/chef that referenced this issue Aug 23, 2019
Fix option parsing order for knife commands
* https://docs.chef.io/plugin_knife_custom.html#config-rb-settings

A common pattern for mixlib-cli procs is to set the Chef::Config[:knife]
setting to the same as the command line argument, however Chef::Config
has not been fully loaded at the time the options are parsed, which
means if the config file has the same option it resets to that value
after the load.

Fixes chef#8834

Signed-off-by: Chris Crebolder <ccrebolder@gmail.com>
@ccrebolder ccrebolder referenced a pull request that will close this issue Aug 23, 2019
5 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.