class and !class at the same time

9 views
Skip to first unread message

Christian Linden

unread,
Dec 6, 2016, 9:41:45 AM12/6/16
to help-cfengine
Hi,

after defining the namespace:

body file control
{
        namespace => "HSLinux";
}


I define this class:
classes:
                "tsm_node_registered" expression => regextract(".*NODE_NAME.*--------.*$(f_q_d_n).*", "$(reg_or_not)", "myArray"), scope => "namespace";


The class is set as this report:
reports:
                tsm_node_registered::
                        "tsm_node_registered is set";

gets reported.

In another promise I define the same namespace in body file control as above.
But the same report is not being reported == the class is not set in the 2nd promise.

How is that possible?

Running  Core 3.7.2

Thanks,
Chris


Diego Zamboni

unread,
Dec 6, 2016, 10:15:57 AM12/6/16
to Christian Linden, help-cfengine
Hi Christian,

In another promise I define the same namespace in body file control as above.
But the same report is not being reported == the class is not set in the 2nd promise.

“report” promises are like any other promise - they have a lockout time (by default 1 minute) during which they will not be executed again. So if you are attempting to print the exact same message, it will not get printed twice. Have you tried making the strings different?

(of course, it’s also possible that the class is getting somehow undefined between the first and the second “reports:" promise)

Hope this helps,
—Diego


--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.

Christian Linden

unread,
Dec 6, 2016, 10:18:50 AM12/6/16
to help-cfengine
Hi Diego,

it's not the same string exactly, hence that's not the problem.
The class is getting undefined for whatever reason.
Even if I redefine it in the 2nd promise the value is the !value.

Thanks,
Chris

Marco Marongiu

unread,
Dec 6, 2016, 10:21:13 AM12/6/16
to help-c...@googlegroups.com
Can't make sense of it at a glance. Does this apply to your case by any
chance?

https://syslog.me/2013/06/06/classes-dont-blink/

-- M

Christian Linden

unread,
Dec 6, 2016, 10:33:43 AM12/6/16
to help-cfengine
More the opposite: first the class gets defined, with scope => "namespace";
Then, bundle-sequencely later, it's "suddenly" undefined in the same namespace.
Hence it's against what you say: once set it remains set. 
I see the opposite.

c

Diego Zamboni

unread,
Dec 6, 2016, 10:42:38 AM12/6/16
to Christian Linden, help-cfengine
Can you post a self-contained (as small as possible) example that shows the behavior?

You could also try running it in verbose mode to see if there’s something about the class getting defined/undefined.

—Diego


Christian Linden

unread,
Dec 6, 2016, 11:00:01 AM12/6/16
to help-cfengine, lindo...@gmail.com
I fixed it by changing the bundle sequence.
I though that the 2nd promise is posterior but it was not.
It looks to me like someone changed my defined sequence.
.. learned here how important the bundle sequence is.

But this means that classes defined in the last bundlesequence are undefinded again when starting the next agent run?

c

Aleksey Tsalolikhin

unread,
Dec 6, 2016, 1:04:18 PM12/6/16
to Christian Linden, help-cfengine
Classes exist during the agent run only. if you want your classes to persist between runs, use "persistent" classes, which live up to TTL:

# classes.cf bundle common setclasses { classes: "persistent_classes" # timer flag expression => "any", persistence => "480"; "my_persistent_class" or => { ...long list or heavy function... } , persistence => "480"; }

--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengine+unsubscribe@googlegroups.com.

Christian Linden

unread,
Dec 6, 2016, 2:46:49 PM12/6/16
to Aleksey Tsalolikhin, help-cfengine
Thanks for clarifying, Aleksey!

c
Reply all
Reply to author
Forward
0 new messages