fixed update of inputs
[cfengine-masterfiles.git] / inputs / update.cf
blobdc8b024ea632d9125991d73e23ba56890b9d7e70
1 #################################################
2 #                                               #
3 # upate.cf - Promises for updating policy files #
4 #                                               #
5 #################################################
7 bundle agent update {
9 vars:
11     "u_workdir"     string => "/var/lib/cfengine3";
12     "u_policyhost"  string => "cfengine.lan0";
14 classes:
16     "u_policy_servers" or => { classify("$(u_policyhost)") };
18 files:
20     "$(u_workdir)/."
22         comment         => "Set proper permissions of the work directory",
23         create          => "true",
24         perms           => u_workdir_perms("0600");
26     u_policy_servers::
28         "$(u_workdir)/masterfiles/."
30             comment         => "Set proper permissions of the $(u_workdir)/masterfiles directory",
31             create          => "true",
32             perms           => u_workdir_perms("0600"),
33             depth_search    =>  u_recurse("inf");
35         "$(u_workdir)/inputs/."
37             comment         => "Set permissions of input files on policy servers",
38             create          => "true",
39             perms           => u_workdir_perms("0600"),
40             depth_search    => u_recurse("inf");
42     !u_policy_servers::
44         "$(u_workdir)/inputs/."
46             comment         => "Update input files from policy server",
47             create          => "true",
48             perms           => u_workdir_perms("0600"),
49             depth_search    => u_recurse("inf"),
50             copy_from       => u_policy_copy("$(u_policyhost)");
54 # u_workdir_perms
55
57 body perms u_workdir_perms(mode) {
58     mode    => "$(mode)";
59     owners  => { "root" };
60     groups  => { "root" };
64 # u_policy_copy
67 body copy_from u_policy_copy(server) {
68     source      => "$(u_workdir)/inputs";
69     servers     => { "$(u_policyhost)" };
70     compare     => "digest";
71     purge       => "true";
72     copy_backup => "false";
76 # u_recurse
79 body depth_search u_recurse(d) {
80     depth   => "$(d)";
81     xdev    =>  "true";