[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: class-dependent class definition
From: |
Wipf, Stefan |
Subject: |
Re: class-dependent class definition |
Date: |
Fri, 22 Nov 2002 09:43:56 -0600 |
you can use the 'import' directive:
import:
frebsd:: cf.frebsd
redhat:: cf.redhat
any:: cf.continue
cf.freebsd contains:
classes: sudo_installed = ( "/usr/sbin/pkg_info -x sudo" )
cf.redhat contains:
classes: sudo_installed = ( "/bin/rpm -q sudo" )
cf.continue contains the rest of your code as the class sudo_installed
will not get defined until after the current file has been parsed
Adrian Phillips wrote:
>
> >>>>> "Edward" == Edward O'Connor <oconnor@soe.ucsd.edu> writes:
>
> Edward> Hi there. I've recently set up sudo across our site via
> Edward> cfengine. The cfengine recipe first attempts to determine
> Edward> if sudo is installed, and, if it is not, it attempts to
> Edward> install it.
>
> Edward> 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::
> ...
>
> Hmm, how about (untested) :-
>
> control:
> freebsd::
> pkg_cmd = ( /usr/sbin/pkg_info -x )
>
> redhat::
> pkg_cmd = ( /bin/rpm -q )
>
> classes:
> sudo_installed = ( "${pkg_cmd} sudo" )
>
> Sincerely,
>
> Adrian Phillips
>
> --
> Your mouse has moved.
> Windows NT must be restarted for the change to take effect.
> Reboot now? [OK]
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine
--
Stefan Wipf