I''d like to be able to put specific modules into ''maintenance'' mode if a variable has been set. I can check the variable, but the only way I can see to have puppet skip processing is to use the fail() function, which stops everything with a nasty error message. Is there a return() function or similar??? Doug. -- 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.
On Dec 21, 4:38 pm, Douglas Garstang <doug.garst...@gmail.com> wrote:> I''d like to be able to put specific modules into ''maintenance'' mode if a > variable has been set. I can check the variable, but the only way I can see > to have puppet skip processing is to use the fail() function, which stops > everything with a nasty error message. Is there a return() function or > similar??? > > Doug.There''s no way to ''uninclude'' a class once it''s in the catalog. I''d probably do this with an include one level up which determines whether to do the work or not. Does this example make sense? class service1 { if $service1_state == "enabled" { include service1::enabled } else { maintenance{ $name: } # $name refers to the class, issue #1104 } } class service1::enabled { # Do actual work here service { "service1": enabled => true } } # just a cheap wrapper to log on both client and server define maintenance($message="in maintenance mode") { notify{ "$name": loglevel => ''warning'', message => "$name $message" } warning("$name $message") } -- 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.
On Tue, Dec 21, 2010 at 9:44 PM, donavan <donavan@desinc.net> wrote:> On Dec 21, 4:38 pm, Douglas Garstang <doug.garst...@gmail.com> wrote: > > I''d like to be able to put specific modules into ''maintenance'' mode if a > > variable has been set. I can check the variable, but the only way I can > see > > to have puppet skip processing is to use the fail() function, which stops > > everything with a nasty error message. Is there a return() function or > > similar??? > > > > Doug. > > There''s no way to ''uninclude'' a class once it''s in the catalog. I''d > probably do this with an include one level up which determines whether > to do the work or not. Does this example make sense? > > class service1 { > if $service1_state == "enabled" { > include service1::enabled > } else { > maintenance{ $name: } # $name refers to the class, issue #1104 > } > } > class service1::enabled { > # Do actual work here > service { "service1": enabled => true } > } > # just a cheap wrapper to log on both client and server > define maintenance($message="in maintenance mode") { > notify{ > "$name": loglevel => ''warning'', message => "$name $message" > } > warning("$name $message") > }Thanks. That should do it. Like a lot of things in puppet, not pretty, but it will get the job done. -- 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.
> Thanks. That should do it. Like a lot of things in puppet, not pretty, but > it will get the job done.I think your idea is not that bad and it''s simply not *yet* possible with puppet. Hence, the best goal towards a pretty solution in puppet is to raise a feature request for such a function: http://projects.puppetlabs.com/projects/puppet ~pete -- 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.