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.
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"?
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,
}
}
include base::setup
include myoverrideclass
i ran: puppetd -ov --no-daemonize
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 <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.