Forum: CFEngine Help
Subject: update.cf: multiple "copy_from" servers
Author: davidlee
Link to topic: https://cfengine.com/forum/read.php?3,23162,23162#msg-23162

(cfengine community 3.1.4; RHEL 5.x)

I'm a great believer in using what is already there, rather than re-inventing 
the wheel myself.  But there's something in "update.cf" which seems suboptimal 
and might drive me, reluctantly, down the "re-invent it" path.

>From the top-level, what I want is for "update.cf", when checking 
>"/var/cfengine/inputs", to try one server, and if that times out, then to try 
>another in the list.

Now the "copy_from" compound body has a "servers" which takes a list, and the 
manual defines that as "the servers are tried in order until one of them 
succeeds".  That sounds good.  Very good.  In theory.

BUT... what is written in "update.cf" seems only to allow a single-item list:

=========================
bundle agent update
{
vars:
 "master_location" string => "/var/cfengine/masterfiles";
files:
  "/var/cfengine/inputs"
    ...
    copy_from => mycopy("$(master_location)","single.ip.number"),
    ...
}

body copy_from mycopy(from,server)
{
  source      => "$(from)";
  servers     => { "$(server)" };
  ...
}
=========================

I'm assuming that the distributed cfengine "update.cf" is supposed to be both 
robust, and an example of best practice.

Because it is (I presume) robust, I don't want to tinker with it, for fear of 
de-stabilising it.  Because it is (I presume) "best practice" I don't want to 
tinker with it, because I get the feeling I must be missing something obvious 
and shouldn't have to re-invent it.

But unless I've mis-understood (quite likely!) this code only permits trying 
one IP number.  Wouldn't it be better if the recommended, distributed 
"update.cf" allowed the list nature of "servers" to be properly available to 
the end-user?

(For my current issue, is there a known-good, recommended, list-based version 
of the above code?)

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

Reply via email to