help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

class-dependent class definition


From: Edward O'Connor
Subject: class-dependent class definition
Date: 21 Nov 2002 13:18:11 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi there.

I've recently set up sudo across our site via cfengine. The
cfengine recipe first attempts to determine if sudo is installed,
and, if it is not, it attempts to install it.

I first tried to do something like this:

    classes:
        freebsd::
            sudo_installed = ( "/usr/sbin/pkg_info -x sudo" )
        redhat::
            sudo_installed = ( "/bin/rpm -q sudo" )

    shellcommands:
        freebsd.!sudo_installed::
            ...
        redhat.!sudo_installed::
            ...

This didn't work, as definitions in classes: sections evidently
can't be conditionalized on other classes (though I could not find
this mentioned in the documentation).

I've ended up settling on this solution:

    classes:
        sudo_installed = ( "/usr/sbin/pkg_info -x sudo"
                           "/bin/rpm -q sudo" )

    shellcommands:
        freebsd.!sudo_installed::
            ...
        redhat.!sudo_installed::
            ...

I think the former, illegal version is cleaner since I can ensure
these shell commands are only executed on hosts on which it makes
sense to execute them. Does anyone have a suggestion for how to do
that? Thanks.


Ted

-- 
Edward O'Connor
oconnor@soe.ucsd.edu





reply via email to

[Prev in Thread] Current Thread [Next in Thread]