Forum: CFEngine Help
Subject: am_policy_hub class set after common bundles?
Author: terok
Link to topic: https://cfengine.com/forum/read.php?3,25731,25731#msg-25731

Hi,

Out of curiosity, when is am_policy_hub class suppose to be set?
Did some testing and it's somehow set only _after_ the common bundles are 
evaluated. 
I would expect it to be one of the first classes that the agent sets.

Running the following on policy_hub:


body common control
{
    bundlesequence => { "example" };
}


bundle common g
{
vars:  

        "host1"           string => "10.10.10.10";
        "host2"           string => "10.11.11.11";

am_policy_hub::
        "target" string => "$(g.host1)",
        policy => "free";
!am_policy_hub::
        "target" string => "$(g.host2)",
        policy => "free";

reports:
        linux::
                "Target set in common: $(g.target)";

}

bundle agent example

{

classes:
        "i_am_hub"      expression => "am_policy_hub";

reports:
        linux::
                "Target set in sequence: $(g.target)";
        i_am_hub::
                "I am the policy hub!";

}



This will give me the 'wrong' target.


# cf-agent -K -f ./am_policy_hub.cf 
R: Target set in sequence: 10.11.11.11
R: I am the policy hub!


Now, if I add the *g* bundle to the sequence, then I get the target that I'd 
expect.


# cf-agent -K -f ./am_policy_hub.cf 
R: Target set in common: 10.10.10.10
R: Target set in sequence: 10.10.10.10
R: I am the policy hub!


Which brings me to another question. Is there any downside including common 
bundles to the bundlesequence?

/Tero

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

Reply via email to