lib/chef/knife/solo_cook.rb in knife-solo-0.6.0 vs lib/chef/knife/solo_cook.rb in knife-solo-0.7.0.pre
- old
+ new
@@ -73,10 +73,14 @@
option :clean_up,
:long => '--clean-up',
:description => 'Run the clean command after cooking'
+ option :legacy_mode,
+ :long => '--legacy-mode',
+ :description => 'Run chef-solo in legacy mode'
+
def run
time('Run') do
if config[:skip_chef_check]
ui.warn '`--skip-chef-check` is deprecated, please use `--no-chef-check`.'
@@ -133,10 +137,14 @@
def ssl_verify_mode
Chef::Config[:ssl_verify_mode] || :verify_peer
end
+ def solo_legacy_mode
+ Chef::Config[:solo_legacy_mode] || false
+ end
+
def expand_path(path)
Pathname.new(path).expand_path
end
def expanded_config_paths(key)
@@ -306,9 +314,12 @@
cmd = "sudo chef-solo -c #{provisioning_path}/solo.rb -j #{provisioning_path}/dna.json"
cmd << " -l debug" if debug?
cmd << " -N #{config[:chef_node_name]}" if config[:chef_node_name]
cmd << " -W" if config[:why_run]
cmd << " -o #{config[:override_runlist]}" if config[:override_runlist]
+ if Gem::Version.new(::Chef::VERSION) >= Gem::Version.new("12.10.54")
+ cmd << " --legacy-mode" if config[:legacy_mode]
+ end
ui.msg "Running Chef: #{cmd}"
result = stream_command cmd
raise "chef-solo failed. See output above." unless result.success?