lib/chef/knife/solo_cook.rb in knife-solo-0.3.0.pre1 vs lib/chef/knife/solo_cook.rb in knife-solo-0.3.0.pre2

- old
+ new

@@ -49,10 +49,15 @@ option :why_run, :short => '-W', :long => '--why-run', :description => 'Enable whyrun mode' + option :override_runlist, + :short => '-o RunlistItem,RunlistItem...,', + :long => '--override-runlist', + :description => 'Replace current run list with specified items' + def run @solo_config = KnifeSolo::Config.new time('Run') do if config[:skip_chef_check] @@ -83,10 +88,26 @@ def chefignore @chefignore ||= ::Chef::Cookbook::Chefignore.new("./") end + # cygwin rsync path must be adjusted to work + def adjust_rsync_path(path) + path_s = path.to_s + path_s.gsub(/^(\w):/) { "/cygdrive/#{$1}" } + end + + def adjust_rsync_path_on_node(path) + return path unless windows_node? + adjust_rsync_path(path) + end + + def adjust_rsync_path_on_client(path) + return path unless windows_client? + adjust_rsync_path(path) + end + # see http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions def rsync_permissions '--chmod=ugo=rwX' if windows_client? end @@ -136,11 +157,11 @@ def add_solo_config rsync(KnifeSolo.resource('solo.rb'), chef_path) end def rsync(source_path, target_path, extra_opts = '') - cmd = %Q|rsync -rl #{rsync_permissions} --rsh="ssh #{ssh_args}" #{extra_opts} #{rsync_excludes.collect{ |ignore| "--exclude #{ignore} " }.join} #{source_path} :#{target_path}| + cmd = %Q{rsync -rl #{rsync_permissions} --rsh="ssh #{ssh_args}" #{extra_opts} #{rsync_excludes.collect{ |ignore| "--exclude #{ignore} " }.join} #{adjust_rsync_path_on_client(source_path)} :#{adjust_rsync_path_on_node(target_path)}} ui.msg cmd if debug? system! cmd end def check_chef_version @@ -159,9 +180,10 @@ def cook cmd = "sudo chef-solo -c #{chef_path}/solo.rb -j #{chef_path}/#{node_config}" 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] result = stream_command cmd raise "chef-solo failed. See output above." unless result.success? end end