Issue #8740 has been updated by Josh Cooper.
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. ---------------------------------------- Bug #8740: `puppet resource file` reports "Cannot manage files of type socket" https://projects.puppetlabs.com/issues/8740 Author: Randall Hansen Status: Merged - Pending Release Priority: Urgent Assignee: Josh Cooper Category: Target version: 2.6.x Affected Puppet version: 2.7.2rc3 Keywords: Branch: 12:38 milo |> puppet --version 2.7.2 12:38 milo |> puppet resource file /etc/hosts Could not run: Cannot manage files of type socket -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
