Skip to content

Commit

Permalink
Merge pull request matschaffer#1 from thbar/18-fail-fast
Browse files Browse the repository at this point in the history
Use system! fail-fast calls for rsync
  • Loading branch information
thbar committed Feb 12, 2012
2 parents 9911653 + baf011c commit 42fde9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/chef/knife/cook.rb
Expand Up @@ -5,6 +5,7 @@

require 'knife-solo/ssh_command'
require 'knife-solo/kitchen_command'
require 'knife-solo/tools'

class Chef
class Knife
Expand All @@ -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)"

Expand Down Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions 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

0 comments on commit 42fde9a

Please sign in to comment.