2008/11/13 Casey Deccio <[EMAIL PROTECTED]>

> Hi,
>
> I'd like to be able to use subscribe with exec to refresh when files
> change, but I'd like each refresh to be dependent on another exec--e.g., to
> test configuration syntax.  The closest I've been able to come is what I
> have below (I've removed some of the rest of the detail), but the problem is
> that reload-squid will get triggered every time check-squid runs, regardless
> of undesired return status.  I've tried a few other variants, with similar
> success.  Any other ideas?  The ideal option would be to restore from backup
> if a particular exec fails.  Is anything like that available or in the
> roadmap?
>
> Regards,
> Casey
>
> ---------
>
> class squid {
>    file { "squid.conf":
>       path => "/etc/squid/squid.conf",
>       ensure => file,
>       owner => "root",
>       group => "squid",
>       mode => 0640,
>       source => [
>             "puppet://$server/squid/squid.conf"
>       ],
>    }
>    exec { "check-squid":
>       command => "/usr/sbin/squid -k parse",
>       subscribe => File["squid.conf"],
>       refreshonly => true,
>    }
>    exec { "reload-squid":
>       command => "/etc/init.d/squid reload",
>       subscribe => Exec["check-squid"],
>       refreshonly => true,
>    }
> }
>
>
In this case you could be kinda sneaky and use the 'onlyif' parameter:


exec { "reload-squid":
    command => "/etc/init.d/squid reload",
    subscribe => Exec["check-squid"],
    refreshonly => true,
    onlyif => "/usr/sbin/squid -k parse",
}


Though in all honesty your init script should be doing that check (the one I
just looked at for my setup does) so you could just you the service type.

.r'

--~--~---------~--~----~------------~-------~--~----~
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