Hello, I''m trying to do this: service { monit: ensure => running, enable => true, hasrestart => true, if ($operatingsystem == ''centos'') { hasstatus => true, }, require => Package[''monit''], subscribe => File[''monit.conf''], } And it doesn''t work in 24.6. Perhaps setting the variable outside will be better. In 0.24.7, the error is a bit worse. Instead of an error, the class is unfindable. :) Gary --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maybe I''m missing something. This doesn''t work either: case $operatingsystem { ''centos'': { $hasstatus = ''true'' } ''fedora'': { $hasstatus = ''true'' } ''default'': { $hasstatus = ''false'' } } service { ''monit'': ensure => running, enable => true, hasrestart => true, hasstatus => $hasstatus, require => Package[''monit''], subscribe => File[''monit.conf''], } warning: Configuration could not be instantiated: Parameter hasstatus failed: interning empty string --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Turnbull
2008-Dec-24 03:00 UTC
[Puppet Users] Re: Conditionals allowed within types?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 gary wrote:> Hello, > > I''m trying to do this: > > service { monit: > ensure => running, > enable => true, > hasrestart => true, > if ($operatingsystem == ''centos'') { > hasstatus => true, > }, > require => Package[''monit''], > subscribe => File[''monit.conf''], > } > > And it doesn''t work in 24.6. Perhaps setting the variable outside will > be better. In 0.24.7, the error is a bit worse. Instead of an error, > the class is unfindable. :)See http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#selectors service { monit: ... hasstatus => $operatingsystem ? { centos => true, default => false, }, } Regards James Turnbull - -- Author of: * Pulling Strings with Puppet (http://www.amazon.com/gp/product/1590599780/) * Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) * Hardening Linux (http://www.amazon.com/gp/product/1590594444/) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJUaXc9hTGvAxC30ARAqJUAJ42lAJN5SlEBrBER0rQTjBPNhN67ACeO5eI ZusMWMn33RRYttjSj+3YEeY=4u/8 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ah yes. :) Thanks James! On Dec 24, 11:00 am, James Turnbull <ja...@lovedthanlost.net> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > gary wrote: > > Hello, > > > I''m trying to do this: > > > service { monit: > > ensure => running, > > enable => true, > > hasrestart => true, > > if ($operatingsystem == ''centos'') { > > hasstatus => true, > > }, > > require => Package[''monit''], > > subscribe => File[''monit.conf''], > > } > > > And it doesn''t work in 24.6. Perhaps setting the variable outside will > > be better. In 0.24.7, the error is a bit worse. Instead of an error, > > the class is unfindable. :) > > Seehttp://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#selectors > > service { monit: > ... > hasstatus => $operatingsystem ? { > centos => true, > default => false, > }, > > } > > Regards > > James Turnbull > > - -- > Author of: > * Pulling Strings with Puppet > (http://www.amazon.com/gp/product/1590599780/) > * Pro Nagios 2.0 > (http://www.amazon.com/gp/product/1590596099/) > * Hardening Linux > (http://www.amazon.com/gp/product/1590594444/) > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (Darwin) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org > > iD8DBQFJUaXc9hTGvAxC30ARAqJUAJ42lAJN5SlEBrBER0rQTjBPNhN67ACeO5eI > ZusMWMn33RRYttjSj+3YEeY> =4u/8 > -----END PGP SIGNATURE-------~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---