Forum: CFEngine Help
Subject: unexpected int behavior
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,25526,25526#msg-25526
Consider this example
body common control {
bundlesequence => {
"main",
};
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent main {
vars:
'repo' string => '/tmp/svn/profile/${sys.cdate}';
'repo' string => 'file:///srv/svn/neil/profile';
'repo' int => '1';
methods:
"any" usebundle => svn_wc('main.repo');
}
bundle agent svn_wc(ref) {
vars:
'i' slist => getindices('${ref}');
'dir' string => '${${ref}[${i}]}';
'url' string => '${${ref}[${i}]}';
'hours' int => '${${ref}[${i}]}';
#'hours' string => '${${ref}[${i}]}';
files:
'${dir}'
delete => tidy,
file_select => hours_old('${hours}'),
depth_search => recurse('inf');
commands:
svn_wc_removed::
'/usr/bin/svn -q export ${url} ${dir}';
}
body file_select hours_old(hours)
{
mtime => irange(0,ago(0,0,0,"${hours}",0,0));
file_result => "mtime";
}
Cf-promises returns no error. Cf-agent however:
neil@ettin ~/.cfagent/inputs $ ../bin/cf-promises -f ./svn.cf
neil@ettin ~/.cfagent/inputs $ echo $?
0
neil@ettin ~/.cfagent/inputs $ cf-agent -IKf ./svn.cf
!! Duplicate selection of value for variable "hours" in scope svn_wc
!! Rule from ./cfengine_stdlib.cf at/before line 1373
neil@ettin ~/.cfagent/inputs $ echo $?
0
If I change hours from an int to a string the error goes away. Why is that?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine