Is it possible to assert (or de-assert) a class based on a package
promise?  What I really want to do is check to see if a package is
already installed, but not duplicate work by calling both a packages:
action, and second returnszero() call.

For example, I have this (and it works):

<------------snip-------------->
bundle agent mpt {

vars:
     'mpt_packages' slist => {
         'mpt-status',
     };

classes:
     any::
         "has_mpt_controller" expression => returnszero('/sbin/lspci | 
/bin/grep -q Fusion-MPT', 'useshell');

     has_mpt_controller::
         "has_mptctl"     expression => isplain("/dev/mptctl");
         "has_mpt_status" expression => returnszero("/bin/rpm -q --quiet 
mpt-status",'noshell');


commands:
     has_mpt_controller.!has_mptctl::
         "/sbin/modprobe mptctl" contain => cmdnoshell;

        has_mpt_controller.has_mpt_status::
                "/usr/local/adm/bin/mpt_status_wrapper.sh" contain => 
cmdnoshell;

packages:
     has_mpt_controller::
         "${fileserver_packages}"
             package_policy        => "add",
             package_method        => yum,
             package_architectures => { "x86_64" };
}
<------------snip-------------->


At issue is that there are two separate checks for the 'mpt_status'
package.  One happens in packages:, the other in classes:.  What I'd
like, sort of, is something like this:

   packages:
     has_mpt_controller::
         "${fileserver_packages}"
             package_policy        => "add",
             package_method        => yum,
             package_architectures => { "x86_64" },
             classes               => 
is_okay("package_installed_${fileserver_packages}");
                        
This would define a new class for each element of the
${fileserver_packages} list.

Am I completely missing the ability to do this somewhere already?


-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to