Hellos
I am beginning with Cfengine and trying to setup a method to validate a
list of servers to download files from, come up with this method, from a
slist of servers, do a file copy check, add to an array of servers. Up to
here seems ok
But when I try to read from the array don't get any data, some mistake I
am making on the arrays funtions?
Any hints are welcomed
Thanks,
Jose Neto
######################
body common control
{
bundlesequence => {
"policyserver_check" ,
"policyserver_show" ,
};
}
bundle agent policyserver_show
{
vars:
"parameter_name" slist =>
getindices("define_policy_server_array.policy_server_current");
reports:
cfengine::
"policyserver_select ::: $(parameter_name)
$(define_policy_server_array.policy_server_current[$(parameter_name)])";
}
bundle agent policyserver_check
{
vars:
"policyserver_ip" slist => { "192.168.100.101" ,
"192.168.100.102" };
"policyserver_name" slist => { "101" , "102" };
files:
"/tmp/check_server_$(policyserver_ip)"
copy_from =>
secure_cp("/Shared/CheckServer",$(policyserver_ip)),
classes => if_else("add_success_$(policyserver_name))",
"add_fail_$(policyserver_name)" );
methods:
"add_success_101_" usebundle
=> define_policy_server_array("192.168.100.101","101");
"add_success_102_" usebundle
=> define_policy_server_array("192.168.100.102","102");
}
bundle agent define_policy_server_array(server,name)
{
vars:
"policy_server_current[ip]" string => "$(server)";
"policy_server_current[name]" string => "$(name)";
"policy_server_current[status]" string => "OK";
reports:
cfengine::
"ADDED2Array: $(policy_server_current[ip])
$(define_policy_server_array.policy_server_current[name])";
}
body depth_search custom(d,list)
{
depth => "$(d)";
exclude_dirs => { @(list) };
}
body copy_from secure_cp(from,server)
{
source => "$(from)";
servers => { "$(server)" };
compare => "digest";
encrypt => "true";
verify => "true";
depth => "inf";
trustkey => "true";
timeout => "1";
}
body classes if_else(yes,no)
{
promise_kept => { "$(yes)" };
promise_repaired => { "$(yes)" };
repair_failed => { "$(no)" };
repair_denied => { "$(no)" };
repair_timeout => { "$(no)" };
}
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine