I'm suspect it is one of the "subtle and strange" behavoir. I suppose I should have just posted a link to the code in git hub. I guess I was expecting that this would be something that was going to jump out as something obvious. My apologies for not doing so. Here is the link:
https://github.com/therevmj/puppet-module-software/blob/master/manifests/init.pp I'm absolutely doing some "not so normal" things in this module to obtain the desired effect. While I liked that idea of loading this data by including a class, it probably makes more sense to extract all of the data in my [package_name].pp files into csv files or yaml and slurp that data in using 'extlookup'. Initially there was more logic in [package_name].pp files, but now that they are basically just case statements setting variables, they don't really need to be classes anymore. Using 'inline_template' to effectively let me do an 'eval( $software::$name::ensure )' wasn't my first inclination, but at the time it was what made the most sense. Thanks for taking the time to respond to my not-so-complete inquiry. It is much appreciated. On Jan 18, 11:46 am, Daniel Pittman <dan...@puppetlabs.com> wrote: > On Tue, Jan 18, 2011 at 02:29, MJ <m...@revmj.com> wrote: > > I'm trying to detect if a class has been defined as is indicated at > >http://docs.puppetlabs.com/references/stable/function.html#defined > > > However, this check always results in the following error: > > err: Could not retrieve catalog from remote server: Error 400 on > > SERVER: Could not find class software::mongodb at /etc/puppet/modules/ > > software/manifests/init.pp:36 on node X.XXXX.com > > > Line 36 is the "if defined" line which doesn't make any sense as this > > line is supposed to trap that exact condition. Has anyone else run > > into this and / or figured out a way around it? > > It would have been easier to check this if you gave us the fragment of > code that had the problem, and the puppet version you are using. It > works for me with 2.6.4-363-g27abd84 and 2.6.4 plain, using this > manifest: > > if defined( Class["software::mongodb"] ) { > notice("defined") > } else { > notice("not defined") > } > > Specifically, I see "not defined" announced as expected. However, be > aware that the 'defined' function is subtle and strange – it depends > heavily on the order that your files and classes are parsed in, and > can behave very unpredictably. > > Using it is often a sign that something not-quite-right has happened > in your code, so it would be interesting to see how you have written > it; there might be a better way to achieve the same result without the > problems. > > Regards, > Daniel > -- > ⎋ Puppet Labs Developer –http://puppetlabs.com > ✉ Daniel Pittman <dan...@rimspace.net> > ✆ Contact me via gtalk, email, or phone: +1 (503) 893-2285 > ♲ Made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.