summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-04-08 14:16:25 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-10 15:44:08 -0700
commitc38da1b1076f59ba8198016e9d0e31cad319cd53 (patch)
tree5c8f540f4c2d2aaedab75bd915bb499dfd35ac81
parente9edd60143ecebd592450eec4a22a1d7909cd8fc (diff)
downloadchef-c38da1b1076f59ba8198016e9d0e31cad319cd53.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>
-rw-r--r--lib/chef/knife/bootstrap.rb5
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb6
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 1fa7c41d1c..3b49dd915b 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 2b5887a7cf..10f432b868 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");
@@ -186,6 +186,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
@@ -195,7 +197,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