Re: [Puppet Users] Re: Puppet definitions and inheritance

2011-01-06 Thread Nigel Kersten
On Thu, Jan 6, 2011 at 1:12 PM, Arnau Bria  wrote:

> On Thu, 06 Jan 2011 13:49:56 +0100
> Felix Frank wrote:
>
> Hi Felix,
>
> > > In our work, we're 4 people sharing a puppet server and puppet
> > > structure. We define our definitions inside our classes, and
> > > sometimes we see that some of we use same def but defined in its
> > > our class (i. e. add_line definiton).
> > >
> > > So, why ios the correct procdeure (or other's experince) to define
> > > "shared" definitons?
> >
> > First off, you *do* each work on distinct modules, right? So moving
> > stuff to your init.pp is not going to inflict anything on your
> > coworkers.
> Yes, we do use our own modules. (our own vars and our own tree branch).
> we also have a common part with common moduleswhich are included by
> "default"...
>
> > Apart from that - why would you require everyone to reinvent all the
> > wheels? Why *wouldn't* you want to define a central add_line
> > definition?
> Mmmm... I'm not sure if I'm undesratnding you. We don't want to
> reinvent the wheel, so I'm asking other admins if you use others
> one code, and if yes, where do they (you) define this kind of things...
> some king of common definition "available" in every module?
>
>
if you put the definition of "something:mydefine" in
/something/manifests/mydefine.pp then people can just *use* it
and the autoloader will find it for them.

Whoever owns "something" gets to define it, and whoever wants to consume the
defined type puts it in their own modules.

Does that make more sense?

-- 
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.



Re: [Puppet Users] Re: Puppet definitions and inheritance

2011-01-06 Thread Arnau Bria
On Thu, 06 Jan 2011 13:49:56 +0100
Felix Frank wrote:

Hi Felix,

> > In our work, we're 4 people sharing a puppet server and puppet
> > structure. We define our definitions inside our classes, and
> > sometimes we see that some of we use same def but defined in its
> > our class (i. e. add_line definiton).
> > 
> > So, why ios the correct procdeure (or other's experince) to define
> > "shared" definitons?
> 
> First off, you *do* each work on distinct modules, right? So moving
> stuff to your init.pp is not going to inflict anything on your
> coworkers.
Yes, we do use our own modules. (our own vars and our own tree branch).
we also have a common part with common moduleswhich are included by
"default"...
 
> Apart from that - why would you require everyone to reinvent all the
> wheels? Why *wouldn't* you want to define a central add_line
> definition?
Mmmm... I'm not sure if I'm undesratnding you. We don't want to
reinvent the wheel, so I'm asking other admins if you use others
one code, and if yes, where do they (you) define this kind of things...
some king of common definition "available" in every module? 
 
> Regards,
> Felix
Cheers,
Arnau

-- 
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.



Re: [Puppet Users] Re: Puppet definitions and inheritance

2011-01-06 Thread Felix Frank
On 01/05/2011 06:19 PM, Arnau Bria wrote:
> On Mon, 3 Jan 2011 08:11:50 -0800 (PST)
> jcbollinger jcbollinger wrote:
> 
> Hi,
> 
> looking for some other's experience...
> 
> [...]
> 
>> You could also try using ::main::luser, and perhaps even changing
>> "main" to something with less potential for name collision.  Better,
>> however, would probably be to move luser to the top level of your
>> module's init.pp (you are using modules, right?).
> 
> In our work, we're 4 people sharing a puppet server and puppet
> structure. We define our definitions inside our classes, and sometimes
> we see that some of we use same def but defined in its our class (i. e.
> add_line definiton).
> 
> So, why ios the correct procdeure (or other's experince) to define
> "shared" definitons?

First off, you *do* each work on distinct modules, right? So moving
stuff to your init.pp is not going to inflict anything on your coworkers.

Apart from that - why would you require everyone to reinvent all the
wheels? Why *wouldn't* you want to define a central add_line definition?

Regards,
Felix

-- 
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.



Re: [Puppet Users] Re: Puppet definitions and inheritance

2011-01-05 Thread Arnau Bria
On Mon, 3 Jan 2011 08:11:50 -0800 (PST)
jcbollinger jcbollinger wrote:

Hi,

looking for some other's experience...

[...]

> You could also try using ::main::luser, and perhaps even changing
> "main" to something with less potential for name collision.  Better,
> however, would probably be to move luser to the top level of your
> module's init.pp (you are using modules, right?).

In our work, we're 4 people sharing a puppet server and puppet
structure. We define our definitions inside our classes, and sometimes
we see that some of we use same def but defined in its our class (i. e.
add_line definiton).

So, why ios the correct procdeure (or other's experince) to define
"shared" definitons?

TIA,
Arnau

-- 
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.



[Puppet Users] Re: Puppet definitions and inheritance

2011-01-03 Thread jcbollinger


On Dec 28 2010, 12:31 pm, cyrus  wrote:
> Are definitions inherited?
>
> By that I mean I have the following:
>
> class main {
>
>     
>
>     define luser () {
>         ... some code ...
>     }
>
>     
>
> }
>
> class inetd inherits main {
>
>      /* call luser definition */
>      luser {
>           $name:
>           
>      }
>
> }
>
> But Puppet complains
>
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
> Invalid resource type luser.
>
> I know this definition works since I can call it directly from within
> the class main. I even tried calling luser using main::luser but same
> error.

You could also try using ::main::luser, and perhaps even changing
"main" to something with less potential for name collision.  Better,
however, would probably be to move luser to the top level of your
module's init.pp (you are using modules, right?).

Resolution of the definition name aside, it is unlikely that "inetd
inherits main" is what you want.  It can work, but unless class inetd
is overriding properties of resources defined in class main then what
you want is probably

class inetd {
include "main"
}

that is, unless you are using resource overrides, you should "include"
classes instead of ineriting them.

All things considered, however, I suspect that what you *really* want
is

class main {
include "inetd"
}


Best,

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-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.