Rudy Gevaert
2010-Nov-19 18:25 UTC
[Puppet Users] Service[](provider=smf): Could not get status on service
Hi puppet users I''m trying to get around the following issue. I want to make sure if a service is stopped. I''m trying to do this is solaris but I don''t think this is OS specific. If the software that provides the service (sendmail in my cause) is installed the smf provider can make sure that the service is not running. However, when the software is not installed it can not check: info: Service[sendmail](provider=smf): Could not get status on service sendmail How can I get around this? I could get around it with onlyif, but the service type doesn''t support that. Below is a snippet of my code. Thank you in advance, Rudy class postfix { if $operatingsystem == ''Solaris'' { Service["sendmail"] -> Package["SUNWsndmu"] -> Package["SUNWsndmr"] -> Package["postfix"] service { "sendmail": ensure => stopped, } package { ["SUNWsndmu","SUNWsndmr"]: ensure => absent, provider => sun, adminfile => "/var/sadm/install/admin/puppet"; ["postfix","mailx"]: ensure => present, provider => pkgutil } ... } ... } -- 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.
Stefan Schulte
2010-Nov-19 20:49 UTC
Re: [Puppet Users] Service[](provider=smf): Could not get status on service
On Fri, Nov 19, 2010 at 10:25:30AM -0800, Rudy Gevaert wrote:> Hi puppet users > > I''m trying to get around the following issue. I want to make sure if > a service is stopped. I''m trying to do this is solaris but I don''t > think this is OS specific. > > If the software that provides the service (sendmail in my cause) is > installed the smf provider can make sure that the service is not > running. > > However, when the software is not installed it can not check: > info: Service[sendmail](provider=smf): Could not get status on service > sendmailSo you want to remove a package and make sure that the service is stopped before that. I can think of a few options: - remove the service resource: When you remove a package there should be a pre_exec or something that stops your service. But I dont know if Solaris has any support for that - onlyif is only supported by the exec resource. You can define something like /etc/init.d/package stop ... onlyif => ''pkginfo | grep PACKAGE'' - Request a feature that all service providers should return stopped if the state could not be determined. But that might raise other problems - Build a custom fact that will show you if your package is installed. Then you can build an if statement around your ressource. Not really great if you want to manage more than one package I prefer number one but that might not be possible. I''m curious what others think about your problem. -Stefan
Daniel Pittman
2010-Nov-20 00:42 UTC
Re: [Puppet Users] Service[](provider=smf): Could not get status on service
Stefan Schulte <stefan.schulte@taunusstein.net> writes:> On Fri, Nov 19, 2010 at 10:25:30AM -0800, Rudy Gevaert wrote: >> >> I''m trying to get around the following issue. I want to make sure if >> a service is stopped. I''m trying to do this is solaris but I don''t >> think this is OS specific. >> >> If the software that provides the service (sendmail in my cause) is >> installed the smf provider can make sure that the service is not >> running. >> >> However, when the software is not installed it can not check: >> info: Service[sendmail](provider=smf): Could not get status on service >> sendmail > > So you want to remove a package and make sure that the service is > stopped before that. I can think of a few options: > > - remove the service resource: When you remove a package there should be > a pre_exec or something that stops your service. But I dont know if > Solaris has any support for that > - onlyif is only supported by the exec resource. You can define > something like > /etc/init.d/package stop ... onlyif => ''pkginfo | grep PACKAGE'' > - Request a feature that all service providers should return stopped > if the state could not be determined. But that might raise other > problemsI think this is actually the correct path, although it might not be the expedient path: I ran into a similar issue with the ''runit'' service provider, which would raise an exception and abort the puppet run[1] if it couldn''t find the service directory. In my eyes the providers should do something sensible, or as sensible as possible, such as taking the view that if asked to ensure => stopped, and the package is not present, you have done everything that was asked of you. (At least, as much as programmaticly possible, anyhow. :)> - Build a custom fact that will show you if your package is installed. > Then you can build an if statement around your ressource. Not really > great if you want to manage more than one package > > I prefer number one but that might not be possible. I''m curious what > others think about your problem.I view that sort of problem as a bug. Daniel Footnotes: [1] ...back in the dark ages, when 0.24 was shiny and new, and I have not actually checked it since, so this might well have gone away by now. -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- 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.
Rudy Gevaert
2010-Nov-22 09:28 UTC
[Puppet Users] Re: Service[](provider=smf): Could not get status on service
Hi Stefan, On Nov 19, 9:49 pm, Stefan Schulte <stefan.schu...@taunusstein.net> wrote:> So you want to remove a package and make sure that the service is > stopped before that. I can think of a few options: > > - remove the service resource: When you remove a package there should be > a pre_exec or something that stops your service. But I dont know if > Solaris has any support for thatIf the package has the preremove script it does that. However the packages I want to remove don''t have that those scripts.> - onlyif is only supported by the exec resource. You can define > something like > /etc/init.d/package stop ... onlyif => ''pkginfo | grep PACKAGE'' > - Request a feature that all service providers should return stopped > if the state could not be determined. But that might raise other > problems > - Build a custom fact that will show you if your package is installed. > Then you can build an if statement around your ressource. Not really > great if you want to manage more than one package > > I prefer number one but that might not be possible. I''m curious what > others think about your problem.Number two seems to be a goot alternative if I just send the order correct! Rudy -- 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.
jcbollinger
2010-Nov-22 15:09 UTC
[Puppet Users] Re: Service[](provider=smf): Could not get status on service
On Nov 19, 12:25 pm, Rudy Gevaert <rudy.geva...@gmail.com> wrote:> I''m trying to get around the following issue. I want to make sure if > a service is stopped. I''m trying to do this is solaris but I don''t > think this is OS specific.[...]> when the software is not installed it can not check: > info: Service[sendmail](provider=smf): Could not get status on service > sendmailYou are asking for Puppet to ignore the difference between two distinct system states: 1) sendmail is installed but not running, and 2) sendmail is not installed. The smf provider could surely be locally modified to do that, and that might prove convenient for you. I don''t favor that as default behavior, however. What about choosing just one of the above options and enforcing that? Puppet can handle either. John -- 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.