summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/validate_augeas.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/validate_augeas.rb')
-rw-r--r--lib/puppet/parser/functions/validate_augeas.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/validate_augeas.rb b/lib/puppet/parser/functions/validate_augeas.rb
index 273b954..a407118 100644
--- a/lib/puppet/parser/functions/validate_augeas.rb
+++ b/lib/puppet/parser/functions/validate_augeas.rb
@@ -41,8 +41,11 @@ module Puppet::Parser::Functions
# Test content in a temporary file
tmpfile = Tempfile.new("validate_augeas")
- tmpfile.write(content)
- tmpfile.close
+ begin
+ tmpfile.write(content)
+ ensure
+ tmpfile.close
+ end
# Check for syntax
lens = args[1]
@@ -68,6 +71,7 @@ module Puppet::Parser::Functions
end
ensure
aug.close
+ tmpfile.unlink
end
end
end