Forum: CFEngine Help
Subject: Re: controlling redhat-style startup services via chkconfig
Author: matt_garman
Link to topic: https://cfengine.com/forum/read.php?3,24162,24168#msg-24168

neilhwatson Wrote:
-------------------------------------------------------
> I don't think the class in your called bundle will
> be global.  Classes are only global in common
> bundles and from classes bodies not classes
> actions.  
> 
> Instead pass the whole list to the method and run
> the reports in the called bundle.

Can you elaborate?

Are you suggesting that instead of this

"any" usebundle => rh_chkconfig_status(${service});

I do this

"any" usebundle => rh_chkconfig_status(@(check_service_enabled.service));

?

If so, I tried that, and it has the same result.

Maybe I have too much of a "programmer's mindset", and am looking at this all 
wrong.  But when I look at this:

bundle agent check_service_enabled
{           
    vars:   
        need_ntp::  "service" slist  => { "ntpd", "named" };
        !need_ntp:: "service" slist  => { "named" };
            
    methods:
        redhat|centos|SuSE::
            "any" usebundle => rh_chkconfig_status(${service});

    reports:
        need_ntp:: "need NTP";
        !need_ntp:: "do NOT need NTP";
}

, I think to myself: if this were a programming language, the "function" 
rh_chkconfig_status() doesn't need to know anything about the "need_ntp" 
conditional.  In other words, I would expect that when rh_chkconfig_status() is 
run, it already has the "service" slist populated, and no longer cares about 
the conditions (i.e. classes) that generated the list.

Maybe I didn't understand what you wrote.  :)

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to