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
@@ -12,11 +12,16 @@ attributetype ( 1.1.3.9 NAME 'parentnode'
12
12
  EQUALITY caseIgnoreIA5Match
13
13
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
14
14
 
15
- attributetype ( 1.1.3.9 NAME 'environment'
15
+ attributetype ( 1.1.3.11 NAME 'environment'
16
16
  DESC 'Puppet Node Environment'
17
17
  EQUALITY caseIgnoreIA5Match
18
18
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
19
19
 
20
+ attributetype ( 1.1.3.12 NAME 'puppetvar'
21
+ DESC 'A variable setting for puppet'
22
+ EQUALITY caseIgnoreIA5Match
23
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
24
+
20
25
  objectclass ( 1.1.1.2 NAME 'puppetClient' SUP top AUXILIARY
21
26
  DESC 'Puppet Client objectclass'
22
- MAY ( puppetclass $ parentnode $ environment ))
27
+ MAY ( puppetclass $ parentnode $ environment $ puppetvar ))
@@ -138,8 +138,9 @@ server = nil
138
138
  end
139
139
  end
140
140
 
141
- Puppet.genconfig
142
- Puppet.genmanifest
141
+ if Puppet.settings.print_configs?
142
+ exit(Puppet.settings.print_configs ? 0 : 1)
143
+ end
143
144
 
144
145
  unless ARGV.length > 0
145
146
  $stderr.puts "You must pass a script to parse"
@@ -179,7 +180,7 @@ node.classes = classes
179
180
 
180
181
  begin
181
182
  # Compile our configuration
182
- catalog = Puppet::Node::Catalog.find(node)
183
+ catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
183
184
  rescue => detail
184
185
  if Puppet[:trace]
185
186
  puts detail.backtrace
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'sys/proctable'
5
+ include Sys
6
+
7
+ class CheckPuppet
8
+
9
+ VERSION = '0.1'
10
+ script_name = File.basename($0)
11
+
12
+ # default options
13
+ OPTIONS = {
14
+ :statefile => "/var/puppet/state/state.yaml",
15
+ :process => "puppetd",
16
+ :interval => 30,
17
+ }
18
+
19
+ o = OptionParser.new do |o|
20
+ o.set_summary_indent(' ')
21
+ o.banner = "Usage: #{script_name} [OPTIONS]"
22
+ o.define_head "The check_puppet Nagios plug-in checks that specified " +
23
+ "Puppet process is running and the state file is no " +
24
+ "older than specified interval."
25
+ o.separator ""
26
+ o.separator "Mandatory arguments to long options are mandatory for " +
27
+ "short options too."
28
+
29
+ o.on("-s", "--statefile=statefile", String, "The state file",
30
+ "Default: #{OPTIONS[:statefile]}") { |OPTIONS[:statefile]| }
31
+ o.on("-p", "--process=processname", String, "The process to check",
32
+ "Default: #{OPTIONS[:process]}") { |OPTIONS[:process]| }
33
+ o.on("-i", "--interval=value", Integer,
34
+ "Default: #{OPTIONS[:interval]} minutes") { |OPTIONS[:interval]| }
35
+
36
+ o.separator ""
37
+ o.on_tail("-h", "--help", "Show this help message.") do
38
+ puts o
39
+ exit
40
+ end
41
+
42
+ o.parse!(ARGV)
43
+ end
44
+
45
+ def check_proc
46
+
47
+ unless ProcTable.ps.find { |p| p.name == OPTIONS[:process]}
48
+ @proc = 2
49
+ else
50
+ @proc = 0
51
+ end
52
+
53
+ end
54
+
55
+ def check_state
56
+
57
+ # Set variables
58
+ curt = Time.now
59
+ intv = OPTIONS[:interval] * 60
60
+
61
+ # Check file time
62
+ begin
63
+ @modt = File.mtime("#{OPTIONS[:statefile]}")
64
+ rescue
65
+ @file = 3
66
+ end
67
+
68
+ diff = (curt - @modt).to_i
69
+
70
+ if diff > intv
71
+ @file = 2
72
+ else
73
+ @file = 0
74
+ end
75
+
76
+ end
77
+
78
+ def output_status
79
+
80
+ case @file
81
+ when 0
82
+ state = "state file status okay updated on " + @modt.strftime("%m/%d/%Y at %H:%M:%S")
83
+ when 2
84
+ state = "state fille is not up to date and is older than #{OPTIONS[:interval]} minutes"
85
+ when 3
86
+ state = "state file status unknown"
87
+ end
88
+
89
+ case @proc
90
+ when 0
91
+ process = "process #{OPTIONS[:process]} is running"
92
+ when 2
93
+ process = "process #{OPTIONS[:process]} is not running"
94
+ end
95
+
96
+ case @proc or @file
97
+ when 0
98
+ status = "OK"
99
+ exitcode = 0
100
+ when 2
101
+ status = "CRITICAL"
102
+ exitcode = 2
103
+ when 3
104
+ status = "UNKNOWN"
105
+ exitcide = 3
106
+ end
107
+
108
+ puts "PUPPET " + status + ": " + process + ", " + state
109
+ exit(exitcode)
110
+ end
111
+ end
112
+
113
+ cp = CheckPuppet.new
114
+ cp.check_proc
115
+ cp.check_state
116
+ cp.output_status
117
+
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Script to print out when puppet ran successfully last
4
+ # AJ Christensen <aj@junglist.gen.nz>
5
+ #
6
+
7
+ require 'puppet'
8
+ require 'puppet/defaults'
9
+ require 'yaml'
10
+
11
+ Puppet[:config] = "/etc/puppet/puppet.conf"
12
+ Puppet.parse_config
13
+
14
+ print "puppetlast\n"
15
+
16
+ nodes = {}
17
+
18
+ yfdir = Puppet.settings.value(:vardir) + "/yaml/facts"
19
+
20
+ if yfdir
21
+ begin
22
+ Dir.chdir(yfdir) do
23
+ Dir.glob("*.yaml").each do |yaml|
24
+ data = YAML.load_file(yaml)
25
+ t = Time.now
26
+ age = t - data.version
27
+ nodes[data.name] = age.to_i
28
+ end
29
+ end
30
+
31
+ nodes.sort.each do |node,age|
32
+ minutes = age / 60 + 0.5
33
+ print minutes.floor.to_s + ' minutes ago: ' + node + "\n"
34
+ end
35
+
36
+ rescue
37
+ print 'error: ' + $! + "\n"
38
+ end
39
+
40
+ end
data/install.rb CHANGED
@@ -78,7 +78,7 @@ rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO In
78
78
  ri = glob(%w(bin/*.rb sbin/* lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ }
79
79
  man = glob(%w{man/man8/*})
80
80
  libs = glob(%w{lib/**/*.rb lib/**/*.py})
81
- tests = glob(%w{tests/**/*.rb})
81
+ tests = glob(%w{test/**/*.rb})
82
82
 
83
83
  def do_bins(bins, target, strip = 's?bin/')
84
84
  bins.each do |bf|
@@ -106,7 +106,7 @@ def do_man(man, strip = 'man/')
106
106
  File.install(mf, omf, 0644, true)
107
107
  gzip = %x{which gzip}
108
108
  gzip.chomp!
109
- %x{#{gzip} #{omf}}
109
+ %x{#{gzip} -f #{omf}}
110
110
  end
111
111
  end
112
112
 
@@ -200,6 +200,15 @@ def prepare_installation
200
200
  end
201
201
  end
202
202
 
203
+ # Mac OS X 10.5 declares bindir and sbindir as
204
+ # /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
205
+ # /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/sbin
206
+ # which is not generally where people expect executables to be installed
207
+ if RUBY_PLATFORM == "universal-darwin9.0"
208
+ Config::CONFIG['bindir'] = "/usr/bin"
209
+ Config::CONFIG['sbindir'] = "/usr/sbin"
210
+ end
211
+
203
212
  if (destdir = ENV['DESTDIR'])
204
213
  bindir = "#{destdir}#{Config::CONFIG['bindir']}"
205
214
  sbindir = "#{destdir}#{Config::CONFIG['sbindir']}"
@@ -374,7 +383,7 @@ EOS
374
383
  check_prereqs
375
384
  prepare_installation
376
385
 
377
- run_tests(tests) if InstallOptions.tests
386
+ #run_tests(tests) if InstallOptions.tests
378
387
  #build_rdoc(rdoc) if InstallOptions.rdoc
379
388
  #build_ri(ri) if InstallOptions.ri
380
389
  #build_man(bins) if InstallOptions.man
@@ -25,7 +25,7 @@ require 'puppet/util/suidmanager'
25
25
  # it's also a place to find top-level commands like 'debug'
26
26
 
27
27
  module Puppet
28
- PUPPETVERSION = '0.24.4'
28
+ PUPPETVERSION = '0.24.5'
29
29
 
30
30
  def Puppet.version
31
31
  return PUPPETVERSION
@@ -117,49 +117,6 @@ module Puppet
117
117
  # Load all of the configuration parameters.
118
118
  require 'puppet/defaults'
119
119
 
120
- # Prints the contents of a config file with the available config elements, or it
121
- # prints a single value of a config element.
122
- def self.genconfig
123
- if Puppet[:configprint] != ""
124
- val = Puppet[:configprint]
125
- if val == "all"
126
- hash = {}
127
- Puppet.settings.each do |name, obj|
128
- val = obj.value
129
- case val
130
- when true, false, "": val = val.inspect
131
- end
132
- hash[name] = val
133
- end
134
- hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val|
135
- puts "%s = %s" % [name, val]
136
- end
137
- elsif val =~ /,/
138
- val.split(/\s*,\s*/).sort.each do |v|
139
- if Puppet.settings.include?(v)
140
- puts "%s = %s" % [v, Puppet[v]]
141
- else
142
- puts "invalid parameter: %s" % v
143
- exit(1)
144
- end
145
- end
146
- else
147
- val.split(/\s*,\s*/).sort.each do |v|
148
- if Puppet.settings.include?(v)
149
- puts Puppet[val]
150
- else
151
- puts "invalid parameter: %s" % v
152
- exit(1)
153
- end
154
- end
155
- end
156
- exit(0)
157
- end
158
- if Puppet[:genconfig]
159
- puts Puppet.settings.to_config
160
- exit(0)
161
- end
162
- end
163
120
 
164
121
  def self.genmanifest
165
122
  if Puppet[:genmanifest]
@@ -69,8 +69,6 @@ module Puppet
69
69
  :rundir => {
70
70
  :default => rundir,
71
71
  :mode => 01777,
72
- :owner => "$user",
73
- :group => "$group",
74
72
  :desc => "Where Puppet PID files are kept."
75
73
  },
76
74
  :genconfig => [false,
@@ -128,7 +126,7 @@ module Puppet
128
126
  This is more useful as a server-side setting than client, but any
129
127
  environment chosen must be in this list. Values should be
130
128
  separated by a comma."],
131
- :environment => {:default => "development", :desc => "The environment Puppet is running in. For clients
129
+ :environment => {:default => "production", :desc => "The environment Puppet is running in. For clients
132
130
  (e.g., ``puppetd``) this determines the environment itself, which
133
131
  is used to find modules and much more. For servers (i.e.,
134
132
  ``puppetmasterd``) this provides the default environment for nodes
@@ -160,8 +158,12 @@ module Puppet
160
158
  end
161
159
 
162
160
  Puppet.setdefaults(:ssl,
163
- :certname => [fqdn, "The name to use when handling certificates. Defaults
164
- to the fully qualified domain name."],
161
+ # We have to downcase the fqdn, because the current ssl stuff (as oppsed to in master) doesn't have good facilities for
162
+ # manipulating naming.
163
+ :certname => {:default => fqdn.downcase, :desc => "The name to use when handling certificates. Defaults
164
+ to the fully qualified domain name.",
165
+ :call_on_define => true, # Call our hook with the default value, so we're always downcased
166
+ :hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case; see #1168") unless value == value.downcase }},
165
167
  :certdnsnames => ['', "The DNS names on the Server certificate as a colon-separated list.
166
168
  If it's anything other than an empty string, it will be used as an alias in the created
167
169
  certificate. By default, only the server gets an alias set up, and only for 'puppet'."],
@@ -354,7 +356,9 @@ module Puppet
354
356
  # To make sure this directory is created before we try to use it on the server, we need
355
357
  # it to be in the server section (#1138).
356
358
  :yamldir => {:default => "$vardir/yaml", :owner => "$user", :group => "$user", :mode => "750",
357
- :desc => "The directory in which YAML data is stored, usually in a subdirectory."}
359
+ :desc => "The directory in which YAML data is stored, usually in a subdirectory."},
360
+ :clientyamldir => {:default => "$vardir/client_yaml", :mode => "750",
361
+ :desc => "The directory in which client-side YAML data is stored."}
358
362
  )
359
363
 
360
364
  self.setdefaults(:puppetd,
@@ -412,7 +416,10 @@ module Puppet
412
416
  :ca_server => ["$server", "The server to use for certificate
413
417
  authority requests. It's a separate server because it cannot
414
418
  and does not need to horizontally scale."],
415
- :ca_port => ["$masterport", "The port to use for the certificate authority."]
419
+ :ca_port => ["$masterport", "The port to use for the certificate authority."],
420
+ :catalog_format => ["yaml", "What format to use to dump the catalog. Only supports
421
+ 'marshal' and 'yaml'. Only matters on the client, since it asks the server
422
+ for a specific format."]
416
423
  )
417
424
 
418
425
  self.setdefaults(:filebucket,
@@ -505,9 +512,11 @@ module Puppet
505
512
 
506
513
  # Central fact information.
507
514
  self.setdefaults(:main,
508
- :factpath => ["$vardir/facts",
509
- "Where Puppet should look for facts. Multiple directories should
510
- be colon-separated, like normal PATH variables."],
515
+ :factpath => {:default => "$vardir/facts",
516
+ :desc => "Where Puppet should look for facts. Multiple directories should
517
+ be colon-separated, like normal PATH variables.",
518
+ :call_on_define => true, # Call our hook with the default value, so we always get the value added to facter.
519
+ :hook => proc { |value| Facter.search(value) if Facter.respond_to?(:search) }},
511
520
  :factdest => ["$vardir/facts",
512
521
  "Where Puppet should store facts that it pulls down from the central
513
522
  server."],
@@ -622,6 +631,10 @@ module Puppet
622
631
  :ldapclassattrs => ["puppetclass",
623
632
  "The LDAP attributes to use to define Puppet classes. Values
624
633
  should be comma-separated."],
634
+ :ldapstackedattrs => ["puppetvar",
635
+ "The LDAP attributes that should be stacked to arrays by adding
636
+ the values in all hierarchy elements of the tree. Values
637
+ should be comma-separated."],
625
638
  :ldapattrs => ["all",
626
639
  "The LDAP attributes to include when querying LDAP for nodes. All
627
640
  returned attributes are set as variables in the top-level scope.
@@ -1,7 +1,7 @@
1
1
  # Just quick mess-around to see what a DSL would look like.
2
2
  #
3
3
  # This is what the executable could look like:
4
- ##!/usr/bin/ruby
4
+ ##!/usr/bin/env ruby
5
5
  #
6
6
  #require 'puppet'
7
7
  #require 'puppet/dsl'
@@ -23,7 +23,7 @@
23
23
  # And here's what an example config could look like:
24
24
  #
25
25
 
26
- ##!/usr/bin/ruby
26
+ ##!/usr/bin/env ruby
27
27
  #
28
28
  #
29
29
  # require 'puppet'
@@ -0,0 +1,77 @@
1
+
2
+ module Puppet
3
+ module Executables
4
+ module Client
5
+ class CertHandler
6
+ attr_writer :wait_for_cert, :one_time
7
+ attr_reader :new_cert
8
+
9
+ def initialize(wait_time, is_one_time)
10
+ @wait_for_cert = wait_time
11
+ @one_time = is_one_time
12
+ @new_cert = false
13
+ end
14
+
15
+ # Did we just read a cert?
16
+ def new_cert?
17
+ new_cert
18
+ end
19
+
20
+ # Read, or retrieve if necessary, our certificate. Returns true if we retrieved
21
+ # a new cert, false if the cert already exists.
22
+ def read_retrieve
23
+ #NOTE: ACS this is checking that a file exists, maybe next time just do that?
24
+ unless read_cert
25
+ # If we don't already have the certificate, then create a client to
26
+ # request one. Use the special ca stuff, don't use the normal server and port.
27
+ retrieve_cert
28
+ end
29
+
30
+ ! new_cert?
31
+ end
32
+
33
+ def retrieve_cert
34
+ caclient = Puppet::Network::Client.ca.new()
35
+
36
+ while true do
37
+ begin
38
+ if caclient.request_cert
39
+ break if read_new_cert
40
+ else
41
+ Puppet.notice "Did not receive certificate"
42
+ if @one_time
43
+ Puppet.notice "Set to run 'one time'; exiting with no certificate"
44
+ exit(1)
45
+ end
46
+ end
47
+ rescue StandardError => detail
48
+ Puppet.err "Could not request certificate: %s" % detail.to_s
49
+ exit(23) if @one_time
50
+ end
51
+
52
+ sleep @wait_for_cert
53
+ end
54
+ end
55
+
56
+ def read_cert
57
+ Puppet::Network::HttpPool.read_cert
58
+ end
59
+
60
+ def read_new_cert
61
+ if Puppet::Network::HttpPool.read_cert
62
+ # If we read it in, then we need to get rid of our existing http connection.
63
+ # The @new_cert flag will help us do that, in that it provides a way
64
+ # to notify that the cert status has changed.
65
+ @new_cert = true
66
+ Puppet.notice "Got signed certificate"
67
+ else
68
+ Puppet.err "Could not read certificates after retrieving them"
69
+ exit(34) if @one_time
70
+ end
71
+
72
+ return @new_cert
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end