On Wednesday, September 25, 2013 6:07:56 AM UTC-5, Steven James wrote:
>
> Hi,
>
> I've just updated some modules that worked fine in Puppet 2.8, to v3.0.1.
> I'm struggling to get class autoloading working for some reason, and I
> wonder if someone can help?
>
>
"Autoloading" refers to a mechanism by which the master locates the
manifest file in which a class or defined type definition is found, based
on the name of the class or defined type. It is triggered when the master
attempts to evaluate a declaration of a class or resource whose definition
it has not yet evaluated. That doesn't appear to have much to do with what
you're actually trying to do.
> My main class is as follows;
>
> cat
> /etc/puppetlabs/puppet/environments/production/blah_soe/manifests/init.pp
>
> class blah_soe {
>
> class { 'blah_packages':
> require => Class['blah_yumrepo']
>
> }
>
>
Autoloading has little to do with references to classes or resources, and
in particular, it does not itself cause classes to be declared when
otherwise they are not.
As far as I am aware, references to classes, such as "Class['blah']", do
not cause declaration of otherwise-undeclared classes by any other
mechanism, either. According to the language guide, "Resource references
identify a specific *existing* Puppet resource by its type and title"
(emphasis added).
> cd /etc/puppetlabs/puppet/environments/production/blah_soe/tests
> [root@puppetcore1 tests]# /opt/puppet//bin/puppet apply ./init.pp --noop
> Error: Could not find dependency Class[Blah_yumrepo] for
> Class[Blah_packages]
>
> ...where tests/init.pp is just include blah_soe. *When I also include
> blah_packages here, it all works fine*.
>
Do you mean it works when you also include *blah_yumrepo* in init.pp?
That's exactly what I would expect to be needed. Alternatively (better, in
fact), class blah_soe could include blah_yumrepo. It is safe for both
classes to do it.
Wherever I use a class reference, I am sure to declare the referenced class
as well, typically via the 'include' function. That ensures the class is
declared, and I can be confident that it needs to be declared (somewhere)
because I am using a reference to it. Although it is not strictly
necessary to declare the referenced class in the same scope, it is safe to
do so (modulo issues related to parameterized-style class declarations, but
those are not relevant to the code we are now discussing).
> This was NOT necessary on the previous 2.8 instance. Class autoloading
> should happen as long as the modulepath is set correctly, and the ownership
> and permissions are not crazy??
>
>
Class autoloading does not do what you seem to think it does, nor does any
other Puppet mechanism of which I am aware. From your version numbers,
though, I infer that you are using Puppet Enterprise, so perhaps it adds
such a feature to the base product. In that case you would want to seek
support on the "Puppet Enterprise" group or directly from PuppetLabs.
My suspicion, however, is that you are mistaken about the code you are now
trying to apply working with PE 2.8. Even if you have not changed the
manifest files you are looking at in any way, a difference in Puppet's
configuration could result in it using different files than you think it's
using.
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.