On 03/10/16 15:48, jcbollinger wrote:
On Friday, September 30, 2016 at 2:03:06 PM UTC-5, Toni Schmidbauer wrote: Henrik Lindberg <henrik....@puppet.com <javascript:>> writes: > On 28/09/16 14:30, Toni Schmidbauer wrote: > I tried this on latest puppet: > > === test.pp > class test::subclass {} > class test inherits test::subclass { > notify { 'hello?': } > } > include test did some more tests with puppet 4.7. so the above works but if i move tests::subclass into a separate file (subclass.pp) in the manifests folder puppet apply fails with duplicate resource. my source code layout: ├── manifests │ ├── init.pp │ └── subclass.pp └── tests └── init.pp manifests/init.pp: ## code class test inherits test::subclass { notify { 'hello world': } } include test # end code manifests/subclass.pp: ## code class test::subclass {} # end code tests/init.pp: ## code include test # end code i run the code with the following command puppet apply --modulepath=/vagrant/modules manifests/init.pp if i use puppet apply --modulepath=/vagrant/modules tests/init.pp ^ |- HEADS UP puppet apply works. The behavior you describe seems buggy to me, but your manifests are also unusual. Specifically, it is strange for test/manifests/init.pp to contain a top-scope declaration. It is especially strange for that declaration to be "include test" because this is the very same file that would be evaluated, if needed, as a result of evaluating that declaration.
Top scope logic in autoloaded code have very strange effects and should not be used. At some point in the future it will probably be forbidden to have any code outside of the structure that is supposed to be in an autoloaded file.
I suppose the reason for that is to make the manifest usable both directly with 'puppet apply' and as an ordinary module manifest, and I think that /should/ work. Nevertheless, it looks to me like an awkward mix of Puppet module and site manifests, and even if it worked, I would not recommend structuring your manifests like that. I observe that your workaround involves partially splitting the site manifest part from the module manifest part, but personally, I'd go farther and take the site manifest part completely out of the module.
Agree with John here. - henrik
As I said, however, I think it should work, and even if there were a reason for it not to work, the error message that is emitted is bizarre for the code presented. I think that's probably indicative that the code is doing something unexpected by its authors. I encourage you to file a ticket for buggy behavior here, but if you do so, do not neglect to mention the diagnostic because at the very least, there are grounds here for an RFE around improving the diagnostic. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fec40211-95a6-4e3f-94ae-e7ea37069bdc%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/fec40211-95a6-4e3f-94ae-e7ea37069bdc%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout.
-- Visit my Blog "Puppet on the Edge" http://puppet-on-the-edge.blogspot.se/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c615aa89-5669-9f63-4aa6-ccb8fe53a4ec%40puppet.com. For more options, visit https://groups.google.com/d/optout.