[CentOS] Scope of classes in CFE 3.10.2 on CentOS 7 [SOLVED]

Fri Jul 12 12:11:09 UTC 2019
Meikel <meikel at fn.de>

Am 10.07.2019 um 18:07 schrieb Meikel:
> Thanks in advance for any help or explanation of that behaviour.

Hi folks,

yesterday in the IRC I got an answer which explains everything for me, 
so from my point of view my question is answered and the problem is solved.

In short with my words:

The bundle scope_of_class_b1 is called one time for each entry in the 
slist, so it is called three times.

The promisee of the "reports" type is

    "is_dir is SET"

and even if the class "is_dir" is set in two of the three executions, 
the "report" is print out only once, because the promisee is the same, 
and a promise for the same promisee is only kept/repaired/executed only 
once in an agent run. To get the expected output the promisee of the 
"reports" has to be rewritten to become unique for each execution, i.e. 
adding $(server) like this:

   reports:
     is_dir::
       "is_dir is SET";
     is_dir::
       "$(server): is_dir is SET";
     !is_dir::
       "$(server): is_dir is UNset";

I kept "is_dir is SET" to better show the difference. It gives the 
following result:

# cf-agent -IK --file ./samples/scope_of_class.cf --bundlesequence 
scope_of_class
     info: Using command line specified bundlesequence
R: is_dir is SET
R: ws-1.example.com: is_dir is SET
R: ws-2.example.com: is_dir is UNset
R: webserver.example.com: is_dir is SET

The output "is_dir is SET" is never shown more than once in one agent 
run, even if all three directories exist, but if the promisee becomes 
unique, i.e. "ws-1.example.com: is_dir is SET" vs. 
"webserver.example.com: is_dir is SET" then they're both print out.

The problem is NOT, that the definition/evaluation of the class "is_dir" 
does not work as expected, it works as expected, but I didn't see it in 
the output, because my expectation of what to see was wrong.

As I don't have skills in CFE my wording might be imprecise, I'm sorry, 
hopefully the idea became clear.

Regards,

Meikel