The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #14599

file resource should handle ENOTDIR

Added by Christopher Wood almost 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:05/20/2012
Priority:NormalDue date:
Assignee:Stefan Schulte% Done:

0%

Category:file
Target version:2.7.19
Affected Puppet version:2.7.13 Branch:https://github.com/puppetlabs/puppet/pull/805
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

In the “def stat” portion of the file type’s file.rb, ENOTDIR (see stat(2)) isn’t handled. This leads to the following:

$ cat /tmp/t1.pp file { ‘/tmp/xx/yy/zz/1’: ensure => absent, } $ ls /tmp/xx ls: cannot access /tmp/xx: No such file or directory $ puppet apply /tmp/t1.pp notice: Finished catalog run in 0.02 seconds $ touch /tmp/xx $ puppet apply /tmp/t1.pp err: /Stage[main]//File[/tmp/xx/yy/zz/1]: Could not evaluate: Not a directory – /tmp/xx/yy/zz/1 notice: Finished catalog run in 0.02 seconds

Mailing list discussion:

https://groups.google.com/forum/#!topic/puppet-users/4rk31Q1IzNY/discussion

Editorially:

I’m sure what should be happening here when there’s ENOTDIR. On the one hand it seems that the ensure => absent portion above should sensibly return success because the full path doesn’t exist. In this case an ENOTDIR indicates success. On the other hand, if I expected only directories in my path but there was a non-directory inode, perhaps I need to re-examine my assumptions about the system in question. In this case ENOTDIR indicates a problem.

History

#1 Updated by Christopher Wood almost 3 years ago

Better shell fragment:

$ cat /tmp/t1.pp
file { '/tmp/xx/yy/zz/1':
ensure => absent,
}
$ ls /tmp/xx
ls: cannot access /tmp/xx: No such file or directory
$ puppet apply /tmp/t1.pp
notice: Finished catalog run in 0.02 seconds
$ touch /tmp/xx
$ puppet apply /tmp/t1.pp
err: /Stage[main]//File[/tmp/xx/yy/zz/1]: Could not evaluate: Not a directory - /tmp/xx/yy/zz/1
notice: Finished catalog run in 0.02 seconds

#2 Updated by Stefan Schulte almost 3 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Stefan Schulte

#3 Updated by Stefan Schulte almost 3 years ago

  • Category set to file
  • Status changed from Accepted to In Topic Branch Pending Review
  • Branch set to https://github.com/puppetlabs/puppet/pull/805

#4 Updated by Kelsey Hightower almost 3 years ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release

#5 Updated by Moses Mendoza over 2 years ago

  • Status changed from Merged - Pending Release to Closed
  • Target version set to 2.7.19

Released in 2.7.19rc1.

#6 Updated by Matthaus Owens over 2 years ago

Released in Puppet 3.0.0-rc4

Also available in: Atom PDF