Don't overwrite or calculate the environment twice

MODULES-3311
This commit is contained in:
Jan Fabry 2016-04-28 23:24:48 +02:00
parent 275e6f9d24
commit 47ab296f36

View file

@ -30,7 +30,7 @@ Puppet::Type.type(:postgresql_psql).provide(:ruby) do
private private
def get_environment def get_environment
environment = resource[:connect_settings] || {} environment = (resource[:connect_settings] || {}).dup
if envlist = resource[:environment] if envlist = resource[:environment]
envlist = [envlist] unless envlist.is_a? Array envlist = [envlist] unless envlist.is_a? Array
envlist.each do |setting| envlist.each do |setting|
@ -55,7 +55,6 @@ Puppet::Type.type(:postgresql_psql).provide(:ruby) do
def run_command(command, user, group, environment) def run_command(command, user, group, environment)
command = command.join ' ' command = command.join ' '
environment = get_environment
if Puppet::PUPPETVERSION.to_f < 3.0 if Puppet::PUPPETVERSION.to_f < 3.0
require 'puppet/util/execution' require 'puppet/util/execution'
Puppet::Util::Execution.withenv environment do Puppet::Util::Execution.withenv environment do