On Wed, Apr 18, 2012 at 6:09 AM,  <no-re...@cfengine.com> wrote:
> Forum: CFEngine Help
> Subject: copy_from: would like priority list of sources, then silent fail
> Author: davidlee
> Link to topic: https://cfengine.com/forum/read.php?3,25584,25584#msg-25584
>
> (RHEL 5.x (~35 and growing);  cfengine: mostly community 3.1.4;  starting 
> migration to 3.3.0)
>
> We have several instances where our client machines use "copy_from" to import 
> a file or a hierarchy from a single source on the central repository, and for 
> which the absence of the file or hierarchy root in that source should be 
> reported an error.  That's fine.
>
> But there is one particular case where I'd like the source to be something 
> like:
>
>   try-file-location-1
>   fall-back-to-file-location-2
>   fall-back-to-file-location-3
>   ...
>   silently skip

Great, davidlee.

You can do that as 3 files promises; and if the first one is not kept,
then do the 2nd one; if the 2nd one is not kept, then do the 3rd one.

Each files promise would have a copy_from attribute with a different
source directory.

You can bundle that up to abstract the details:

{{{
methods:

   "any"

      usebundle =>
try_to_copy_a_few_times("target_dir","sourcedir1","sourcedir2","sourcedir3",
"server");

}}}

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

Reply via email to