Please review pull request #177: Put back silent option in lib/command opened by (pcarlisle)

Description:

I misinterpreted the meaning of this option since it does not appear elsewhere
in the framework. It is used by one test to intentionally ignore command
failures.

  • Opened: Thu Mar 22 18:27:45 UTC 2012
  • Based on: puppetlabs:master (a01e8b8f426d5bd32f3b0ec9c991703bd8df917a)
  • Requested merge: pcarlisle:fix_silent (55136df2f0833e29e6720270480078a6b7a603fb)

Diff follows:

diff --git a/lib/command.rb b/lib/command.rb
index bff0473..e64ac17 100644
--- a/lib/command.rb
+++ b/lib/command.rb
@@ -20,11 +20,15 @@ def exec(host, options={})
     cmdline = cmd_line(host)
     result = host.exec(cmdline, options)
 
-    result.log
-    unless options[:acceptable_exit_codes].include?(result.exit_code)
-      limit = 10
-      formatted_output = result.output.split("\n").last(limit).collect {|x| "\t" + x}.join("\n")
-      raise "Host '#{host}' exited with #{result.exit_code} running:\n #{cmdline}\nLast #{limit} lines of output were:\n#{formatted_output}"
+    # This silent option is poorly named, but is used from within some tests
+    # to ignore failed exit codes
+    unless options[:silent]
+      result.log
+      unless options[:acceptable_exit_codes].include?(result.exit_code)
+        limit = 10
+        formatted_output = result.output.split("\n").last(limit).collect {|x| "\t" + x}.join("\n")
+        raise "Host '#{host}' exited with #{result.exit_code} running:\n #{cmdline}\nLast #{limit} lines of output were:\n#{formatted_output}"
+      end
     end
 
     result

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to