Please review pull request #362: (#12051) Send exec onlyif/unless command output to debug log opened by (domcleal)

Description:

When an onlyif or unless exec clause is run, the output is now always sent to
the debug log irrespective of the loglevel output, which controls the logging
level of the command itself.

https://projects.puppetlabs.com/issues/12051

  • Opened: Sat Jan 21 16:00:47 UTC 2012
  • Based on: puppetlabs:2.7.x (470a6646b4faa34874ab853355730dc0471b1246)
  • Requested merge: domcleal:tickets/2.7.x/12051 (f2c407a406f2abb2e2905a4e88294ff0b99f4b35)

Diff follows:

diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index 8525e86..0a55b5b 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -369,6 +369,10 @@ def check(value)
           return false
         end
 
+        output.split(/\n/).each { |line|
+          self.debug(line)
+        }
+
         status.exitstatus != 0
       end
     end
@@ -412,6 +416,10 @@ def check(value)
           return false
         end
 
+        output.split(/\n/).each { |line|
+          self.debug(line)
+        }
+
         status.exitstatus == 0
       end
     end
diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb
index b040430..5a4c392 100755
--- a/spec/unit/type/exec_spec.rb
+++ b/spec/unit/type/exec_spec.rb
@@ -632,6 +632,13 @@ def instance(path)
             @test.check_all_attributes.should == false
           end
         end
+
+        it "should emit output to debug" do
+          Puppet::Util::Log.level = :debug
+          @test[param] = @fail
+          @test.check_all_attributes.should == true
+          @logs.shift.message.should == "test output"
+        end
       end
     end
   end

    

--
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