validate_augeas: Ensure tmpfile is closed and unlinked
This commit is contained in:
parent
41bc722139
commit
d568c4e0f7
1 changed files with 6 additions and 2 deletions
|
@ -41,8 +41,11 @@ module Puppet::Parser::Functions
|
|||
|
||||
# Test content in a temporary file
|
||||
tmpfile = Tempfile.new("validate_augeas")
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue