diff --git a/lib/chef/knife/cook.rb b/lib/chef/knife/cook.rb index 2735215e..47668954 100644 --- a/lib/chef/knife/cook.rb +++ b/lib/chef/knife/cook.rb @@ -5,6 +5,7 @@ require 'knife-solo/ssh_command' require 'knife-solo/kitchen_command' +require 'knife-solo/tools' class Chef class Knife @@ -13,6 +14,7 @@ class Knife class Cook < Knife include KnifeSolo::SshCommand include KnifeSolo::KitchenCommand + include KnifeSolo::Tools banner "knife cook [user@]hostname [json] (options)" @@ -68,13 +70,13 @@ def patch_path end def rsync_kitchen - system %Q{rsync -rlP --rsh="ssh #{ssh_args}" --delete --exclude '.*' ./ :#{adjust_rsync_path(chef_path)}} + system! %Q{rsync -rlP --rsh="ssh #{ssh_args}" --delete --exclude '.*' ./ :#{adjust_rsync_path(chef_path)}} end def add_patches run_portable_mkdir_p(patch_path) Dir[Pathname.new(__FILE__).dirname.join("patches", "*.rb")].each do |patch| - system %Q{rsync -rlP --rsh="ssh #{ssh_args}" #{patch} :#{adjust_rsync_path(patch_path)}} + system! %Q{rsync -rlP --rsh="ssh #{ssh_args}" #{patch} :#{adjust_rsync_path(patch_path)}} end end diff --git a/lib/knife-solo/tools.rb b/lib/knife-solo/tools.rb new file mode 100644 index 00000000..4aa8f06a --- /dev/null +++ b/lib/knife-solo/tools.rb @@ -0,0 +1,7 @@ +module KnifeSolo + module Tools + def system!(command) + raise "Failed to launch command #{command}" unless system(command) + end + end +end