On Fri, Nov 14, 2008 at 8:43 AM, RijilV <[EMAIL PROTECTED]> wrote:

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


Hi RijilV,

Both points are true.  I could use onlyif and/or depend on my init script.
However, there may be other puppet dependencies that fail.  For example,
let's assume the following:

class squid::squidguard inherits squid {

    file { "squidguard.conf":
        path   => "/etc/squid/squidguard.conf",
        ensure => file,
        owner  => "root",
        group  => "squid",
        mode   => 0640,
        source => [
            "puppet:///squid/squidguard/config/squidguard.conf"
        ],
    }

    exec { "rebuild-squidguard-db":
        command     => "/usr/bin/squidGuard -C all",
        subscribe   => File["squidguard.conf"],
        refreshonly => true,
    }

    Exec["reload-squid"] {
        subscribe +> Exec["rebuild-squidguard-db"],
    }
}

In this case, the squid -k parse would pass, and the squid init script would
exit successfully, so squid would never detect a problem.  However, squid
would have problems functioning at run time (i.e., sending to the
redirector) if the squidguard.conf file was invalid, or if the db files were
built incorrectly.  I could, of course, add this to squid's onlyif statement
as well, but it's not as self-contained.  Dependencies on other puppet type
instances has great utility.

On a semi-related note, transactional support is mentioned briefly on
http://reductivelabs.com/trac/puppet/wiki/TypeReference .  Does
transactional support aim to solve what I'm trying to do (i.e.,
automatically prevent bad configurations from entering and/or restore
previous configuration if something fails)?

Regards,
Casey

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