From d48ee3e0f61bad913b4c050e9542b409fdd27e43 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sun, 11 Nov 2007 09:45:54 +0100 Subject: fix crontests depending on ENV[USER] by using Etc.getpwuid(Process.uid) instead --- test/ral/types/cron.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb index a9a00240c..ca60477ed 100755 --- a/test/ral/types/cron.rb +++ b/test/ral/types/cron.rb @@ -464,9 +464,9 @@ class TestCron < Test::Unit::TestCase inst = @crontype.create( :name => "something", :command => "/some/thing", :provider => :crontab) - assert_equal(ENV["USER"], inst.should(:user), + assert_equal(Etc.getpwuid(Process.uid).name, inst.should(:user), "user did not default to current user with crontab") - assert_equal(ENV["USER"], inst.should(:target), + assert_equal(Etc.getpwuid(Process.uid).name, inst.should(:target), "target did not default to current user with crontab") # Now make a new cron with a user, and make sure it gets copied -- cgit From a6ad326f71b8aaa0bce40c4d6c29195c53ec1d1f Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sun, 11 Nov 2007 09:55:01 +0100 Subject: fix the underlying dependency on the environment in the cron type --- lib/puppet/type/cron.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index 3154098db..17cb1667f 100755 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -348,7 +348,7 @@ Puppet::Type.newtype(:cron) do The user defaults to whomever Puppet is running as." - defaultto { ENV["USER"] || "root" } + defaultto { Etc.getpwuid(Process.uid).name || "root" } end newproperty(:target) do -- cgit