I just noticed this error on 0.25.x. It used to work on 0.24.8.
$ cat /tmp/test1.pp
file { "/tmp/dir1": ensure => directory }
file { "/tmp/dir1/file1": ensure => present, require => File["/tmp/dir1"] }
$ cat /tmp/test2.pp
file { "/tmp/dir2/": ensure => directory }
file { "/tmp/dir2/file2": ensure => present, require => File["/tmp/dir2"] }
$ cat /tmp/test3.pp
file { "/tmp/dir3/": ensure => directory }
file { "/tmp/dir3/file3": ensure => present, require => File["/tmp/dir3/"] }
$ puppet /tmp/test1.pp
notice: //File[/tmp/dir1]/ensure: created
notice: //File[/tmp/dir1/file1]/ensure: created
$ puppet /tmp/test2.pp
notice: //File[/tmp/dir2]/ensure: created
notice: //File[/tmp/dir2/file2]/ensure: created
$ puppet /tmp/test3.pp
Could not find dependency File[/tmp/dir3/] for File[/tmp/dir3/file3] at /tmp/test3.pp:2
I think I have a working patch. I'll submit it in a few minutes.
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://reductivelabs.com/redmine/my/account
This bug was introduced in commit cc09c1af. Using File.split on a filename ending with a slash drops this ending slash. A resource name ending with a slash gets silently "renamed" and this breaks the dependencies.
This is kind of the inverse of #1042, and I think it has the right approach.
Really, the correct approach is that the / shouldn't have an affect either way -- I absolutely despise the way tools like cp behave differently depending on whether there's a trailing slash.
I.e., I think this is a duplicate of #1042, and this patch will only work to the extent that you know exactly whether the file has a trailing slash.
I'm closing this as a dupe of #1042, since they really are the same problem.
This is actually a pretty hard problem to fix, and a very easy problem to work around, so I don't think it qualifies as High priority.
Sorry for reopening this bug. I would like to draw attention to this thread: http://groups.google.com/group/puppet-dev/browse_thread/thread/d36450a5747be593/25d9edad436dbe51?lnk=gst&q=2675
Maybe the solution is just that people fix their manifests with file resources ending with a slash. In this case this issue indeed is a duplicate of #1042. If not, it deserves to stay open as a reminder.
Branch at http://github.com/MarkusQ/puppet/tree/ticket/master/2675
No one (including me) was thrilled with the rush patch intended for 0.25.1, so I've got another, more general/cleaner solution in the queue (coming soen).
I just noticed this error on 0.25.x. It used to work on 0.24.8.
New branch, rebased off of 0.25.1 and restructured as per discussions, making parameters (rather than types) responsible for value canonicalization.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I just updated (rebased) the branch & ported the key potentially conflicting change (m flag on the regexp) from #2770 to simplify the eventual merge conflict.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
This doesn't apply to 0.25.x cleanly.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
Doh, my bad. Try the rebased one.
Still no go.
Auto-merged lib/puppet/resource/catalog.rb Auto-merged lib/puppet/resource/reference.rb CONFLICT (content): Merge conflict in lib/puppet/resource/reference.rb Automatic cherry-pick failed. After resolving the conflicts, mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result. When commiting, use the option '-c f3e48f9' to retain authorship and message.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
This wasn't a rebasing problem, it was the expected conflict with #2770. Fixed now.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
Pushed in commit:"ca56aa7e5849a5489e8d38e29b25ea934caafcd7" in branch 0.25.x
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I just tried to update my puppetmaster to 0.25.2rc2, and another variant of
this bug resurfaced. Now every client, even those < 0.25, fail with this
error:
info: Retrieving plugins info: Retrieving facts err: Could not retrieve catalog: Could not find resource File[/etc/pki/] when converting to resource resources on node host.example.com [...]
The resource triggering the error is quite simple:
file { ["/etc/pki/", "/etc/pki/rpm-gpg/"]:
ensure => directory,
}
Rewriting it like this solves the problem:
file { ["/etc/pki", "/etc/pki/rpm-gpg"]:
ensure => directory,
}
As I have dozens of resources ending with a slash, my initial question was:
should people edit every "file" resource ending with a slash and stripping
it off ? Or should puppet treat File["/etc/pki"] and File["/etc/pki/"] as
the same ?
Using the 3 demo files described in the inital report can be used to
reproduce the error:
$ puppet test1.pp notice: //File[/tmp/dir1]/ensure: created notice: //File[/tmp/dir1/file1]/ensure: created $ puppet test2.pp Could not find resource File[/tmp/dir2/] when converting to resource resources on node host.example.com $ puppet test3.pp Could not find resource File[/tmp/dir3/] when converting to resource resources on node host.example.com
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
There was an intermittent bug in Puppet::Parser::Resource::Reference,
during initialization, and object could sometimes have its title set
before its type is set. This prevented the title from going through
type-specific canonicalization.
Marc - can you confirm so we can merge and release please! Thanks!
I just noticed this error on 0.25.x. It used to work on 0.24.8.
This was also biting us as a test indeterminacy.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
Pushed in commit:"13cbf043c6e16c14b0ab9fccd5738a8c9e5925b3" in branch 0.25.x
I just noticed this error on 0.25.x. It used to work on 0.24.8.
A trailing slash in a File resource is still being stripped off. I found a working workaround to be to not strip off the trailing slash.
http://git.ogd.nl/people?p=jeroenm2/public_git/puppet.git;a=commitdiff;h=524e85160c275effaf8a5550dbb0c22a0fa1e651 (or remote http://git.ogd.nl/~jeroenm2/puppet.git, branch 'tickets/2675'
I just noticed this error on 0.25.x. It used to work on 0.24.8.
I'm unclear on what that patch is supposed to accomplish; it appears that it would simply reintroduce the bug, by making "/some/path/" and "/some/path" be internally distinct when they are not supposed to be.
I just noticed this error on 0.25.x. It used to work on 0.24.8.
Bumping this and discussion - my inclination is to what for feedback before closing though.
Markus Roberts wrote:
I'm unclear on what that patch is supposed to accomplish; it appears that it would simply reintroduce the bug, by making "/some/path/" and "/some/path" be internally distinct when they are not supposed to be.
The former solution provided to the problem as you state it though, is not allowing to use a trailing slash in a directory path at all. Usually though, directory paths do have a trailing slash (documentation, even freaking tab completion, etc. and thus why not puppet manifests also)?
The use of this trailing slash is to be able to significantly distinct between a file and a directory path when using dependencies; the 'require => File["/some/path/"]' may be somewhere other then the 'file { "/some/path/": ensure => directory }'.
I'd say that reintroducing the original "bug" where File["/some/path/"] and File["/some/path"] are not the same while they should be, is irrelevant if you consider the solution provided in 0.25.x is eliminating the possibility to conform to very common standards, and therefore actually preventing stuff from happening.
Is it reasonable to look at lib/puppet/type/file/ensure.rb to mangle/canonicalize (or alias?) file/link/directory paths, rather then not allowing trailing slashes to all paths for all types of ensure?
Mysteriously (or not so mysteriously) upgrading both the server and the client to the 0.25.2 release solved all my problems. It seems I was under the mistaken impression that trailing slashes could no longer be used as that was what I thought my error messages indicated not finding resource dependencies anymore I now understand how that would not have made any sense. Apologies to all!