Hi folks, I just managed to reproduce on a very small scale an issue that''s I''ve debugged for hours yesterday. if we have a class: class foo ( $bar = hiera_array(''foo::bar'', $foo::params::bar), ) inherits foo::params { notify{ "foo::bar: ${bar}": } } class foo::params { # so we know if we''re hitting defaults, or actually hiera! $bar = ''bar'' } and a hierachiy: %{::fqdn} %{::common} with the values: --- # ::fqdn foo::bar: baz and --- # ::common foo::bar: quux then hiera -a will deliever [ ''baz'', ''quuux'' ], but our notify will give us ''baz''. Now, if we change the class: class foo ( $_bar = hiera_array(''foo::bar'', $foo::params::bar), ) inherits foo::params { notify{ "foo::bar: ${_bar}": } } we''ll get the expected result, that is, notify will print: Notice: /Stage[main]/Foo/Notify[foo::bar: bazquux]/message: defined ''message'' as ''foo::bar: bazquux'' My question is simple: Is this a bug, or expected bahaviour? if it''s the latter, perhaps it should be documented some place. So long, -- i Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i.galic@brainsware.org URL: http://brainsware.org/ GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE -- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Hi, is this puppet 3? I shall suppose it is. With the parameter name of "bar", you likely trigger the automagic hiera lookup of foo::bar, which is (naturally) not done using hiera_array. Apparently, this overrides the explicit call to hiera_array. I''m not sure wether that''s as designed, you may want to open a bug if in doubt. Cheers, Felix On 08/22/2013 03:01 PM, Igor Galić wrote:> with the values: > > --- # ::fqdn > foo::bar: baz > > and > --- # ::common > foo::bar: quux > > then hiera -a will deliever [ ''baz'', ''quuux'' ], but our notify will give > us ''baz''. Now, if we change the class: > > class foo ( > $_bar = hiera_array(''foo::bar'', $foo::params::bar),-- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
----- Original Message -----> Hi, > > is this puppet 3? I shall suppose it is. > > With the parameter name of "bar", you likely trigger the automagic hiera > lookup of foo::bar, which is (naturally) not done using hiera_array. > Apparently, this overrides the explicit call to hiera_array. > > I''m not sure wether that''s as designed, you may want to open a bug if in > doubt.It is indeed puppet 3.$latest, and I shall indeed consider it a bug, unless it''s explicitly documented to be a feature. --i> Cheers, > Felix > > On 08/22/2013 03:01 PM, Igor Galić wrote: > > with the values: > > > > --- # ::fqdn > > foo::bar: baz > > > > and > > --- # ::common > > foo::bar: quux > > > > then hiera -a will deliever [ ''baz'', ''quuux'' ], but our notify will give > > us ''baz''. Now, if we change the class: > > > > class foo ( > > $_bar = hiera_array(''foo::bar'', $foo::params::bar), > > -- > 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+unsubscribe@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. > For more options, visit https://groups.google.com/groups/opt_out. >-- Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i.galic@brainsware.org URL: http://brainsware.org/ GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE -- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
On Fri, 2013-08-23 at 04:50 +0000, Igor Galić wrote:> > ----- Original Message ----- > > Hi, > > > > is this puppet 3? I shall suppose it is. > > > > With the parameter name of "bar", you likely trigger the automagic hiera > > lookup of foo::bar, which is (naturally) not done using hiera_array. > > Apparently, this overrides the explicit call to hiera_array. > > > > I''m not sure wether that''s as designed, you may want to open a bug if in > > doubt. > > It is indeed puppet 3.$latest, and I shall indeed consider it a bug, > unless it''s explicitly documented to be a feature.This really is a feature. The order that puppet3 will look for values for parameters is as follows: 1. Explicitly passed parameters, e.g. using the class resource syntax class {''foo'': bar => ''some value''} 2. Automatic lookup of parameter values in hiera 3. Parameter default values (what you provide with $foo = ... in the class definition.) The reason is so that you can override class default values by providing a value with hiera. Doing any other order simply doesn''t make sense for general use. For example, I make a class: class server ( $database = ''mysql'' ) { ... } include server Then in my hiera yaml file, I set the database type to postgres instead: server::database: postgresql In this case, I''d expect the value from hiera to override the default parameter value, and the server would be installed with postgres, not mysql. -- Calvin Walton <calvin.walton@kepstin.ca> -- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.
Hi, when you put it that way, it makes perfect sense indeed. Thanks for the clarification! On 08/26/2013 08:42 PM, Calvin Walton wrote:> The reason is so that you can override class default values by providing > a value with hiera. Doing any other order simply doesn''t make sense for > general use.-- 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+unsubscribe@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. For more options, visit https://groups.google.com/groups/opt_out.