puppetlabs/puppet — pull request #2984 by cprice404 (2014-08-15 22:37:37+00:00)
Title: (PUP-3030) More explicit handling of tempfiles on the server

This PR refactors several places where we were using the Ruby `Tempfile` object on the server. Leaving it up to the runtime to handle the deletion of the tempfiles can be problematic; it can cause excessive memory usage, etc., and in most of the cases where we were using it the files weren't really even temporary.

The PR changes the existing Puppet::FileSystem::Tempfile class to Puppet::FileSystem::Uniquefile, which has all of the semantics of a Tempfile except that it does not manage deletion for you.

The places in the server code where we were using Tempfile have also been refactored to use this instead, and to explicitly delete the files in an `ensure` block where appropriate.