[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1456-g2f0b1e5

James Turnbull james at lovedthanlost.net
Tue Oct 27 17:05:56 UTC 2009


The following commit has been merged in the upstream branch:
commit 8a7308249783fc75d450fc2428cba52a5ad30a10
Author: Rein Henrichs <reinh at reinh.com>
Date:   Tue Oct 13 18:21:06 2009 -0700

    Fix #2707 config_version fails more helpfully
    
    Use Puppet::Util.execute to run the config_version command and reraise
    its potential Puppet::ExecutionFailure exception as a more useful
    Pupppet::ParseError

diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 4fe2a5a..7a8fa81 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -484,7 +484,10 @@ class Puppet::Parser::Parser
             return @version
         end
 
-        @version = %x{#{Puppet[:config_version]}}.chomp
+        @version = Puppet::Util.execute([Puppet[:config_version]]).strip
+
+    rescue Puppet::ExecutionFailure => e
+        raise Puppet::ParseError, "Unable to set config_version: #{e.message}"
     end
 
     # Add a new file to be checked when we're checking to see if we should be
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index 842dc19..78caf18 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -324,9 +324,17 @@ describe Puppet::Parser do
         it "should use the output of the config_version setting if one is provided" do
             Puppet.settings.stubs(:[]).with(:config_version).returns("/my/foo")
 
-            @parser.expects(:`).with("/my/foo").returns "output\n"
+            Puppet::Util.expects(:execute).with(["/my/foo"]).returns "output\n"
             @parser.version.should == "output"
         end
+
+        it "should raise a puppet parser error if executing config_version fails" do
+            Puppet.settings.stubs(:[]).with(:config_version).returns("test")
+            Puppet::Util.expects(:execute).raises(Puppet::ExecutionFailure.new("msg"))
+
+            lambda { @parser.version }.should raise_error(Puppet::ParseError)
+        end
+
     end
 
     describe Puppet::Parser,"when looking up definitions" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list