~tieto/+junk/cfengine3

« back to all changes in this revision

Viewing changes to tests/units/.svn/text-base/unit_update.cf.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Antonio Radici
  • Date: 2010-04-30 08:11:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100430081120-qjlb3etnasi7mr0a
Tags: 3.0.4+dfsg-1
 * debian/watch: modified to catch the newest versions
 * debian/control:
    + removed DMUA
    + bumped Standards-Version to 3.8.4 (no changed needed)
 * debian/patches:
    + all patches refreshed
    + rename-doesnt-fail: removed, it is incorporated upstream
    + added some more typos to patches/fix-error-typos
* Switch to dpkg-source 3.0 (quilt) format
    + debian/control: removed quilt from B-D
    + debian/rules: removed patch/unpatch and quilt include
    + debian/README.source removed
* debian/cfengin3.lintian-overrides:
    + overridden a spelling error (it is not)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#  Copyright (C) Cfengine AS
 
2
 
 
3
#  This file is part of Cfengine 3 - written and maintained by Cfengine AS.
 
4
 
 
5
#  This program is free software; you can redistribute it and/or modify it
 
6
#  under the terms of the GNU General Public License as published by the
 
7
#  Free Software Foundation; version 3.
 
8
 
 
9
#  This program is distributed in the hope that it will be useful,
 
10
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
#  GNU General Public License for more details.
 
13
 
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
 
17
 
 
18
# To the extent this program is licensed as part of the Enterprise
 
19
# versions of Cfengine, the applicable Commerical Open Source License
 
20
# (COSL) may apply to this file if you as a licensee so wish it. See
 
21
# included file COSL.txt.
 
22
 
 
23
#cop update,example
 
24
#cop What should a failsafe and update file contain?,example
 
25
 
 
26
# Minimum failsafe
 
27
 
 
28
body common control
 
29
{
 
30
bundlesequence => { "update" };
 
31
}
 
32
 
 
33
bundle agent update
 
34
{
 
35
vars:
 
36
 
 
37
 "master_location" string => "$(sys.workdir)/masterfiles";
 
38
 
 
39
 "policy_server"   string => readfile("$(sys.workdir)/policy_server.dat",40),
 
40
                      comment => "IP address to locate your policy host.";
 
41
 
 
42
classes:
 
43
 
 
44
  "policy_host" or => { 
 
45
                      classmatch(canonify("ipv4_$(policy_server)")),
 
46
                      classmatch(canonify("$(policy_server)"))
 
47
                      },
 
48
 
 
49
                   comment => "Define the ip identity of the policy source host";
 
50
 
 
51
  "have_ppkeys" expression => fileexists("$(sys.workdir)/ppkeys/localhost.pub");
 
52
 
 
53
  "nofile" expression => fileexists("$(sys.workdir)/policy_server.dat");
 
54
 
 
55
commands:
 
56
 
 
57
 !have_ppkeys::
 
58
 
 
59
   "/usr/local/sbin/cf-key";
 
60
 
 
61
files:
 
62
 
 
63
  "/var/cfengine/inputs" 
 
64
 
 
65
    handle => "update_policy",
 
66
    perms => u_p("600"),
 
67
    copy_from => u_scp("$(master_location)"),
 
68
    depth_search => u_recurse("inf"),
 
69
    action => immediate;
 
70
 
 
71
  "/var/cfengine/bin" 
 
72
 
 
73
    perms => u_p("700"),
 
74
    copy_from => u_scp("/usr/local/sbin"),
 
75
    depth_search => u_recurse("inf"),
 
76
    action => immediate;
 
77
 
 
78
processes:
 
79
 
 
80
  any::
 
81
 
 
82
    "cf-execd" restart_class => "start_exec";
 
83
 
 
84
  policy_host::
 
85
 
 
86
    "cf-serverd" restart_class => "start_server";
 
87
 
 
88
commands:
 
89
 
 
90
 start_exec::
 
91
  "$(sys.workdir)/bin/cf-execd",
 
92
   action => logme("executor");
 
93
 
 
94
 start_server::
 
95
  "$(sys.workdir)/bin/cf-serverd",
 
96
   action => logme("server");
 
97
 
 
98
reports:
 
99
 
 
100
  bootstrap_mode.policy_host::
 
101
 
 
102
      "I am the policy host - i.e. with ipv4 address $(policy_server)";
 
103
 
 
104
}
 
105
 
 
106
############################################
 
107
 
 
108
body action logme(x)
 
109
{
 
110
log_repaired => "stdout";
 
111
logstring => " -> Started the $(x) (success)";
 
112
}
 
113
 
 
114
############################################
 
115
 
 
116
body perms u_p(p)
 
117
 
 
118
{
 
119
mode  => "$(p)";
 
120
}
 
121
 
 
122
#############################################
 
123
 
 
124
body copy_from u_scp(from)
 
125
 
 
126
{
 
127
source      => "$(from)";
 
128
compare     => "digest";
 
129
trustkey    => "true";
 
130
 
 
131
!policy_host::
 
132
 
 
133
servers => { "$(policy_server)" };
 
134
}
 
135
 
 
136
#########################################################
 
137
 
 
138
body action immediate
 
139
{
 
140
ifelapsed => "1";
 
141
}
 
142
 
 
143
############################################
 
144
 
 
145
body depth_search u_recurse(d)
 
146
 
 
147
{
 
148
depth => "$(d)";
 
149
}