lib/chef/knife/solo_cook.rb in knife-solo-0.7.0.pre3 vs lib/chef/knife/solo_cook.rb in knife-solo-0.7.0
- old
+ new
@@ -7,11 +7,10 @@
class Chef
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
include KnifeSolo::Tools
@@ -146,10 +145,14 @@
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
def enable_reporting
@@ -300,11 +303,11 @@
system!(*cmd)
end
def check_chef_version
ui.msg "Checking Chef version..."
- 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."
+ 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."
end
end