Hi List
I'm seeing some confusing behaviour in 3.0.4 that wasn't occurring in
3.0.3. Consider the following 2 bundles, designed to populate 2
independent files with 2 fields of the form <name>=<value> :
(note: target files are blanked before each test run.)
============
bundle agent write_fileA
{
vars:
"value_map[keyA][0]" string => "alpha";
"value_map[keyA][1]" string => "beta";
"fileA[fieldA]" string => "$(value_map[keyA][0])";
"fileA[fieldB]" string => "$(value_map[keyA][1])";
files:
"/tmp/fileA"
edit_defaults => empty,
edit_line => set_variable_values("write_fileA.fileA");
}
============
bundle agent write_fileB
{
vars:
"value_map[keyA][0]" string => "charlie";
"value_map[keyA][1]" string => "delta";
"fileB[fieldA]" string => "$(value_map[keyA][0])";
"fileB[fieldB]" string => "$(value_map[keyA][1])";
files:
"/tmp/fileB"
edit_defaults => empty,
edit_line => set_variable_values("write_fileB.fileB");
}
============
In CF3.0.3 when I execute the above bundles I get 2 files with the
correct, desired contents:
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
[r...@host bin]#
If I add an additional field to the fileA bundle, such that the array
looks like this:
"fileA[fieldA]" string => "$(value_map[keyA][0])";
"fileA[fieldB]" string => "$(value_map[keyA][1])";
"fileA[fieldC]" string => "$(value_map[keyA][1])";
I see the correct file contents:
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
fieldC=beta
[r...@host bin]#
At this point I substitute 3.0.3 binaries for 3.0.4 binaries and re-run
the first test (2 fields defined per bundle). Post execution, I see the
following correct output:
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
[r...@host bin]#
If I now add a 3rd field to the fileA bundle (as before), I get the
following output:
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
fieldC=beta
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
fieldC=$(write_fileB.fileB[fieldC])
Conversely, if I add the 3rd field definition to fileB only, I see the
following file contents:
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
[r...@host bin]#
...the 3rd field definition is missing entirely. Finally, if I add the 3rd
field definition to both bundles, I get the expected output:
[r...@host bin]# cat /tmp/fileA
fieldA=alpha
fieldB=beta
fieldC=beta
[r...@host bin]# cat /tmp/fileB
fieldA=charlie
fieldB=delta
fieldC=delta
[r...@host bin]#
Is this behaviour the result of a bugfix in 3.0.4 and my approach was
wrong in the first place?
I rm -rf'd /var/cfengine directory and performed a fresh install of 3.0.4
to confirm it wasn't residual incompatibility between 3.0.4 binaries in a
3.0.3 environment, but the behavior persists. I also tried adjusting the
variable names to remove any possible ambiguity or naming conflicts, but
that didn't help either.
...or is this all just because it's 1am on a weeknight? ;)
Regards
Steve
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine