Re: [Puppet Users] About the params pattern

2014-09-22 Thread Francois Lafont
Hi, Le 19/09/2014 17:36, jcbollinger a écrit : The main points I am trying to get across And I thnink that you have succeeded now. ;) are these: 1. References to *non-local* variables should always be performed via qualified names, even when class inheritance makes the variable in

Re: [Puppet Users] About the params pattern

2014-09-22 Thread David Danzilio
What you've stumbled on is the concept of public and private classes. Public and private classes are implemented very differently. A public class is your module's entry point, this is how people interact with your module. A public class is where you define your module's API. Private classes, on

Re: [Puppet Users] About the params pattern

2014-09-22 Thread David Danzilio
What you've stumbled on is the concept of public and private classes. Public and private classes are implemented very differently. A public class is your module's entry point, this is how people interact with your module. A public class is where you define your module's API. Private classes, on

Re: [Puppet Users] About the params pattern

2014-09-22 Thread Francois Lafont
Hi, Le 22/09/2014 15:16, David Danzilio a écrit : What you've stumbled on is the concept of public and private classes. Not exactly I think. The concept of public and private classes was clear for me. It was the *implementation* of the params pattern which was not clear for me, especially for

Re: [Puppet Users] About the params pattern

2014-09-22 Thread Felix Frank
On 09/18/2014 04:40 PM, jcbollinger wrote: I'm not prepared to set up and run this test, but if it genuinely produces the results you describe then that demonstrates a bug. Here are the docs on Puppet scope: https://docs.puppetlabs.com/puppet/3/reference/lang_scope.html. Here are the docs

Re: [Puppet Users] About the params pattern

2014-09-22 Thread Francois Lafont
Le 22/09/2014 18:12, Felix Frank a écrit : Aw man, that thread is way too voluminous for me to read in a spare minute. Yes, sorry. It's a long thread but it's a finished thread I think. ;) But since you bring up templates - there was that bug, yes.

Re: [Puppet Users] About the params pattern

2014-09-22 Thread Felix Frank
On 09/22/2014 06:20 PM, Francois Lafont wrote: But since you bring up templates - there was that bug, yes. https://tickets.puppetlabs.com/browse/PUP-1220 It led to dynamic scoping rearing its ugly head again, when variables were used in templates. Not sure if this is the issue here,

Re: [Puppet Users] About the params pattern

2014-09-19 Thread jcbollinger
On Thursday, September 18, 2014 5:59:56 PM UTC-5, François Lafont wrote: Hi, Le 18/09/2014 16:40, jcbollinger a écrit : So, finally, is this way below a correct and good way to use the params pattern? - # Example of

Re: [Puppet Users] About the params pattern

2014-09-18 Thread jcbollinger
On Wednesday, September 17, 2014 10:55:12 PM UTC-5, François Lafont wrote: Thank you for your answer. Le 17/09/2014 17:12, jcbollinger a écrit : class my_module ( $var1 = $my_module::params::var1, $var2 = $my_module::params::var2, ) inherits my_module::params {

Re: [Puppet Users] About the params pattern

2014-09-18 Thread Francois Lafont
Hi, Le 18/09/2014 16:40, jcbollinger a écrit : Sorry, I worded that very poorly. Really no problem. ;) Class my_module inherits my_module::params. Absent my_module declaring its own local variables $foo1 and $foo2, the inheritance results in variables $::my_module::params::foo1 and

Re: [Puppet Users] About the params pattern

2014-09-17 Thread Francois Lafont
Le 17/09/2014 04:26, Sebastian Otaegui a écrit : As far as I know inner classes are an anti pattern(for the lack of a better term) Each class should live in its own file. More than one class per file is discouraged I agree. It's better to define inner classes in separate files

Re: [Puppet Users] About the params pattern

2014-09-17 Thread Francois Lafont
Le 17/09/2014 10:14, Francois Lafont a écrit : For instance with: class my_module ( $var1 = $my_module::params::var1, $var2 = $my_module::params::var2, $var3 = $my_module::params::var3, ) inherits my_module::params { # The body of the class } and: class

Re: [Puppet Users] About the params pattern

2014-09-17 Thread jcbollinger
On Wednesday, September 17, 2014 3:15:44 AM UTC-5, François Lafont wrote: Le 17/09/2014 04:26, Sebastian Otaegui a écrit : As far as I know inner classes are an anti pattern(for the lack of a better term) Nested classes are poor form, but multiple classes in the same module are

Re: [Puppet Users] About the params pattern

2014-09-17 Thread Atom Powers
This is what I do. This way the sub-classes automatically get variables defaults from the parent-class and when using the module you should only have to call the parent class; as long as you have defined all your parameters that are used by any sub-model in the parent class. class module (

Re: [Puppet Users] About the params pattern

2014-09-17 Thread jcbollinger
On Wednesday, September 17, 2014 6:22:52 AM UTC-5, François Lafont wrote: In fact, It's curious. I have made some tests with puppet 3.7.0 on Debian Wheezy and I can simply do this: class my_module::params { ## API of the module ## $var1 = default_value1 $var2 =

Re: [Puppet Users] About the params pattern

2014-09-17 Thread Francois Lafont
Thank you for your answer. Le 17/09/2014 17:12, jcbollinger a écrit : class my_module ( $var1 = $my_module::params::var1, $var2 = $my_module::params::var2, ) inherits my_module::params { include my_module There's no point to including class my_module inside its own

[Puppet Users] About the params pattern

2014-09-16 Thread Francois Lafont
Hi, About the params pattern, I had read this article : http://garylarizza.com/blog/2014/02/17/puppet-workflow-part-1/ Suppose I want to use the params pattern in my modulees (ok there really is no *better* way but imagine I want to use this way). In the article, the author explains that, for

Re: [Puppet Users] About the params pattern

2014-09-16 Thread Sebastian Otaegui
As far as I know inner classes are an anti pattern(for the lack of a better term) Each class should live in its own file. More than one class per file is discouraged On Sep 16, 2014 7:00 PM, Francois Lafont francois.lafont.1...@gmail.com wrote: Hi, About the params pattern, I had read this