lib/chef/knife/solo_cook.rb in knife-solo-0.4.1 vs lib/chef/knife/solo_cook.rb in knife-solo-0.4.2
- old
+ new
@@ -65,10 +65,14 @@
option :provisioning_path,
:long => '--provisioning-path path',
:description => 'Where to store kitchen data on the node'
+ option :clean_up,
+ :long => '--clean-up',
+ :description => 'Run the clean command after cooking'
+
def run
time('Run') do
if config[:skip_chef_check]
ui.warn '`--skip-chef-check` is deprecated, please use `--no-chef-check`.'
@@ -87,10 +91,12 @@
patch_cookbooks_install
sync_kitchen
generate_solorb
end
cook unless config[:sync_only]
+
+ clean_up if config[:clean_up]
end
end
def validate!
validate_ssh_options!
@@ -119,10 +125,14 @@
upload_to_provision_path(:data_bag_path, 'data_bags')
upload_to_provision_path(:encrypted_data_bag_secret, 'data_bag_key')
upload_to_provision_path(:environment_path, 'environments')
end
+ def ssl_verify_mode
+ Chef::Config[:ssl_verify_mode] || :verify_peer
+ end
+
def expand_path(path)
Pathname.new(path).expand_path
end
def expanded_config_paths(key)
@@ -244,12 +254,18 @@
upload(file.path, dest)
ensure
file.unlink
end
- def rsync(source_path, target_path, extra_opts = '--delete')
- cmd = ['rsync', '-rL', rsync_debug, rsync_permissions, %Q{--rsh=ssh #{ssh_args}}, extra_opts]
+ def rsync(source_path, target_path, extra_opts = '--delete-after')
+ if config[:ssh_gateway]
+ ssh_command = "ssh -TA #{config[:ssh_gateway]} ssh -T -o StrictHostKeyChecking=no #{ssh_args}"
+ else
+ ssh_command = "ssh #{ssh_args}"
+ end
+
+ cmd = ['rsync', '-rL', rsync_debug, rsync_permissions, %Q{--rsh=#{ssh_command}}, extra_opts]
cmd += rsync_excludes.map { |ignore| "--exclude=#{ignore}" }
cmd << adjust_rsync_path_on_client(source_path)
cmd << %Q{:#{adjust_rsync_path_on_node(target_path)}}
cmd = cmd.flatten.compact
Chef::Log.debug cmd.inspect
@@ -289,13 +305,21 @@
result = stream_command cmd
raise "chef-solo failed. See output above." unless result.success?
end
+ def clean_up
+ clean = SoloClean.new
+ clean.ui = ui
+ clean.name_args = @name_args
+ clean.config.merge! config
+ clean.run
+ end
+
protected
def patch_cookbooks_install
- add_cookbook_path(patch_cookbooks_path)
+ add_cookbook_path(patch_cookbooks_path)
end
end
end
end