HomePhorge

(#11930) Use FileUtils.mkdir_p to recursively create directories
1ffbeb1b8ff3Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#11930) Use FileUtils.mkdir_p to recursively create directories

Previously, Puppet::Util::Log::DestFile was using Puppet.recmkdir
to recursively create parent directories. However, the latter method
assumed POSIX-style paths and did not work on Windows.

Also, if the Puppet.recmkdir method failed to create any of the
parent directories, it would rescue the exception and return
false. However, Puppet::Util::Log::DestFile did not check the return
code, and would fail later when trying to create/open the file.

This commit removes the Puppet.recmkdir method and changes
Puppet::Util::Log::DestFile to use FileUtils.mkdir_p instead,
which works with both POSIX and Windows paths. This commit also
preserves the behavior of creating each parent directory with mode
0755 (but not changing the mode for existing parents).

If one of the parent directories cannot be created, e.g. EACCES, the
FileUtils.mkdir_p method will raise an exception, similar to how
File.open would raise previously if one of its parent directories
could not be created.

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUeee351103bd2: (Maint) Remove dead code
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU1ffbeb1b8ff3: (#11930) Use FileUtils.mkdir_p to recursively create directories (authored by Josh Cooper <josh@puppetlabs.com>).Jan 21 2012, 5:44 AM