[Pkg-puppet-devel] [facter] 17/46: (#20321) Be more descriptive in deprecation message

Stig Sandbeck Mathisen ssm at debian.org
Sun Sep 1 10:47:29 UTC 2013


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit e5b8cd5457ef39720d60fd04907d3ce2e78b1ba0
Author: Stefan Schulte <stefan.schulte at taunusstein.net>
Date:   Sat Apr 20 15:24:59 2013 +0200

    (#20321) Be more descriptive in deprecation message
    
    Facter::Util::Resoultion.exec can be used to run arbitrary commands. On
    windows it is currently allowed to pass a shell builtin but we raise a
    deprecation warning.
    
    But the deprecation warning did not include the actual commandline it is
    complaining about so if you have custom facts that make use of this
    feature you may ask yourself why you see the message.
    
    Add the actual command to the deprecation message so it easier to
    resolve the issue.
---
 lib/facter/util/resolution.rb     |    2 +-
 spec/unit/util/resolution_spec.rb |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/facter/util/resolution.rb b/lib/facter/util/resolution.rb
index 49d355d..9205abe 100644
--- a/lib/facter/util/resolution.rb
+++ b/lib/facter/util/resolution.rb
@@ -169,7 +169,7 @@ class Facter::Util::Resolution
 
       begin
         out = %x{#{code}}.chomp
-        Facter.warnonce 'Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass "cmd /c your_builtin" as a command' unless expanded_code
+        Facter.warnonce "Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass \"cmd /c your_builtin\" as a command (command responsible for this message was \"#{code}\")" unless expanded_code
       rescue Errno::ENOENT => detail
         # command not found on Windows
         return nil
diff --git a/spec/unit/util/resolution_spec.rb b/spec/unit/util/resolution_spec.rb
index a989dd8..53d1083 100755
--- a/spec/unit/util/resolution_spec.rb
+++ b/spec/unit/util/resolution_spec.rb
@@ -685,7 +685,7 @@ describe Facter::Util::Resolution do
         it "should try to run the command and return output of a shell-builtin" do
           Facter::Util::Resolution.expects(:expand_command).with(%q{echo foo}).returns nil
           Facter::Util::Resolution.expects(:`).with(%q{echo foo}).returns 'foo'
-          Facter.expects(:warnonce).with('Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass "cmd /c your_builtin" as a command')
+          Facter.expects(:warnonce).with 'Using Facter::Util::Resolution.exec with a shell built-in is deprecated. Most built-ins can be replaced with native ruby commands. If you really have to run a built-in, pass "cmd /c your_builtin" as a command (command responsible for this message was "echo foo")'
           Facter::Util::Resolution.exec(%q{echo foo}).should == 'foo'
         end
         it "should try to run the command and return nil if not shell-builtin" do

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list