diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-04-08 14:16:25 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-04-08 14:16:25 -0700 |
commit | 1212247ac8c786fe33b7ea6e7ab023d9ac0d5807 (patch) | |
tree | 8677f28d0d76cf4e12267f0d9d108362ce47df25 /lib/chef | |
parent | bf72554155fc3e24f3f020ba6d7101d350502bb9 (diff) | |
download | chef-1212247ac8c786fe33b7ea6e7ab023d9ac0d5807.tar.gz |
Fix knife bootstrap_version CLI option overriding config option
closes #8834
@ccrebolder this should be all that is necessary to fix your issue.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 5 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 82fa5971b8..3785fa9c17 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2010-2019, Chef Software Inc. +# Copyright:: Copyright 2010-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -149,8 +149,7 @@ class Chef # client.rb content via chef-full/bootstrap_context option :bootstrap_version, long: "--bootstrap-version VERSION", - description: "The version of #{Chef::Dist::PRODUCT} to install.", - proc: lambda { |v| Chef::Config[:knife][:bootstrap_version] = v } + description: "The version of #{Chef::Dist::PRODUCT} to install." option :channel, long: "--channel CHANNEL", diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index 8f07149ebe..f889e7b7ed 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2011-2016, Chef Software, Inc. +# Copyright:: Copyright 2011-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -194,6 +194,8 @@ class Chef s end + # XXX: this reads values only out of the config file and is NOT merged with the CLI options, and it is most likely + # a bug to be using this accessor and we should be using config and not knife_config. def knife_config @chef_config.key?(:knife) ? @chef_config[:knife] : {} end @@ -203,7 +205,7 @@ class Chef # # @return [String] download version string def version_to_install - return knife_config[:bootstrap_version] if knife_config[:bootstrap_version] + return @config[:bootstrap_version] if @config[:bootstrap_version] if @config[:channel] == "stable" Chef::VERSION.split(".").first |