Forum: CFEngine Help
Subject: Re: Evaluation of bundlesequence with constructed mybundle(@(args))
Author: jblaine
Link to topic: https://cfengine.com/forum/read.php?3,23499,23552#msg-23552
I'm still failing miserably. The only differences I can see is that I'm
passing a list to my "method" bundle and your example passes a scalar ... and I
then have to pass mine on to an edit_line part.
If anyone can see anything wrong, please point it out to me?
!! List parameter "servers" not found while constructing scope
"ntpclient_config_edit" - use @(scope.variable) in calling reference
Scalar variable ntpclient_config_edit.servers contains itself (non-convergent):
@(servers)
body common control
{
bundlesequence => { "main" };
# this works fine
inputs => { @(g.inputfiles) };
}
bundle common g
{
vars:
any::
"commoninputs" slist => {
"cfengine_stdlib.cf",
"all.cf"
};
"inputfiles" slist => {
@(commoninputs),
},
policy => "free";
site_x::
"ntpservers" slist => {
"time.sitex.our.org",
"time.sitey.our.org",
};
"inputfiles" slist => {
@(commoninputs),
"site_x.cf",
},
policy => "free";
}
bundle agent main
{
methods:
site_x:
"site_x" usebundle => system_ntpclient_configure(@(g.ntpservers));
}
bundle agent system_ntpclient_configure(servers)
{
files:
any::
# Using @(g.ntpservers) here would mean this bundle could not be
reused
# unless implementers set some global var, which is lame.
"/etc/ntp.conf"
edit_line => ntpclient_config_edit(@(servers));
}
bundle edit_line ntpclient_config_edit(servers)
{
delete_lines:
".*";
insert_lines:
"#############################################################
### This file is configured by CFEngine.
### Manually editing the file might lead CFEngine
### to change back its content
#############################################################
server 127.127.1.0
fudge 127.127.1.0 stratum 10"
insert_type => "preserve_block",
location => start;
# Using $(g.ntpservers) here would mean this bundle could not be reused
# unless implementers set some global var, which is lame.
"server $(servers)";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine