Hi, i''m writing a define to custom apache configuration, with nagios check, using Geppeto. I want to define a parameter to check specific web page for ssl, because not all the site are available trough SSL, just couple of pages. I''m using previously declared parameters to build the whole string: The thing is it''s working great, but Geppeto marks it as uninitialized variable: define platform::create ( ....... $ssl_iface = $::ipaddress, $ssl_page = "/", $nagioscheckssl = "check_https_other_string_sane!${ssl_iface}! www.${name}!${ssl_page}!${name}!200<http://www.%24%7Bname%7D%21%24%7Bssl_page%7D%21%24%7Bname%7D%21200/>" <---marked as error/uninitialized ............ ]) {...} @hlindberg Pointed that it''s miracle that it''s working, and it''s a mistake and should not work. Please advice is it really not suppose to work and should i do other ways, or to change the Geppetto behavior ? Thanks. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Henrik Lindberg
2013-Mar-03 19:29 UTC
Re: [Puppet Users] Parameters using other parameters
On 2013-03-03 15:00, Andrei Burd wrote:> Hi, i''m writing a define to custom apache configuration, with nagios > check, using Geppeto. > > I want to define a parameter to check specific web page for ssl, because > not all the site are available trough SSL, just couple of pages. > I''m using previously declared parameters to build the whole string: > > The thing is it''s working great, but Geppeto marks it as uninitialized > variable: > > define platform::create ( > > ....... > $ssl_iface = $::ipaddress, > $ssl_page = "/", > $nagioscheckssl > "check_https_other_string_sane!${ssl_iface}!www.${name}!${ssl_page}!${name}!200 > <http://www.%24%7Bname%7D%21%24%7Bssl_page%7D%21%24%7Bname%7D%21200/>" > <---marked as error/uninitialized > ............ > ]) {...} > > @hlindberg Pointed that it''s miracle that it''s working, and it''s a > mistake and should not work. >My point is that it is undefined behavior to reference other parameters when initiating, and that you can use a different parameter as the input (to make it easy to override). i.e. something like this: define platform::create ( $ssl_iface = $::ipaddress, $ssl_page = ''/'', $checkssl = '''' ]) { $nagioscheckssl = $checkssl ? { '''' => "check_https_other_string_sane!${ssl_iface}!www.${name}!${ssl_page}!${name}!200 <http://www.%24%7Bname%7D%21%24%7Bssl_page%7D%21%24%7Bname%7D%21200/>", default => $checkssl } ... } >> Please advice is it really not suppose to work and should i do other > ways, or to change the Geppetto behavior ? >It may work in a given version of Puppet, but there is no guarantee it will work in some other version. - henrik -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Sunday, March 3, 2013 8:00:35 AM UTC-6, Andrei Burd wrote:> > Hi, i''m writing a define to custom apache configuration, with nagios > check, using Geppeto. > > I want to define a parameter to check specific web page for ssl, because > not all the site are available trough SSL, just couple of pages. > I''m using previously declared parameters to build the whole string: > > The thing is it''s working great, but Geppeto marks it as uninitialized > variable: > > define platform::create ( > > ....... > $ssl_iface = $::ipaddress, > $ssl_page = "/", > $nagioscheckssl = "check_https_other_string_sane!${ssl_iface}! > www.${name}!${ssl_page}!${name}!200<http://www.%24%7Bname%7D%21%24%7Bssl_page%7D%21%24%7Bname%7D%21200/>" > <---marked as error/uninitialized > ............ > ]) {...} > @hlindberg Pointed that it''s miracle that it''s working, and it''s a mistake > and should not work. > > Please advice is it really not suppose to work and should i do other ways, > or to change the Geppetto behavior ? >Gepetto is right to flag an error. Puppet does not support parameter defaults that use the values of other parameters of the same class or definition. It does not flag a parse error at present, but the results are undefined. Based on how I think the implementation works, you got lucky on a 33% chance that your default value would be interpreted as you intended. There is no guarantee that it will continue to work on a different version of Puppet or of the Ruby underneath, and it is likely to break if you add, remove, or rename parameters. John -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.