Le 23/10/2013 17:41, Peter Meier a écrit ::/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It seems that now the recommendation is to have one file perYes it is.
class?
Module manifests will be much more complex with a lot of files in it.
It seems it works that way, at least in 2.7, but I did not find anything in documentation stating it should work that way.
If no, where puppet will look for foo::a::b class, (aside fromBut you can also have this class in
module/foo/manifest/a/b.pp)?
module/foo/manifest/a.pp
module/foo/manifest/init.pp
if I remember that correctly.
I'm not confident in this. I'm worried this behaviour will disappeared in near future and would like to know how long can I rely on this.
At least it will help us a lot in migrating our manifests from 0.25-style to 2.7+ style...
On Thu, Oct 24, 2013 at 12:54 AM, DEGREMONT Aurelien <aurelien....@cea.fr> wrote:Le 23/10/2013 17:41, Peter Meier a écrit ::/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It seems that now the recommendation is to have one file perYes it is.
class?
Module manifests will be much more complex with a lot of files in it.There will be more files, but you'll still have the same number of classes and defines. In addition, you can locate classes or defines by the filename so it means less hunting around. The vast majority of modules these days are written in this style, so I don't think that it adds that much complexity.It seems it works that way, at least in 2.7, but I did not find anything in documentation stating it should work that way.
If no, where puppet will look for foo::a::b class, (aside fromBut you can also have this class in
module/foo/manifest/a/b.pp)?
module/foo/manifest/a.pp
module/foo/manifest/init.pp
if I remember that correctly.
I'm not confident in this. I'm worried this behaviour will disappeared in near future and would like to know how long can I rely on this.
At least it will help us a lot in migrating our manifests from 0.25-style to 2.7+ style...
This behavior is documented at http://docs.puppetlabs.com/puppet/2.7/reference/lang_namespaces.html and is the supported approach to resource namespacing. It's very unlikely that this will change at all, let alone in the near future, and has been the accepted best practice for at least 2 - 3 years.
Le 24/10/2013 21:05, John Bollinger a écrit :
I think the undocumented behavior Aurélien was concerned about is the autoloader falling back from my_module/manifests/a/b.pp to my_module/manifests/a.pp and ultimately to my_module/manifests/init.pp when trying to load class my_module::a::b. Indeed, it isn't explicitly documented as far as I can tell; certainly the referenced document says nothing about it.
In practice, such behavior is necessary to find and load classes that are lexically nested inside others, so it is at least a matter of quality of implementation (a win) that the autoloader in fact does exhibit that behavior. Nevertheless, I think Aurélien is right to be wary, especially if class nesting ever moves from disfavor to deprecation, on a path to ultimate removal. Moreover, I think it is especially risky to rely on that fallback behavior to load classes that are not lexically nested, ala
my_module/manifests/foo.pp:
----
class my_module::foo {
}
class my_module::foo::bar {
}
At present, if the autoloader looks for my_module::foo::bar in my_module/manifests/foo.pp then I don't think it matters whether class my_module::foo::bar is expressed in nested or unnested form. However, I would account that a parser implementation detail. For instance, it could be that a future iteration of the parser will attempt to optimize class loading by stopping the parse of my_module/manifests/foo.pp when it reaches the closing brace of class my_module::foo. If that happened, then class my_module::foo::bar in my example would suddenly become invisible.
You totally catch my concerns!
What could we expect from that in the future?
If class nesting is ever deprecated in a future version of Puppet, then I think that will be a signal to prioritize completing the transition (regardless of whether your manifests actually use nesting).
John--To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/0050745a-d864-4b2c-b372-b58a66138ce7%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.