Can I make use of nested cases like this ? case $operatingsystem: { case $kernelmajorversion: { ''6.1'' : { code } ''6.2'' : { code } default } } 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.
On Friday, March 22, 2013 8:23:31 AM UTC-5, Dragos R wrote:> > Can I make use of nested cases like this ? > > case $operatingsystem: { > case $kernelmajorversion: { > ''6.1'' : { code } > ''6.2'' : { code } > default > } > } > >Have you tried? If you put that into a test.pp. replace "code" with a notify, and then run "puppet apply test.pp" you''ll be able to find out really quickly if it will work or not. That being said, i haven''t tried it, but a quick look at http://docs.puppetlabs.com/puppet/3/reference/lang_conditional.html#case-statements indicates it probably won''t work.> 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.
Thanks, Its not mentioned and I tried, did not work. No problem, if''s are ok too. Dragos On Friday, March 22, 2013 3:35:12 PM UTC+2, llowder wrote:> > > > On Friday, March 22, 2013 8:23:31 AM UTC-5, Dragos R wrote: >> >> Can I make use of nested cases like this ? >> >> case $operatingsystem: { >> case $kernelmajorversion: { >> ''6.1'' : { code } >> ''6.2'' : { code } >> default >> } >> } >> >> > Have you tried? If you put that into a test.pp. replace "code" with a > notify, and then run "puppet apply test.pp" you''ll be able to find out > really quickly if it will work or not. > > That being said, i haven''t tried it, but a quick look at > http://docs.puppetlabs.com/puppet/3/reference/lang_conditional.html#case-statementsindicates it probably won''t work. > > > >> 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.
On Friday, March 22, 2013 8:40:20 AM UTC-5, Dragos R wrote:> > Thanks, > > Its not mentioned and I tried, did not work. > > No problem, if''s are ok too. > >The code you posted would not work, because the outer case statement is incomplete. Also, the inner case statement has no code block (and no colon) for its ''default'' case. There oughtn''t to be a problem nesting case statements if you get the syntax right: case $operatingsystem: { ''RedHat'', ''CentOS'' : { case $kernelmajorversion: { ''6.1'' : { ... } ''6.2'' : { ... } } } } 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.
Op maandag 25 maart 2013 14:01:11 UTC+1 schreef jcbollinger:> > > The code you posted would not work, because the outer case statement is > incomplete. Also, the inner case statement has no code block (and no > colon) for its ''default'' case. There oughtn''t to be a problem nesting case > statements if you get the syntax right: > > case $operatingsystem: { > ''RedHat'', ''CentOS'' : { > case $kernelmajorversion: { > ''6.1'' : { ... } > ''6.2'' : { ... } > } > } > } > > John >Thanks John, I ran into your answer via a Google search and was able to get nested case statements working properly. The code can become quite verbose, but that''s not necessarily a bad thing. :) Regards, Martijn -- 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.