diff options
author | Marc A. Paradise <marc.paradise@gmail.com> | 2019-04-08 09:00:57 -0400 |
---|---|---|
committer | Marc A. Paradise <marc.paradise@gmail.com> | 2019-04-24 13:25:58 -0400 |
commit | 8fe62e8f42e5eb30ca4b5c8ba54fe4b15424b480 (patch) | |
tree | 351149c7ae8854c7b133a5e0e9407092e0aca286 | |
parent | 4f70574dc592ff29a36e836ddfe5010632d06d11 (diff) | |
download | chef-8fe62e8f42e5eb30ca4b5c8ba54fe4b15424b480.tar.gz |
Remove prerelease support. Minimum version w/ fips now 12.20.
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 29 | ||||
-rw-r--r-- | lib/chef/knife/core/windows_bootstrap_context.rb | 32 | ||||
-rw-r--r-- | spec/unit/knife/core/bootstrap_context_spec.rb | 28 |
3 files changed, 17 insertions, 72 deletions
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index 287fe0a50f..1de714d2be 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -165,7 +165,7 @@ class Chef fips true require "chef/version" chef_version = ::Chef::VERSION.split(".") - unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 8) + unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 20) raise "FIPS Mode requested but not supported by this client" end CONFIG @@ -194,28 +194,15 @@ class Chef # # 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 + # If user is on X.Y.Z, bootstrap will use the latest X release def latest_current_chef_version_string - installer_version_string = nil - if @config[:prerelease] - installer_version_string = ["-p"] - else - chef_version_string = if knife_config[:bootstrap_version] - knife_config[:bootstrap_version] - else - Chef::VERSION.split(".").first - end - - installer_version_string = ["-v", chef_version_string] - - # If bootstrapping a pre-release version add -p to the installer string - if chef_version_string.split(".").length > 3 - installer_version_string << "-p" - end - end + chef_version_string = if knife_config[:bootstrap_version] + knife_config[:bootstrap_version] + else + Chef::VERSION.split(".").first + end - installer_version_string.join(" ") + "-v #{chef_version_string}" end def first_boot diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb index 1993a68ea8..a533e61ca2 100644 --- a/lib/chef/knife/core/windows_bootstrap_context.rb +++ b/lib/chef/knife/core/windows_bootstrap_context.rb @@ -136,7 +136,7 @@ class Chef client_rb << <<~CONFIG fips true chef_version = ::Chef::VERSION.split(".") - unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 8) + unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 20) raise "FIPS Mode requested but not supported by this client" end CONFIG @@ -170,25 +170,13 @@ class Chef end def latest_current_windows_chef_version_query - installer_version_string = nil - if @config[:prerelease] - installer_version_string = "&prerelease=true" - else - chef_version_string = if knife_config[:bootstrap_version] - knife_config[:bootstrap_version] - else - Chef::VERSION.split(".").first - end - - installer_version_string = "&v=#{chef_version_string}" + chef_version_string = if knife_config[:bootstrap_version] + knife_config[:bootstrap_version] + else + Chef::VERSION.split(".").first + end - # If bootstrapping a pre-release version add the prerelease query string - if chef_version_string.split(".").length > 3 - installer_version_string << "&prerelease=true" - end - end - - installer_version_string + "&v=#{chef_version_string}" end def win_wget @@ -325,11 +313,7 @@ class Chef private def install_command(executor_quote) - if @config[:install_as_service] - "msiexec /qn /log #{executor_quote}%CHEF_CLIENT_MSI_LOG_PATH%#{executor_quote} /i #{executor_quote}%LOCAL_DESTINATION_MSI_PATH%#{executor_quote} ADDLOCAL=#{executor_quote}ChefClientFeature,ChefServiceFeature#{executor_quote}" - else - "msiexec /qn /log #{executor_quote}%CHEF_CLIENT_MSI_LOG_PATH%#{executor_quote} /i #{executor_quote}%LOCAL_DESTINATION_MSI_PATH%#{executor_quote}" - end + "msiexec /qn /log #{executor_quote}%CHEF_CLIENT_MSI_LOG_PATH%#{executor_quote} /i #{executor_quote}%LOCAL_DESTINATION_MSI_PATH%#{executor_quote}" end # Returns a string for copying the trusted certificates on the workstation to the system being bootstrapped diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 5aa176557f..4b8c78eb9e 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -168,18 +168,6 @@ describe Chef::Knife::Core::BootstrapContext do end end - describe "when a pre-release bootstrap_version is specified" do - let(:chef_config) do - { - knife: { bootstrap_version: "11.12.4.rc.0" }, - } - end - - it "should send the full version to the installer and set the pre-release flag" do - expect(bootstrap_context.latest_current_chef_version_string).to eq("-v 11.12.4.rc.0 -p") - end - end - describe "when a bootstrap_version is not specified" do it "should send the latest current to the installer" do # Intentionally hard coded in order not to replicate the logic. @@ -223,7 +211,7 @@ describe Chef::Knife::Core::BootstrapContext do fips true require "chef/version" chef_version = ::Chef::VERSION.split(".") - unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 8) + unless chef_version[0].to_i > 12 || (chef_version[0].to_i == 12 && chef_version[1].to_i >= 20) raise "FIPS Mode requested but not supported by this client" end CONFIG @@ -256,20 +244,6 @@ describe Chef::Knife::Core::BootstrapContext do end end - describe "prerelease" do - it "isn't set in the config_content by default" do - expect(bootstrap_context.config_content).not_to include("prerelease") - end - - describe "when configured via cli" do - let(:config) { { prerelease: true } } - - it "uses CLI value" do - expect(bootstrap_context.latest_current_chef_version_string).to eq("-p") - end - end - end - describe "#config_log_location" do context "when config_log_location is nil" do let(:chef_config) { { config_log_location: nil } } |