Oliver Schad
2011-Apr-21 08:58 UTC
[Puppet Users] Default parameters for classes with parameters
Hi all, does somebody know if default parameters in classes with parameters work? I tried it with puppet v2.6.7 i.e.: class app::mysql( $mysql_data_dir = ''/data/mysql/data'', $mysql_log_dir = ''/data/mysql/log'', $mysql_binlog_dir = ''/data/mysql/binlog'', $mysql_expire_logs_days = ''10'', $mysql_max_binlog_size = ''100M'', $mysql_binlog_do_db = [] ) { ... } Inside I use a template which shows me "undef" as value for the parameters above. If I define the same parameters inside the class, it works. Regards Oli
Martin Alfke
2011-Apr-21 13:02 UTC
Re: [Puppet Users] Default parameters for classes with parameters
Hi On Apr 21, 2011, at 10:58 AM, Oliver Schad wrote:> Hi all, > > does somebody know if default parameters in classes with parameters work? I > tried it with puppet v2.6.7 i.e.:this is possible according to documentation: http://docs.puppetlabs.com/guides/parameterized_classes.html#using-parameterized-classes-1> > class app::mysql( > $mysql_data_dir = ''/data/mysql/data'', > $mysql_log_dir = ''/data/mysql/log'', > $mysql_binlog_dir = ''/data/mysql/binlog'', > $mysql_expire_logs_days = ''10'', > $mysql_max_binlog_size = ''100M'', > $mysql_binlog_do_db = [] > ) { > ... > } > > Inside I use a template which shows me "undef" as value for the parameters > above. If I define the same parameters inside the class, it works. >How do you use your parameterized class? According to documentation you should use: class { ''app::mysql'': }> Regards > OliRegards, Martin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Oliver Schad
2011-Apr-22 15:26 UTC
Re: [Puppet Users] Default parameters for classes with parameters
Am Thursday 21 April 2011 schrieb mir Martin Alfke:> On Apr 21, 2011, at 10:58 AM, Oliver Schad wrote: > > Inside I use a template which shows me "undef" as value for the > > parameters above. If I define the same parameters inside the class, > > it works. > > How do you use your parameterized class? > > According to documentation you should use: > > class { ''app::mysql'': }I do it this way, the including works but not the default values for the parameters. Regards Oli
Nan Liu
2011-Apr-22 16:23 UTC
Re: [Puppet Users] Default parameters for classes with parameters
On Fri, Apr 22, 2011 at 8:26 AM, Oliver Schad <puppet@oschad.de> wrote:> Am Thursday 21 April 2011 schrieb mir Martin Alfke: >> On Apr 21, 2011, at 10:58 AM, Oliver Schad wrote: >> > Inside I use a template which shows me "undef" as value for the >> > parameters above. If I define the same parameters inside the class, >> > it works. >> >> How do you use your parameterized class? >> >> According to documentation you should use: >> >> class { ''app::mysql'': } > > I do it this way, the including works but not the default values for the > parameters.Seems to work fine in 2.6.7. Here''s an easy test file, try it with the inline_template string in the erb file class hello ( $var = ''hello'' ) { #$string = inline_template("<%= var %>") $string = template("/tmp/hello.erb") notice($string) } include hello If you have issues, post your manifests, test, and erb template on pastie. Thanks, Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.