On Sun, Mar 13, 2011 at 9:02 PM, Nigel Kersten <[email protected]> wrote:
> On Thu, Mar 10, 2011 at 5:37 PM, Ian Mortimer <[email protected]> wrote:
>> Hi
>>
>> The service in this case is ypbind but it could apply to other
>> services.  The problem is that `service ypbind status' returns 0
>> if the service is running even if it's not bound to the domain.
>>
>> Replacing hasstatus with `status => "/usr/bin/ypwhich"' doesn't
>> fix it either because puppet will then try to start the service
>> (instead of restarting it) which fails because it's already running.
>>
>> To cover both cases (not running or running but not bound),  I
>> configured it like this:
>>
>>        service { "ypbind":
>>                ensure => running,
>>                enable => true,
>>                hasrestart => true,
>>                hasstatus => true,
>>                require => Package["ypbind"],
>>        }
>>        exec { "/sbin/service ypbind restart":
>>                path => ["/usr/bin", "/sbin"],
>>                unless => "ypwhich"
>>        }
>>
>> That works but I was wondering if there's a better way not
>> using exec.
>
> You might even need to specify so much logic you may as well deliver
> this as a script, but if you don't, I believe this should work.
>
> service { "ypbind":
>  ...
>  restart => "/usr/bin/ypbind && /usr/bin/ypwhich",
>  ...
> }
>

doh. ypbind still doesn't have an exit code...

Can you parse the output in a script to tell?

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to