diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-05-12 13:19:16 -0700 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-05-12 13:19:16 -0700 |
commit | 54f47c478ab1b4bee0775b61ca59dda17a818e0a (patch) | |
tree | 3f3af75edacf61860c029496f18654fb6b4e93c8 | |
parent | 9ed478c0c7bcf05d954aa770e927e54af150b140 (diff) | |
parent | db398d7b211838fed9b5df4f9474991a5f5dbc6b (diff) | |
download | chef-54f47c478ab1b4bee0775b61ca59dda17a818e0a.tar.gz |
Merge pull request #1420 from opscode/sersut/CHEF-4911
Give -p option to install.sh if we are bootstrapping a pre-release version
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap/chef-full.erb | 4 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 13 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 1 |
4 files changed, 16 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f8626bfb76..870077b0ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * `chef_gem` resource now uses omnibus gem binary. (CHEF-5092) * `freebsd_package` resource now uses the brand new "pkgng" package manager when available. (CHEF-4637) * chef-full template gets knife options to override install script url, add wget/curl cli options, and custom install commands (CHEF-4697) +* knife now bootstraps node with the latest current version of chef-client. (CHEF-4911) ## Last Release: 11.12.0 RC1 (03/31/2014) * SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172) diff --git a/lib/chef/knife/bootstrap/chef-full.erb b/lib/chef/knife/bootstrap/chef-full.erb index c0b8d54dad..c953a7e433 100644 --- a/lib/chef/knife/bootstrap/chef-full.erb +++ b/lib/chef/knife/bootstrap/chef-full.erb @@ -27,9 +27,9 @@ exists() { if ! exists /usr/bin/chef-client; then echo "Installing Chef Client..." if exists wget; then - bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_wget_options] %> ${install_sh} -O -) ${version_string} + bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_wget_options] %> ${install_sh} -O -) <%= latest_current_chef_version_string %> elif exists curl; then - bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_curl_options] %> ${install_sh}) ${version_string} + bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_curl_options] %> ${install_sh}) <%= latest_current_chef_version_string %> else echo "Neither wget nor curl found. Please install one and try again." >&2 exit 1 diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index dc10bbb3d3..fc7b41d283 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -101,10 +101,22 @@ CONFIG @chef_config.key?(:knife) ? @chef_config[:knife] : {} end + # + # This function is used by older bootstrap templates other than chef-full + # and potentially by custom templates as well hence it's logic needs to be + # preserved for backwards compatibility reasons until we hit Chef 12. def chef_version knife_config[:bootstrap_version] || Chef::VERSION end + # + # chef version string to fetch the latest current version from omnitruck + # If user is on X.Y.Z bootstrap will use the latest X release + # X here can be 10 or 11 + def latest_current_chef_version_string + "-v #{chef_version.split(".").first}" + end + def first_boot (@config[:first_boot_attributes] || {}).merge(:run_list => @run_list) end @@ -113,4 +125,3 @@ CONFIG end end end - diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index d32b3309ed..4edc63d8d3 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -30,6 +30,7 @@ class Chef require 'chef/exceptions' require 'chef/search/query' require 'chef/mixin/shell_out' + require 'chef/mixin/command' require 'mixlib/shellout' end |