From 59e44507db4bc4d446f369b1f02cd99d031dd433 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 2 Nov 2010 09:50:23 -0500 Subject: store the temp files used for testing with visudo at '/tmp' if the visuo check fails, keep the old files around. --- lib/puppet/provider/sudoers/parsed.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/sudoers/parsed.rb b/lib/puppet/provider/sudoers/parsed.rb index 46afa93..750d009 100644 --- a/lib/puppet/provider/sudoers/parsed.rb +++ b/lib/puppet/provider/sudoers/parsed.rb @@ -241,7 +241,7 @@ Puppet::Type.type(:sudoers).provide( # def self.verify_sudo_line(line) # path is currently hardcoded, needs to be fixed - base = '/etc/sudoers' + base = '/tmp/' # find a tmp file that does not exist # this should be built into Ruby? path = "#{base}.puppettmp_#{rand(10000)}" @@ -253,9 +253,8 @@ Puppet::Type.type(:sudoers).provide( visudo("-cf", path) rescue => detail raise Puppet::Error, "visudo failed for line: #{line}, #{detail}" - ensure - File.unlink(path) if FileTest.exists?(path) end + File.unlink(path) if FileTest.exists?(path) end # convert arrays into to , joined lists -- cgit v1.2.3