(MODULES-2185) Fix withenv execution under Puppet 2.7

When executing a command with environment variables, the withenv helper
under Puppet 2.7 is on Puppet::Util::Execution and on 3.0 to 3.3, it's
on Puppet::Util.
This commit is contained in:
Dominic Cleal 2015-07-02 09:25:48 +01:00 committed by Bryan Jen
parent 9063dd5c81
commit 6c0a2e4cea

View file

@ -50,7 +50,12 @@ Puppet::Type.type(:postgresql_psql).provide(:ruby) do
def run_command(command, user, group)
command = command.join ' '
environment = get_environment
if Puppet::PUPPETVERSION.to_f < 3.4
if Puppet::PUPPETVERSION.to_f < 3.0
require 'puppet/util/execution'
Puppet::Util::Execution.withenv environment do
Puppet::Util::SUIDManager.run_and_capture(command, user, group)
end
elsif Puppet::PUPPETVERSION.to_f < 3.4
Puppet::Util.withenv environment do
Puppet::Util::SUIDManager.run_and_capture(command, user, group)
end