From ed9567a6cf8819740d9724fa7f4a9c3dd04aab58 Mon Sep 17 00:00:00 2001 From: Isaac Boehman Date: Tue, 4 Sep 2018 18:16:29 -0700 Subject: [PATCH] mirror SoloCook#ssl_verify_mode for Chef version checking --- lib/chef/knife/solo_cook.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/chef/knife/solo_cook.rb b/lib/chef/knife/solo_cook.rb index 158f292c..70295557 100644 --- a/lib/chef/knife/solo_cook.rb +++ b/lib/chef/knife/solo_cook.rb @@ -9,7 +9,6 @@ class Knife # Approach ported from spatula (https://github.com/trotter/spatula) # Copyright 2009, Trotter Cashion class SoloCook < Knife - CHEF_VERSION_CONSTRAINT = ">=0.10.4" unless defined? CHEF_VERSION_CONSTRAINT include KnifeSolo::SshCommand include KnifeSolo::NodeConfigCommand @@ -148,6 +147,10 @@ def solo_legacy_mode Chef::Config[:solo_legacy_mode] || false end + def chef_version_constraint + Chef::Config[:solo_chef_version] || ">=0.10.4" + end + def log_level config_value(:log_level, Chef::Config[:log_level] || :warn).to_sym end @@ -302,9 +305,8 @@ def rsync(source_path, target_path, extra_opts = ['--delete-after', '-zt']) def check_chef_version ui.msg "Checking Chef version..." - version = Chef::Config[:knife][:solo_chef_version] || CHEF_VERSION_CONSTRAINT - unless chef_version_satisfies?(version) - raise "Couldn't find Chef #{version} on #{host}. Please run `knife solo prepare #{ssh_args}` to ensure Chef is installed and up to date." + unless chef_version_satisfies?(chef_version_constraint) + raise "Couldn't find Chef #{chef_version_constraint} on #{host}. Please run `knife solo prepare #{ssh_args}` to ensure Chef is installed and up to date." end if node_environment != '_default' && chef_version_satisfies?('<11.6.0') ui.warn "Chef version #{chef_version} does not support environments. Environment '#{node_environment}' will be ignored."