The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #8740

`puppet resource file` reports "Cannot manage files of type socket"

Added by Anonymous over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:08/02/2011
Priority:UrgentDue date:
Assignee:Josh Cooper% Done:


Target version:2.6.13
Affected Puppet version: Branch:

We've Moved!

Ticket tracking is now hosted in JIRA:


12:38 milo |> puppet --version
12:38 milo |> puppet resource file /etc/hosts
Could not run: Cannot manage files of type socket

Related issues

Related to Puppet - Bug #3165: Ralsh can't manage files Closed 02/08/2010
Related to Puppet - Bug #7139: puppet resource file broken Closed 04/18/2011
Related to Puppet - Bug #5843: The 'file' type still uses self.class[] in self.class.ins... Accepted 01/11/2011
Related to Puppet - Bug #8969: Puppet hangs trying to replace a FIFO Accepted 08/12/2011
Related to Puppet - Bug #8970: The `file` type should correctly handle "exotic" entities... Accepted 08/12/2011


#1 Updated by Nigel Kersten over 4 years ago

  • Status changed from Unreviewed to Accepted
  • Priority changed from Normal to Urgent
  • Target version set to 2.6.x

This fix has to go into 2.6.x and 2.7.x as soon as we can.

#2 Updated by Josh Cooper over 4 years ago

  • Assignee set to Josh Cooper

When a unix domain socket is not present in /, this functionality worked in 0.25.1, was broken in 0.25.2 (#3165), fixed in 2.6.5, broken in 2.6.8 (#7139), and fixed in 2.6.9.

When a unix domain socket is present in /, this functionality worked in 0.25.1, was broken in 0.25.2 (#3165), and been broken ever since. It appears #3165 was masking this bug, so when #3165 was fixed in 2.6.5, this bug was uncovered.

#3 Updated by Nick Lewis over 4 years ago

  • Status changed from Accepted to Merged - Pending Release

Fix merged to 2.6.x in commit:75786ad.

#4 Updated by Josh Cooper over 4 years ago

Previously the command ‘puppet resource file’ would enumerate all files in the root directory, and generate an exception if the file type was not a directory, file, or link. It would also do this when a file or directory was specified, e.g. ‘puppet resource file /etc/hosts’. The reason is because the find and search methods of the ral terminus both call Puppet::Type.instances, which returns an array of all instances it knows about. In the case of the file type, it recurses one level from the root directory (the root and its direct children). Owen submitted a match for #3165 that eliminated this behavior, but Jesse added the functionality back in when he merged Owen’s patch.

Ideally, puppet could be modified to handle the other file types gracefully, e.g. unix domain socket, and do something with them, perhaps skipping over them, warning, etc. But this change was deemed to big for 2.6. Though we should revisit for 2.7 and see if a better solution can be implemented.

Also, in the case of file types, it is not necessary for the ral’s find method to call the type’s instances method — because it can directly create a file instance with the specified name. However, for other types that have multiple providers, e.g. package, this is not true. In other words, each provider must be asked if it provides an instance with that name. (The code actually walks every provider and every instance for each provider so that it can warn if an instance with the same name is provided by multiple providers.)

However, the ral’s search method does need to call the instances method to return all instances. Ideally, the instances method should know in what context it is being invoked (find vs search) so that it can do the right thing based on the context and type, e.g. file vs package. One idea I had was to add two methods, find_instances and search_instances, to Puppet::Type, and have each invoke the instances method by default. Then for types that want different behavior like file, can return an empty array for find_instances, but do what it does now for search_instances. Again this is too big of a change for 2.6, and it still means ‘puppet resource file’ would fail in the presence of other file types in the root.

After discussions with Nigel, Nick, and Matt, I changed the resource application to return an error message (listing files in the root directory is not supported). This seemed appropriate seeing as how this behavior (executing puppet resource file with or without a file path) has been broken since 0.25.2 when a file type other than directory, file or links is in the root directory.

#5 Updated by James Turnbull over 4 years ago

  • Target version changed from 2.6.x to 2.6.10
  • Affected Puppet version deleted (2.7.2rc3)

#6 Updated by Matthaus Owens over 4 years ago

Released in 2.7.4rc1, 2.6.x release still outstanding.

#7 Updated by Matthaus Owens over 4 years ago

  • Status changed from Merged - Pending Release to Closed
  • Target version changed from 2.6.10 to 2.6.13

released in 2.6.13rc1

Also available in: Atom PDF