Forum: Cfengine Help
Subject: Re: Cfeninge Help (Mailing list): Re: Iterations for convergence : 
vars do not iterate
Author: lefollfr
Link to topic: https://cfengine.com/forum/read.php?3,16228,16681#msg-16681

Hello,

As suggested, I opened a bug on the bug tracker, it was bug 0000062. It is now 
fixed, and closed.

I see that with rev 930, "vars" section now is iterated, thus variables finally 
become instanciated when possible.
This was what I was hoping, many thanks.

I do not want to reopen it, since the bug is fixed indeed ,but here are a few 
remarks :

"Obfuscation" : the example I gave was not obfuscated on purpose ; it was just 
as silly as many lab exercises :-), sorry for that. The purpose was to have a 
simple self-contained example.
The real life bundle I was working on was rather like this :
- determine the class(es) I belong to (who I am, where I am, ...)
- define variables depending on theses classes
- use the variables in file copies (adapt the servers list, edit_file with 
variable substitutions), in processes, ...

In the new example you give (note 0000078), you create a class when first 
report promise is repaired ("classes => def" where body class def specifies 
promise_repaired => { "xyz" };). I understand (may be wrong) that this is a 
trick to skip first round and produce a new report during round 2.
I guess it would be even better if the promise_repaired clause could be 
attached to the variable declaration !
But I tried to do that, with no success : cfengine accepts the classes clause 
in the vars sections, but it does not seem to have much effect. I can give a 
code example if it may help.

I also noticed that the new example does not work, as it is, at least with SVN 
rev 930. cf-agent returned two errors :
- Scalar item in promise_repaired => { xyz } in rvalue is out of bounds (value 
should match pattern .]+), near token '}'
- Body type mismatch for body reference "def" in promise at line 15 of 
./test-converge-m.cf
In order to make it work, I made two changes :
- choose another name for body class def, e.g. body class defg, in order to 
avoid conflict with variable scalar value "def"
- pass the promise_repaired class as an argument to body class defg
I think this has no connection with iteration on vars section. Did I miss 
something (still a newby with cfengine) ? Or should I open a bug report ?

B.R.

Frederic

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

Reply via email to