summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Bode <bodepd@gmail.com>2010-11-02 09:50:23 -0500
committerDan Bode <bodepd@gmail.com>2010-11-02 09:50:23 -0500
commit59e44507db4bc4d446f369b1f02cd99d031dd433 (patch)
tree2872bdda5039434dbe344fb8319e715c0b817123
parent487841f80bcf64152b9745161f1ff5a82d5b30cc (diff)
store the temp files used for testing with visudo at '/tmp'
if the visuo check fails, keep the old files around.
-rw-r--r--lib/puppet/provider/sudoers/parsed.rb5
1 files changed, 2 insertions, 3 deletions
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