From 69248dfd8ab09f6d78054d10c7162bb18ec040e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com>
Date: Thu, 7 Feb 2013 08:56:52 +0100
Subject: validate_cmd(): Use Puppet::Util::Execution.execute when available

---
 lib/puppet/parser/functions/validate_cmd.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'lib/puppet/parser')

diff --git a/lib/puppet/parser/functions/validate_cmd.rb b/lib/puppet/parser/functions/validate_cmd.rb
index 4f6a766..344a80c 100644
--- a/lib/puppet/parser/functions/validate_cmd.rb
+++ b/lib/puppet/parser/functions/validate_cmd.rb
@@ -32,7 +32,11 @@ module Puppet::Parser::Functions
     tmpfile = Tempfile.new("validate_cmd")
     begin
       tmpfile.write(content)
-      Puppet::Util.execute("#{checkscript} #{tmpfile.path}")
+      if Puppet::Util::Execution.respond_to?('execute')
+        Puppet::Util::Execution.execute("#{checkscript} #{tmpfile.path}")
+      else
+        Puppet::Util.execute("#{checkscript} #{tmpfile.path}")
+      end
     rescue Puppet::ExecutionFailure => detail
       msg += "\n#{detail}"
       raise Puppet::ParseError, msg
-- 
cgit v1.2.3