On 26.11.2009 16:48, mark wrote:
> back on my own account again, updating:
> hi! thanks for the advice
> i think i don't understand the nature of 'include'. in my mind include
> is something that is invisible to the actual engine that does
> things..it's a shorthand
>
> that replaces 'include X' with the contents of X and then the software
> goes to work on the final result and humans don't have to look at
> hugely long files.
>    
no, not by far.
Include has the meaning, make sure that the rules in the specified class 
are also applied. Multiple includes of the same class from different 
places will apply the class only once.
Require (>=0.25, hope this is what is called never actually used it :"> 
) is similar, with the sole exception that it makes sure that the 
definitions in the specified class are applied before the definitions in 
your class.
Also note that there is no particular order in which your definitions 
are applied. When you use before it just means that the current resource 
will be applied before the other resource, but 1000 other resources 
could be applied in between.(same goes for require)


> so when i see a file that says
>
> class A {
>
> blah
>
> }
>
> include A
>
>
>
> it seems like it's redundant...so i'm thinking in the puppet
> world..does include have some stronger meaning like "and execute the
> code"?
>
>    
You should think at it more of a description, not code. (like you would 
in any other descriptive language)

>
> here is the specifics of my multilayer include world:
>
> ------------------------------------------------------
>
> my attempt to trace the lineage of the resource i'm bumping into
>
> in my manifest/node file:
>
> node "chquoteq02.tradearca.com" {
>
> ...
>
> include base::setup
>
> ...
>
> i'd like to TURN ON SERVICE netfs for this node
>
>
>
> }
>
> ------------------------------------------------------
>
> in /etc/puppet/modules-base/trunk/base/manifests/init.pp:
>
>
>
> class base::setup {
>
> ...
>
>      include services::setup
>
> ...
>
> }
>
> ------------------------------------------------------
>
> in /etc/puppet/modules-base/trunk/services/manifests/init.pp:
>
>
>
> class services::setup {
>
> ...
>
>              include services::base
>
> ...
>
> }
>
>
>
> class services::base {
>
> ...
>
>          service { netfs:
>
>          ... TURNS OFF SERVICE
>
>          }
>
> ...
>
> }
>
>
>
>
>
>
>
> so give this, i tried this (but it didn't work) in my manifest/node
> file:
>
> class myoverrideclass inherits  services::base {
>
>          service { netfs:
>
>                  enable  =>  true,
>
>                  ensure  =>  running,
>
>                  hasstatus =>  true,
>
>          }
>
> }
>    
Service with "S" not "s". When the first letter is uppercase the 
statement alters an already existing definition, when it's lower case 
it's a new definition. Here: 
http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#classes .


>
>
>    include base::setup
>
>    include myoverrideclass
>
>
>
> i ran: puppetd -ov --no-daemonize
>    
I prefer puppetd --test (faster to write and not too verbose)
> on the client server and got:
>
> err: Could not retrieve catalog: Puppet::Parser::AST::Resource failed
> with error ArgumentError: Duplicate definition: Service[netfs] is
> already defined in file /etc/puppet/modules-base/trunk/services/
> manifests/init.pp at line 385; cannot redefine at /etc/puppet/
> manifests/nodes/chquoteq02.tradearca.com.node:491 on node
> chquoteq02.tradearca.com
>
>
>
> i even tried moving the 'include base::setup' to be above the
> 'myoverrideclass' definition but still the same problem...
>
> On Nov 25, 2:17 pm, Peter Meier<peter.me...@immerda.ch>  wrote:
>    
>> Hi
>>
>>      
>>> i've been fiddling around with the inherits form...but..i can't seem
>>> to get any headway out of it.
>>>        
>> What is your problem with inheritance? Maybe we can give you a way out  
>> and  following example shows you that it is the way to go:
>>
>> $ cat foo.pp
>> class a {
>> file{'/tmp/a': ensure =>  file}
>> file{'/tmp/b': ensure =>  file}
>>
>> }
>>
>> class b inherits a {
>>    File['/tmp/b']{ensure =>  absent }
>>
>> }
>>
>> include a
>> include b
>> $ puppet foo.pp
>> notice: //a/File[/tmp/a]/ensure: created
>> $
>>
>> you can include the inherited class anywhere you'd like to. So for  
>> example simply write disable classes for the services you don't want  
>> to manage on certain nodes and then include these in your node.
>>
>> cheers pete
>>      
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@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.
>
>
>    
Good luck and welcome to puppet,
   Silviu

--

You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.


Reply via email to