From 139ff33e1f93a0634547fc9a06442a720fe0a58e Mon Sep 17 00:00:00 2001 From: Paul Lathrop Date: Mon, 21 Jan 2008 17:01:53 -0800 Subject: Fujin's patch for ticket #1007 - consistent use of 'environment' instead of 'env' --- lib/puppet/type/exec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index 5bb3158c4..a7a046c43 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -228,7 +228,7 @@ module Puppet end end - newparam(:env) do + newparam(:environment) do desc "Any additional environment variables you want to set for a command. Note that if you use this to set PATH, it will override the ``path`` attribute. Multiple environment variables should be @@ -554,32 +554,32 @@ module Puppet begin # Do our chdir Dir.chdir(dir) do - env = {} + environment = {} if self[:path] - env[:PATH] = self[:path].join(":") + environment[:PATH] = self[:path].join(":") end - if envlist = self[:env] + if envlist = self[:environment] envlist = [envlist] unless envlist.is_a? Array envlist.each do |setting| if setting =~ /^(\w+)=((.|\n)+)$/ name = $1 value = $2 - if env.include? name + if environment.include? name warning( "Overriding environment setting '%s' with '%s'" % [name, value] ) end - env[name] = value + environment[name] = value else - warning "Cannot understand env setting %s" % setting.inspect + warning "Cannot understand environment setting %s" % setting.inspect end end end - withenv env do + withenv environment do Timeout::timeout(self[:timeout]) do output, status = Puppet::Util::SUIDManager.run_and_capture( [command], self[:user], self[:group] -- cgit From 8f0d87d498ca12417a7d20b81ba46465658fa210 Mon Sep 17 00:00:00 2001 From: Paul Lathrop Date: Tue, 5 Feb 2008 14:05:14 -0800 Subject: Added :env parameter for backwards-compatibility, with warning about deprecation. :env parameter sets new :environment parameter. Changed instances of :env to :environment for consistency with other types. Added tests for new parameters. This cimmit fixes ticket 1007. --- lib/puppet/type/exec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index a7a046c43..7d3b1abe1 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -228,6 +228,15 @@ module Puppet end end + newparam(:env) do + desc "This parameter is deprecated. Use 'environment' instead." + + munge do |value| + warning "'env' is deprecated on exec; use 'environment' instead." + resource[:environment] = value + end + end + newparam(:environment) do desc "Any additional environment variables you want to set for a command. Note that if you use this to set PATH, it will override -- cgit