diff options
author | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-01-18 21:54:35 +0100 |
---|---|---|
committer | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-01-18 22:02:13 +0100 |
commit | d568c4e0f7a6323cf462045159e8203b4715e196 (patch) | |
tree | 0147b0ca4dbf015204ae454846c7ebfeef852e9a /lib/puppet | |
parent | 41bc722139028929b9ab1f9a14b318d1a23206f9 (diff) |
validate_augeas: Ensure tmpfile is closed and unlinked
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/validate_augeas.rb | 8 |
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 |