On Thursday, February 14, 2013 4:33:01 AM UTC-6, Евгений Верещагин wrote:
>
> I think that "include" for classes, and "import" for pp-files. I learn 
> puppet second day :-)
>
>
That's about right, but it misses some important points.  For one, Puppet 
manifests are declarative, so the OP's request for a way to "call" one is 
nonsensical.  Probably one of 'include' or 'import' does what the OP wants, 
but the mindset is wrong, and that's likely to lead to difficulty.

For another, well-tested best practices dictate that pretty much all 
declarations other than node definitions should be in classes, in modules.  
As such, the 'import' function should be used only for a few very specific 
purposes -- mostly just to support node declarations being in their own 
files, outside site.pp.

For a third, 'import' doesn't necessarily do exactly what people expect.  
In particular, people sometimes expect it to function like the C 
preprocessor's '#include' directive, parsing the imported file in the 
context in which the 'import' function appears, but that's not how it 
works.  Instead, 'import' causes the specified file to be parsed as a 
stand-alone manifest.  It has its uses, but mostly it's a holdover from 
ancient days.

For a fourth, the main purpose of 'include' is different from that of 
'import': 'include' declares that the named class(es) should be applied to 
the target node.  It will cause the manifests containing named classes to 
be parsed if the class has not yet been defined (and its definition is 
where the autoloader expects to find it), but that's a side effect.  In 
contrast, causing manifests to be parsed is the whole purpose of 'import'.


John



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.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to