Bug #10857

File resource fails for root(/) directory.

Added by Jason Smith over 1 year ago. Updated over 1 year ago.

Status:AcceptedStart date:11/15/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:file
Target version:3.x
Affected Puppet version:2.6.0 Branch:
Keywords:

Description

I know this is probably an extreme edge case, but I recently noticed that this fails:

file { ‘/’: ensure => directory }

with the error: Parameter path failed: File paths must be fully qualified, not ‘’ at /tmp/test.pp:1

A little background, This comes from a larger module that I have which uses the lvm module to create additional or grow existing filesystems on a server. The file resource is used to make sure the mount point exists before using the mount resource to manage /etc/fstab and mount the filesystem. I noticed that if I tried to use my custom module to grow the root(/) filesystem that I got the error above. Is the / being removed to make it an empty path as a result of some code to try and remove trailing slashes from paths?


Related issues

Related to Puppet - Feature #1621: Composite resource identifier Closed 09/29/2008

History

#1 Updated by Josh Cooper over 1 year ago

  • Category set to file
  • Status changed from Unreviewed to Accepted
  • Target version set to 2.6.x
  • Affected Puppet version changed from 2.6.12 to 2.6.0

Prior to 2.6.0, ‘/’ could be specified as the path for a managed file.

In commit:7c6b8836453b2b1e8679923f98854be3b0022edd (released in 2.6.0rc1) for #1621 composite namevars, we added the ability to specify title_patterns. For the file type, it’s title pattern was:

/^(.*?)\/?$/

which is trying to capture everything before the last optional ‘/’, but capturing nothing, causing the path to be set to ‘’

'/'.match(/^(.*?)\/?$/)
=> #<MatchData "/" 1:"">

The title logic was later changed to allow multiline titles, #4233 in commit:cf597d72dca288011cfa3e57451b8eba56ea51da but this has the same issue:

'/'.match(/^(.*?)\/*\Z/m)
=> #<MatchData "/" 1:"">

#2 Updated by Nigel Kersten over 1 year ago

  • Target version changed from 2.6.x to 3.x

Also available in: Atom PDF