On Nov 21, 8:05 am, Alexander Fortin <alexander.for...@gmail.com> wrote: > On 11/21/11 11:13 AM, Luke Bigum wrote:> Yes, big difference. > > > The 'import' function will literally add the contents of a manifest file > > into where your import statement is, it's like a 'include "woof.h"' in > > C/C++ or "source /etc/sysconfig/woof" in Bash. It should really never be > > used anywhere outside of site.pp to add classes and functions but rather > > with Puppet's class autoloading functionality. > > [CUT] > > I think it's related. I'm using 2.7.3 with "puppet apply" only and I've > noticed that if you declare a variable in the importing manifest (say, > init.pp), it will not be callable from the imported manifest. So: > > init.pp: > $myvariable = "blabla" > myresource { $myvariable : ensure => present } > > import "secondmanifest.pp" > > ######################### > > secondmanifest.pp: > mysersource { "/etc/$myvariable": ensure => present } > > doesn't work.
What if you spell it like so: mysersource { "/etc/$::myvariable": ensure => present } ? I would expect either way to work in Puppet 2.6, but 2.7 is more strict about name scoping. And that does highlight an important point about the 'import' function: it is *not* thoroughly analogous to the C preprocessor's "#include" directive. It's a better analog than the 'include' function is, but it doesn't operate at the source code level. I better analog is Python's 'import' statement (and Puppet's module structure is also reminiscent of Python's -- hmm). John -- 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.