puppet 0.24.4 → 0.24.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (316) hide show
  1. data/CHANGELOG +170 -0
  2. data/Rakefile +6 -4
  3. data/bin/filebucket +3 -2
  4. data/bin/puppet +7 -4
  5. data/bin/puppetca +32 -14
  6. data/bin/puppetd +12 -34
  7. data/bin/puppetmasterd +3 -2
  8. data/bin/puppetrun +5 -43
  9. data/bin/ralsh +2 -2
  10. data/conf/debian/README.source +2 -0
  11. data/conf/debian/TODO.Debian +1 -0
  12. data/conf/debian/changelog +257 -0
  13. data/conf/debian/compat +1 -0
  14. data/conf/debian/control +45 -0
  15. data/conf/debian/copyright +17 -0
  16. data/conf/debian/docs +1 -0
  17. data/conf/debian/fileserver.conf +12 -0
  18. data/conf/debian/puppet.NEWS +63 -0
  19. data/conf/debian/puppet.conf +8 -0
  20. data/conf/debian/puppet.dirs +7 -0
  21. data/conf/debian/puppet.files +6 -0
  22. data/conf/debian/puppet.init +64 -0
  23. data/conf/debian/puppet.logrotate +11 -0
  24. data/conf/debian/puppet.postinst +9 -0
  25. data/conf/debian/puppet.postrm +21 -0
  26. data/conf/debian/puppet.preinst +25 -0
  27. data/conf/debian/puppetmaster.files +4 -0
  28. data/conf/debian/puppetmaster.init +58 -0
  29. data/conf/debian/rules +115 -0
  30. data/conf/debian/watch +2 -0
  31. data/conf/gentoo/init.d/puppet +1 -1
  32. data/conf/gentoo/init.d/puppetmaster +32 -31
  33. data/conf/redhat/client.init +10 -2
  34. data/conf/redhat/puppet.spec +4 -1
  35. data/conf/redhat/server.init +9 -1
  36. data/examples/{code/allatonce → allatonce} +0 -0
  37. data/examples/{code/assignments → assignments} +0 -0
  38. data/examples/{code/components → components} +0 -0
  39. data/examples/{root/etc → etc}/init.d/sleeper +0 -0
  40. data/examples/{root/etc → etc}/otherfile +0 -0
  41. data/examples/{root/etc → etc}/puppet/fileserver.conf +0 -0
  42. data/examples/{root/etc → etc}/puppet/namespaceauth.conf +0 -0
  43. data/examples/{root/etc → etc}/puppet/puppet.conf +0 -0
  44. data/examples/{root/etc → etc}/puppet/tagmail.conf +0 -0
  45. data/examples/{code/execs → execs} +0 -0
  46. data/examples/{code/file.bl → file.bl} +0 -0
  47. data/examples/{code/filedefaults → filedefaults} +0 -0
  48. data/examples/{code/fileparsing → fileparsing} +0 -0
  49. data/examples/{code/filerecursion → filerecursion} +0 -0
  50. data/examples/{code/functions → functions} +0 -0
  51. data/examples/{code/groups → groups} +0 -0
  52. data/examples/{code/head → head} +0 -0
  53. data/examples/{code/importing → importing} +0 -0
  54. data/examples/{code/mac_automount.pp → mac_automount.pp} +0 -0
  55. data/examples/{code/mac_dscl.pp → mac_dscl.pp} +0 -0
  56. data/examples/{code/mac_dscl_revert.pp → mac_dscl_revert.pp} +0 -0
  57. data/examples/{code/mac_netinfo.pp → mac_netinfo.pp} +0 -0
  58. data/examples/{code/mac_pkgdmg.pp → mac_pkgdmg.pp} +0 -0
  59. data/examples/{code/modules → modules}/sample-module.pp +0 -0
  60. data/examples/{code/modules → modules}/sample-module/README.txt +0 -0
  61. data/examples/{code/modules → modules}/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +0 -0
  62. data/examples/{code/modules → modules}/sample-module/manifests/init.pp +0 -0
  63. data/examples/{code/modules → modules}/sample-module/templates/sample.erb +0 -0
  64. data/examples/{code/nodes → nodes} +0 -0
  65. data/examples/{code/one → one} +0 -0
  66. data/examples/{code/relationships → relationships} +0 -0
  67. data/examples/{code/selectors → selectors} +0 -0
  68. data/examples/{code/simpletests → simpletests} +0 -0
  69. data/examples/{code/svncommit → svncommit} +0 -0
  70. data/ext/autotest/Rakefile +8 -0
  71. data/ext/autotest/config +43 -0
  72. data/ext/autotest/readme.rst +16 -0
  73. data/{examples/root → ext}/bin/sleeper +1 -1
  74. data/ext/emacs/puppet-mode.el +246 -184
  75. data/ext/ldap/puppet.schema +7 -2
  76. data/ext/module_puppet +4 -3
  77. data/ext/nagios/check_puppet.rb +117 -0
  78. data/ext/puppetlast +40 -0
  79. data/install.rb +12 -3
  80. data/lib/puppet.rb +1 -44
  81. data/lib/puppet/defaults.rb +23 -10
  82. data/lib/puppet/dsl.rb +2 -2
  83. data/lib/puppet/executables/client/certhandler.rb +77 -0
  84. data/lib/puppet/external/nagios.rb +1 -1
  85. data/lib/puppet/external/nagios/base.rb +60 -46
  86. data/lib/puppet/file_serving/indirection_hooks.rb +4 -2
  87. data/lib/puppet/file_serving/metadata.rb +0 -9
  88. data/lib/puppet/file_serving/terminus_helper.rb +4 -4
  89. data/lib/puppet/indirector.rb +26 -28
  90. data/lib/puppet/indirector/catalog/compiler.rb +6 -28
  91. data/lib/puppet/indirector/checksum/file.rb +2 -2
  92. data/lib/puppet/indirector/direct_file_server.rb +7 -7
  93. data/lib/puppet/indirector/envelope.rb +13 -0
  94. data/lib/puppet/indirector/exec.rb +2 -2
  95. data/lib/puppet/indirector/facts/facter.rb +2 -2
  96. data/lib/puppet/indirector/file.rb +17 -14
  97. data/lib/puppet/indirector/file_metadata/file.rb +2 -2
  98. data/lib/puppet/indirector/file_server.rb +14 -14
  99. data/lib/puppet/indirector/indirection.rb +113 -48
  100. data/lib/puppet/indirector/ldap.rb +13 -25
  101. data/lib/puppet/indirector/memory.rb +7 -7
  102. data/lib/puppet/indirector/module_files.rb +14 -14
  103. data/lib/puppet/indirector/node/exec.rb +3 -10
  104. data/lib/puppet/indirector/node/ldap.rb +138 -41
  105. data/lib/puppet/indirector/node/plain.rb +1 -8
  106. data/lib/puppet/indirector/node/rest.rb +1 -1
  107. data/lib/puppet/indirector/plain.rb +2 -2
  108. data/lib/puppet/indirector/report/processor.rb +2 -2
  109. data/lib/puppet/indirector/request.rb +42 -0
  110. data/lib/puppet/indirector/rest.rb +51 -3
  111. data/lib/puppet/indirector/terminus.rb +0 -27
  112. data/lib/puppet/indirector/yaml.rb +12 -17
  113. data/lib/puppet/metatype/attributes.rb +3 -7
  114. data/lib/puppet/metatype/evaluation.rb +2 -2
  115. data/lib/puppet/module.rb +6 -2
  116. data/lib/puppet/network/client/master.rb +29 -81
  117. data/lib/puppet/network/handler/master.rb +12 -43
  118. data/lib/puppet/network/http.rb +8 -6
  119. data/lib/puppet/network/http/handler.rb +42 -32
  120. data/lib/puppet/network/http/mongrel.rb +8 -9
  121. data/lib/puppet/network/http/mongrel/rest.rb +42 -15
  122. data/lib/puppet/network/http/webrick.rb +27 -16
  123. data/lib/puppet/network/http/webrick/rest.rb +38 -14
  124. data/lib/puppet/network/http_pool.rb +3 -2
  125. data/lib/puppet/network/server.rb +24 -22
  126. data/lib/puppet/network/xmlrpc/client.rb +6 -1
  127. data/lib/puppet/node.rb +38 -79
  128. data/lib/puppet/node/catalog.rb +9 -0
  129. data/lib/puppet/node/facts.rb +9 -1
  130. data/lib/puppet/parser/ast/function.rb +1 -1
  131. data/lib/puppet/parser/collector.rb +6 -0
  132. data/lib/puppet/parser/compiler.rb +1 -1
  133. data/lib/puppet/parser/functions.rb +25 -1
  134. data/lib/puppet/parser/interpreter.rb +2 -17
  135. data/lib/puppet/parser/parser.rb +4 -4
  136. data/lib/puppet/parser/parser_support.rb +6 -2
  137. data/lib/puppet/parser/resource.rb +6 -0
  138. data/lib/puppet/parser/templatewrapper.rb +9 -0
  139. data/lib/puppet/pgraph.rb +1 -1
  140. data/lib/puppet/property.rb +0 -1
  141. data/lib/puppet/provider.rb +9 -95
  142. data/lib/puppet/provider/confine.rb +77 -0
  143. data/lib/puppet/provider/confine/exists.rb +22 -0
  144. data/lib/puppet/provider/confine/false.rb +19 -0
  145. data/lib/puppet/provider/confine/feature.rb +17 -0
  146. data/lib/puppet/provider/confine/true.rb +20 -0
  147. data/lib/puppet/provider/confine/variable.rb +42 -0
  148. data/lib/puppet/provider/confine_collection.rb +47 -0
  149. data/lib/puppet/provider/confiner.rb +20 -0
  150. data/lib/puppet/provider/cron/crontab.rb +6 -2
  151. data/lib/puppet/provider/group/groupadd.rb +1 -1
  152. data/lib/puppet/provider/group/ldap.rb +48 -0
  153. data/lib/puppet/provider/ldap.rb +137 -0
  154. data/lib/puppet/provider/nameservice.rb +1 -2
  155. data/lib/puppet/provider/nameservice/objectadd.rb +2 -5
  156. data/lib/puppet/provider/package/dpkg.rb +16 -1
  157. data/lib/puppet/provider/package/freebsd.rb +15 -4
  158. data/lib/puppet/provider/package/gem.rb +33 -12
  159. data/lib/puppet/provider/package/pkgdmg.rb +1 -60
  160. data/lib/puppet/provider/package/ports.rb +6 -1
  161. data/lib/puppet/provider/package/rpm.rb +14 -13
  162. data/lib/puppet/provider/package/urpmi.rb +3 -3
  163. data/lib/puppet/provider/service/base.rb +4 -4
  164. data/lib/puppet/provider/service/debian.rb +1 -1
  165. data/lib/puppet/provider/service/init.rb +5 -3
  166. data/lib/puppet/provider/service/redhat.rb +35 -7
  167. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +69 -0
  168. data/lib/puppet/provider/user/ldap.rb +133 -0
  169. data/lib/puppet/provider/user/useradd.rb +1 -1
  170. data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +14 -14
  171. data/lib/puppet/rails/database/schema.rb +9 -0
  172. data/lib/puppet/rails/resource.rb +1 -0
  173. data/lib/puppet/reference/providers.rb +8 -2
  174. data/lib/puppet/reference/report.rb +23 -0
  175. data/lib/puppet/reports/rrdgraph.rb +4 -2
  176. data/lib/puppet/sslcertificates/ca.rb +9 -4
  177. data/lib/puppet/sslcertificates/support.rb +26 -2
  178. data/lib/puppet/transaction.rb +11 -16
  179. data/lib/puppet/transaction/change.rb +94 -0
  180. data/lib/puppet/transaction/event.rb +21 -0
  181. data/lib/puppet/transaction/report.rb +4 -0
  182. data/lib/puppet/type.rb +0 -2
  183. data/lib/puppet/type/file/ensure.rb +0 -5
  184. data/lib/puppet/type/file/group.rb +13 -7
  185. data/lib/puppet/type/file/source.rb +8 -15
  186. data/lib/puppet/type/file/target.rb +2 -0
  187. data/lib/puppet/type/group.rb +1 -1
  188. data/lib/puppet/type/mount.rb +4 -2
  189. data/lib/puppet/type/nagios_hostescalation.rb +3 -0
  190. data/lib/puppet/type/nagios_servicegroup.rb +3 -0
  191. data/lib/puppet/type/ssh_authorized_key.rb +56 -0
  192. data/lib/puppet/type/user.rb +3 -0
  193. data/lib/puppet/type/yumrepo.rb +0 -1
  194. data/lib/puppet/util.rb +1 -1
  195. data/lib/puppet/util/ldap.rb +5 -0
  196. data/lib/puppet/util/ldap/connection.rb +69 -0
  197. data/lib/puppet/util/ldap/generator.rb +45 -0
  198. data/lib/puppet/util/ldap/manager.rb +281 -0
  199. data/lib/puppet/util/posix.rb +2 -2
  200. data/lib/puppet/util/resource_template.rb +61 -0
  201. data/lib/puppet/util/settings.rb +63 -3
  202. data/lib/puppet/util/storage.rb +4 -0
  203. data/lib/puppet/util/warnings.rb +7 -0
  204. data/man/man8/filebucket.8 +116 -0
  205. data/man/man8/pi.8 +34 -0
  206. data/man/man8/puppet.8 +78 -0
  207. data/man/man8/puppet.conf.8 +1747 -0
  208. data/man/man8/puppetca.8 +118 -0
  209. data/man/man8/puppetd.8 +184 -0
  210. data/man/man8/puppetdoc.8 +62 -0
  211. data/man/man8/puppetmasterd.8 +87 -0
  212. data/man/man8/puppetrun.8 +151 -0
  213. data/man/man8/ralsh.8 +135 -0
  214. data/test/README +24 -0
  215. data/test/certmgr/support.rb +28 -1
  216. data/test/data/failers/badclassnoparam +10 -0
  217. data/test/data/failers/badclassparam +10 -0
  218. data/test/data/failers/badcompnoparam +9 -0
  219. data/test/data/failers/badcompparam +9 -0
  220. data/test/data/failers/badtypeparam +3 -0
  221. data/test/data/failers/noobjectrvalue +1 -0
  222. data/test/data/providers/cron/crontab.allthree +17 -0
  223. data/test/data/providers/cron/crontab.envNcomment +12 -0
  224. data/test/data/providers/cron/crontab.envNname +11 -0
  225. data/test/data/providers/cron/crontab.multirecords +12 -0
  226. data/test/data/providers/cron/crontab_collections.yaml +44 -0
  227. data/test/data/providers/cron/crontab_multiple_with_env.yaml +54 -0
  228. data/test/data/providers/cron/crontab_sample_records.yaml +272 -0
  229. data/test/data/providers/cron/examples/freebsd +2 -0
  230. data/test/data/providers/cron/examples/one +14 -0
  231. data/test/data/providers/cron/examples/openbsd +20 -0
  232. data/test/data/providers/package/testpackages.yaml +65 -0
  233. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +5 -0
  234. data/test/data/reports/1.yaml +108 -0
  235. data/test/data/reports/2.yaml +108 -0
  236. data/test/data/reports/tagmail_failers.conf +3 -0
  237. data/test/data/reports/tagmail_passers.conf +30 -0
  238. data/test/data/snippets/aliastest.pp +16 -0
  239. data/test/data/snippets/argumentdefaults +14 -0
  240. data/test/data/snippets/casestatement.pp +58 -0
  241. data/test/data/snippets/classheirarchy.pp +15 -0
  242. data/test/data/snippets/classincludes.pp +17 -0
  243. data/test/data/snippets/classpathtest +11 -0
  244. data/test/data/snippets/collection.pp +10 -0
  245. data/test/data/snippets/collection_within_virtual_definitions.pp +20 -0
  246. data/test/data/snippets/componentmetaparams.pp +11 -0
  247. data/test/data/snippets/componentrequire.pp +8 -0
  248. data/test/data/snippets/deepclassheirarchy.pp +23 -0
  249. data/test/data/snippets/defineoverrides.pp +17 -0
  250. data/test/data/snippets/emptyclass.pp +9 -0
  251. data/test/data/snippets/emptyexec.pp +3 -0
  252. data/test/data/snippets/falsevalues.pp +3 -0
  253. data/test/data/snippets/filecreate +11 -0
  254. data/test/data/snippets/fqdefinition.pp +5 -0
  255. data/test/data/snippets/fqparents.pp +11 -0
  256. data/test/data/snippets/implicititeration +15 -0
  257. data/test/data/snippets/multipleinstances +7 -0
  258. data/test/data/snippets/multisubs.pp +13 -0
  259. data/test/data/snippets/namevartest +9 -0
  260. data/test/data/snippets/scopetest +13 -0
  261. data/test/data/snippets/selectorvalues.pp +42 -0
  262. data/test/data/snippets/simpledefaults +5 -0
  263. data/test/data/snippets/simpleselector +38 -0
  264. data/test/data/snippets/singleary.pp +19 -0
  265. data/test/data/snippets/singlequote.pp +11 -0
  266. data/test/data/snippets/singleselector.pp +22 -0
  267. data/test/data/snippets/subclass_name_duplication.pp +11 -0
  268. data/test/data/snippets/tag.pp +9 -0
  269. data/test/data/snippets/tagged.pp +35 -0
  270. data/test/data/snippets/virtualresources.pp +14 -0
  271. data/test/data/types/hosts/1 +3 -0
  272. data/test/data/types/hosts/2 +13 -0
  273. data/test/data/types/hosts/solaris +5 -0
  274. data/test/data/types/mailalias/file1 +183 -0
  275. data/test/data/types/mount/freebsd.fstab +7 -0
  276. data/test/data/types/mount/linux.fstab +11 -0
  277. data/test/data/types/mount/solaris.fstab +11 -0
  278. data/test/data/types/port/1 +533 -0
  279. data/test/data/types/port/darwin +11866 -0
  280. data/test/data/types/ssh_authorized_key/1 +2 -0
  281. data/test/data/types/sshkey/1 +21 -0
  282. data/test/data/types/yumrepos/fedora-devel.repo +26 -0
  283. data/test/data/types/yumrepos/fedora.repo +9 -0
  284. data/test/language/parser.rb +8 -1
  285. data/test/lib/puppettest/runnable_test.rb +3 -0
  286. data/test/lib/puppettest/support/utils.rb +1 -1
  287. data/test/lib/rake/puppet_testtask.rb +3 -0
  288. data/test/lib/stubba.rb +1 -1
  289. data/test/network/client/ca.rb +1 -0
  290. data/test/network/client/master.rb +13 -127
  291. data/test/network/handler/master.rb +61 -80
  292. data/test/other/provider.rb +0 -45
  293. data/test/other/transactions.rb +53 -15
  294. data/test/rails/host.rb +0 -37
  295. data/test/ral/providers/cron/crontab.rb +32 -3
  296. data/test/ral/providers/provider.rb +28 -7
  297. data/test/ral/type/filesources.rb +2 -18
  298. data/test/ral/type/sshkey.rb +0 -1
  299. data/test/ral/type/user.rb +6 -0
  300. data/test/test +241 -0
  301. metadata +289 -113
  302. data/examples/root/etc/configfile +0 -0
  303. data/examples/root/etc/debian-passwd +0 -29
  304. data/examples/root/etc/debian-syslog.conf +0 -71
  305. data/lib/puppet/event.rb +0 -28
  306. data/lib/puppet/network/handler/configuration.rb +0 -184
  307. data/lib/puppet/network/http/mongrel/xmlrpc.rb +0 -4
  308. data/lib/puppet/network/http/webrick/xmlrpc.rb +0 -4
  309. data/lib/puppet/propertychange.rb +0 -141
  310. data/lib/puppet/provider/interface/redhat.rb +0 -250
  311. data/lib/puppet/provider/interface/sunos.rb +0 -133
  312. data/lib/puppet/type/interface.rb +0 -60
  313. data/lib/puppet/util/variables.rb +0 -38
  314. data/test/network/handler/configuration.rb +0 -160
  315. data/test/other/propertychange.rb +0 -140
  316. data/test/util/loadedfile.rb +0 -121
File without changes
@@ -1,29 +0,0 @@
1
- root:x:0:0:root:/root:/bin/bash
2
- daemon:x:1:1:daemon:/usr/sbin:/bin/sh
3
- bin:x:2:2:bin:/bin:/bin/sh
4
- sys:x:3:3:sys:/dev:/bin/sh
5
- sync:x:4:65534:sync:/bin:/bin/sync
6
- games:x:5:60:games:/usr/games:/bin/sh
7
- man:x:6:12:man:/var/cache/man:/bin/sh
8
- lp:x:7:7:lp:/var/spool/lpd:/bin/sh
9
- mail:x:8:8:mail:/var/mail:/bin/sh
10
- news:x:9:9:news:/var/spool/news:/bin/sh
11
- uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
12
- proxy:x:13:13:proxy:/bin:/bin/sh
13
- postgres:x:31:32:postgres:/var/lib/postgres:/bin/sh
14
- www-data:x:33:33:www-data:/var/www:/bin/sh
15
- backup:x:34:34:backup:/var/backups:/bin/sh
16
- operator:x:37:37:Operator:/var:/bin/sh
17
- list:x:38:38:Mailing List Manager:/var/list:/bin/sh
18
- irc:x:39:39:ircd:/var/run/ircd:/bin/sh
19
- gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
20
- nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
21
- sshd:x:102:65534::/var/run/sshd:/bin/false
22
- gdm:x:101:101:Gnome Display Manager:/var/lib/gdm:/bin/false
23
- telnetd:x:103:103::/usr/lib/telnetd:/bin/false
24
- nagios:x:1000:1001::/home/nagios:
25
- messagebus:x:104:107::/var/run/dbus:/bin/false
26
- saned:x:109:109::/home/saned:/bin/false
27
- ganglia:x:105:110:Ganglia Monitor:/var/lib/ganglia:/bin/false
28
- zope:x:106:111::/var/lib/zope2.7/var:/bin/false
29
- fbgetty:x:112:112::/home/fbgetty:/bin/false
@@ -1,71 +0,0 @@
1
- # /etc/syslog.conf Configuration file for syslogd.
2
- #
3
- # For more information see syslog.conf(5)
4
- # manpage.
5
-
6
- #
7
- # First some standard logfiles. Log by facility.
8
- #
9
-
10
- auth,authpriv.* /var/log/auth.log
11
- *.*;auth,authpriv.none -/var/log/syslog
12
- #cron.* /var/log/cron.log
13
- daemon.* -/var/log/daemon.log
14
- kern.* -/var/log/kern.log
15
- lpr.* -/var/log/lpr.log
16
- mail.* -/var/log/mail.log
17
- user.* -/var/log/user.log
18
- uucp.* /var/log/uucp.log
19
-
20
- #
21
- # Logging for the mail system. Split it up so that
22
- # it is easy to write scripts to parse these files.
23
- #
24
- mail.info -/var/log/mail.info
25
- mail.warn -/var/log/mail.warn
26
- mail.err /var/log/mail.err
27
-
28
- # Logging for INN news system
29
- #
30
- news.crit /var/log/news/news.crit
31
- news.err /var/log/news/news.err
32
- news.notice -/var/log/news/news.notice
33
-
34
- #
35
- # Some `catch-all' logfiles.
36
- #
37
- *.=debug;\
38
- auth,authpriv.none;\
39
- news.none;mail.none -/var/log/debug
40
- *.=info;*.=notice;*.=warn;\
41
- auth,authpriv.none;\
42
- cron,daemon.none;\
43
- mail,news.none -/var/log/messages
44
-
45
- #
46
- # Emergencies are sent to everybody logged in.
47
- #
48
- *.emerg *
49
-
50
- #
51
- # I like to have messages displayed on the console, but only on a virtual
52
- # console I usually leave idle.
53
- #
54
- #daemon,mail.*;\
55
- # news.=crit;news.=err;news.=notice;\
56
- # *.=debug;*.=info;\
57
- # *.=notice;*.=warn /dev/tty8
58
-
59
- # The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
60
- # you must invoke `xconsole' with the `-file' option:
61
- #
62
- # $ xconsole -file /dev/xconsole [...]
63
- #
64
- # NOTE: adjust the list below, or you'll go crazy if you have a reasonably
65
- # busy site..
66
- #
67
- daemon.*;mail.*;\
68
- news.crit;news.err;news.notice;\
69
- *.=debug;*.=info;\
70
- *.=notice;*.=warn |/dev/xconsole
71
-
@@ -1,28 +0,0 @@
1
- require 'puppet'
2
- require 'puppet/util/methodhelper'
3
- require 'puppet/util/errors'
4
-
5
- module Puppet
6
- # events are transient packets of information; they result in one or more (or none)
7
- # subscriptions getting triggered, and then they get cleared
8
- # eventually, these will be passed on to some central event system
9
- class Event
10
- include Puppet
11
- include Puppet::Util::MethodHelper
12
- include Puppet::Util::Errors
13
-
14
- attr_accessor :event, :source, :transaction
15
-
16
- @@events = []
17
-
18
- def initialize(args)
19
- set_options symbolize_options(args)
20
- requiredopts(:event, :source)
21
- end
22
-
23
- def to_s
24
- @source.to_s + " -> " + self.event.to_s
25
- end
26
- end
27
- end
28
-
@@ -1,184 +0,0 @@
1
- require 'openssl'
2
- require 'puppet'
3
- require 'puppet/parser/interpreter'
4
- require 'puppet/sslcertificates'
5
- require 'xmlrpc/server'
6
- require 'yaml'
7
-
8
- class Puppet::Network::Handler
9
- class Configuration < Handler
10
- desc "Puppet's configuration compilation interface. Passed a node name
11
- or other key, retrieves information about the node (using the ``node_source``)
12
- and returns a compiled configuration."
13
-
14
- include Puppet::Util
15
-
16
- attr_accessor :local, :classes
17
-
18
- @interface = XMLRPC::Service::Interface.new("configuration") { |iface|
19
- iface.add_method("string configuration(string)")
20
- iface.add_method("string version()")
21
- }
22
-
23
- # Compile a node's configuration.
24
- def configuration(key, client = nil, clientip = nil)
25
- # If we want to use the cert name as our key
26
- if Puppet[:node_name] == 'cert' and client
27
- key = client
28
- end
29
-
30
- # Note that this is reasonable, because either their node source should actually
31
- # know about the node, or they should be using the ``none`` node source, which
32
- # will always return data.
33
- unless node = Puppet::Node.find_by_any_name(key)
34
- raise Puppet::Error, "Could not find node '%s'" % key
35
- end
36
-
37
- # Add any external data to the node.
38
- add_node_data(node)
39
-
40
- configuration = compile(node)
41
-
42
- return translate(configuration)
43
- end
44
-
45
- def initialize(options = {})
46
- options.each do |param, value|
47
- case param
48
- when :Classes: @classes = value
49
- when :Local: self.local = value
50
- else
51
- raise ArgumentError, "Configuration handler does not accept %s" % param
52
- end
53
- end
54
-
55
- set_server_facts
56
- end
57
-
58
- # Are we running locally, or are our clients networked?
59
- def local?
60
- self.local
61
- end
62
-
63
- # Return the configuration version.
64
- def version(client = nil, clientip = nil)
65
- if client and node = Puppet::Node.find_by_any_name(client)
66
- update_node_check(node)
67
- return interpreter.configuration_version(node)
68
- else
69
- # Just return something that will always result in a recompile, because
70
- # this is local.
71
- return (Time.now + 1000).to_i
72
- end
73
- end
74
-
75
- private
76
-
77
- # Add any extra data necessary to the node.
78
- def add_node_data(node)
79
- # Merge in our server-side facts, so they can be used during compilation.
80
- node.merge(@server_facts)
81
-
82
- # Add any specified classes to the node's class list.
83
- if @classes
84
- @classes.each do |klass|
85
- node.classes << klass
86
- end
87
- end
88
- end
89
-
90
- # Compile the actual configuration.
91
- def compile(node)
92
- # Pick the benchmark level.
93
- if local?
94
- level = :none
95
- else
96
- level = :notice
97
- end
98
-
99
- # Ask the interpreter to compile the configuration.
100
- str = "Compiled configuration for %s" % node.name
101
- if node.environment
102
- str += " in environment %s" % node.environment
103
- end
104
- config = nil
105
- benchmark(level, "Compiled configuration for %s" % node.name) do
106
- begin
107
- config = interpreter.compile(node)
108
- rescue => detail
109
- # If we're local, then we leave it to the local system
110
- # to handle error reporting, but otherwise we do it here
111
- # so the interpreter doesn't need to know if the parser
112
- # is local or not.
113
- Puppet.err(detail.to_s) unless local?
114
- raise
115
- end
116
- end
117
-
118
- return config
119
- end
120
-
121
- # Create our interpreter object.
122
- def create_interpreter
123
- return Puppet::Parser::Interpreter.new
124
- end
125
-
126
- # Create/return our interpreter.
127
- def interpreter
128
- unless defined?(@interpreter) and @interpreter
129
- @interpreter = create_interpreter
130
- end
131
- @interpreter
132
- end
133
-
134
- # Initialize our server fact hash; we add these to each client, and they
135
- # won't change while we're running, so it's safe to cache the values.
136
- def set_server_facts
137
- @server_facts = {}
138
-
139
- # Add our server version to the fact list
140
- @server_facts["serverversion"] = Puppet.version.to_s
141
-
142
- # And then add the server name and IP
143
- {"servername" => "fqdn",
144
- "serverip" => "ipaddress"
145
- }.each do |var, fact|
146
- if value = Facter.value(fact)
147
- @server_facts[var] = value
148
- else
149
- Puppet.warning "Could not retrieve fact %s" % fact
150
- end
151
- end
152
-
153
- if @server_facts["servername"].nil?
154
- host = Facter.value(:hostname)
155
- if domain = Facter.value(:domain)
156
- @server_facts["servername"] = [host, domain].join(".")
157
- else
158
- @server_facts["servername"] = host
159
- end
160
- end
161
- end
162
-
163
- # Translate our configuration appropriately for sending back to a client.
164
- def translate(config)
165
- if local?
166
- config
167
- else
168
- CGI.escape(config.to_yaml(:UseBlock => true))
169
- end
170
- end
171
-
172
- # Mark that the node has checked in. FIXME this needs to be moved into
173
- # the Node class, or somewhere that's got abstract backends.
174
- def update_node_check(node)
175
- if Puppet.features.rails? and Puppet[:storeconfigs]
176
- Puppet::Rails.connect
177
-
178
- host = Puppet::Rails::Host.find_or_create_by_name(node.name)
179
- host.last_freshcheck = Time.now
180
- host.save
181
- end
182
- end
183
- end
184
- end
@@ -1,4 +0,0 @@
1
- class Puppet::Network::HTTP::MongrelXMLRPC
2
- def initialize(args = {})
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- class Puppet::Network::HTTP::WEBrickXMLRPC
2
- def initialize(args = {})
3
- end
4
- end
@@ -1,141 +0,0 @@
1
- # the class responsible for actually doing any work
2
-
3
- # enables no-op and logging/rollback
4
-
5
- module Puppet
6
- # Handle all of the work around performing an actual change,
7
- # including calling 'sync' on the properties and producing events.
8
- class PropertyChange
9
- attr_accessor :is, :should, :type, :path, :property, :transaction, :changed, :proxy
10
-
11
- # The log file generated when this object was changed.
12
- attr_reader :report
13
-
14
- # Switch the goals of the property, thus running the change in reverse.
15
- def backward
16
- @property.should = @is
17
- @is = @property.retrieve
18
-
19
- unless defined? @transaction
20
- raise Puppet::Error,
21
- "PropertyChange '%s' tried to be executed outside of transaction" %
22
- self
23
- end
24
- unless @property.insync?(@is)
25
- @property.info "Backing %s" % self
26
- return self.go
27
- else
28
- @property.debug "rollback is already in sync: %s vs. %s" %
29
- [@is, @property.should.inspect]
30
- return nil
31
- end
32
- end
33
-
34
- def changed?
35
- self.changed
36
- end
37
-
38
- # Create our event object.
39
- def event(name)
40
- # default to a simple event type
41
- unless name.is_a?(Symbol)
42
- @property.warning("Property '%s' returned invalid event '%s'; resetting to default" %
43
- [@property.class, name])
44
-
45
- event = @property.resource.class.name.id2name + "_changed"
46
- end
47
-
48
- Puppet::Event.new(
49
- :event => name,
50
- :transaction => @transaction,
51
- :source => self.source
52
- )
53
- end
54
-
55
- def initialize(property, currentvalue)
56
- unless property.is_a?(Puppet::Property)
57
- raise Puppet::DevError, "Got a %s instead of a property" %
58
- property.class
59
- end
60
- @property = property
61
- @path = [property.path,"change"].flatten
62
- @is = currentvalue
63
-
64
- @should = property.should
65
-
66
- @changed = false
67
- end
68
-
69
- # Perform the actual change. This method can go either forward or
70
- # backward, and produces an event.
71
- def go
72
- if skip?
73
- if self.noop
74
- return [event(:noop)]
75
- else
76
- return nil
77
- end
78
- end
79
-
80
- # The transaction catches any exceptions here.
81
- events = @property.sync
82
- if events.nil?
83
- return nil
84
- end
85
-
86
- if events.is_a?(Array)
87
- if events.empty?
88
- return nil
89
- end
90
- else
91
- events = [events]
92
- end
93
-
94
- return events.collect { |name|
95
- @report = @property.log(@property.change_to_s(@is, @should))
96
- event(name)
97
- }
98
- end
99
-
100
- def forward
101
- #@property.debug "moving change forward"
102
-
103
- unless defined? @transaction
104
- raise Puppet::Error,
105
- "PropertyChange '%s' tried to be executed outside of transaction" %
106
- self
107
- end
108
-
109
- return self.go
110
- end
111
-
112
- def noop
113
- return @property.noop
114
- end
115
-
116
- def skip?
117
- if @property.insync?(@is)
118
- @property.info "Already in sync"
119
- return true
120
- end
121
-
122
- if @property.noop
123
- @property.log "is %s, should be %s (noop)" %
124
- [property.is_to_s(@is), property.should_to_s(@should)]
125
- #@property.debug "%s is noop" % @property
126
- return true
127
- end
128
- return false
129
- end
130
-
131
- def source
132
- self.proxy || @property.resource
133
- end
134
-
135
- def to_s
136
- return "change %s.%s(%s)" %
137
- [@transaction.object_id, self.object_id, @property.change_to_s(@is, @should)]
138
- #return "change %s.%s" % [@transaction.object_id, self.object_id]
139
- end
140
- end
141
- end