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
@@ -98,6 +98,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
98
98
  hash.delete("host_id")
99
99
  hash.delete("updated_at")
100
100
  hash.delete("source_file_id")
101
+ hash.delete("created_at")
101
102
  hash.delete("id")
102
103
  hash.each do |p, v|
103
104
  hash.delete(p) if v.nil?
@@ -63,14 +63,20 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
63
63
  case test
64
64
  when :exists:
65
65
  details += " - Missing files %s\n" % values.join(", ")
66
- when :facter:
66
+ when :variable:
67
67
  values.each do |name, facts|
68
- details += " - Fact %s (currently %s) not in list %s\n" % [name, Facter.value(name).inspect, facts.join(", ")]
68
+ if Puppet.settings.valid?(name)
69
+ details += " - Setting %s (currently %s) not in list %s\n" % [name, Puppet.settings.value(name).inspect, facts.join(", ")]
70
+ else
71
+ details += " - Fact %s (currently %s) not in list %s\n" % [name, Facter.value(name).inspect, facts.join(", ")]
72
+ end
69
73
  end
70
74
  when :true:
71
75
  details += " - Got %s true tests that should have been false\n" % values
72
76
  when :false:
73
77
  details += " - Got %s false tests that should have been true\n" % values
78
+ when :feature:
79
+ details += " - Missing features %s\n" % values.collect { |f| f.to_s }.join(",")
74
80
  end
75
81
  end
76
82
  notes << details
@@ -0,0 +1,23 @@
1
+ require 'puppet/reports'
2
+
3
+ report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do
4
+ Puppet::Reports.reportdocs
5
+ end
6
+
7
+ report.header = "
8
+ Puppet clients can report back to the server after each transaction. This
9
+ transaction report is sent as a YAML dump of the
10
+ ``Puppet::Transaction::Report`` class and includes every log message that was
11
+ generated during the transaction along with as many metrics as Puppet knows how
12
+ to collect. See `ReportsAndReporting Reports and Reporting`:trac:
13
+ for more information on how to use reports.
14
+
15
+ Currently, clients default to not sending in reports; you can enable reporting
16
+ by setting the ``report`` parameter to true.
17
+
18
+ To use a report, set the ``reports`` parameter on the server; multiple
19
+ reports must be comma-separated. You can also specify ``none`` to disable
20
+ reports entirely.
21
+
22
+ Puppet provides multiple report handlers that will process client reports:
23
+ "
@@ -1,8 +1,10 @@
1
1
  Puppet::Reports.register_report(:rrdgraph) do
2
2
  desc "Graph all available data about hosts using the RRD library. You
3
3
  must have the Ruby RRDtool library installed to use this report, which
4
- you can get from `the RubyRRDTool RubyForge page`_. This package requires
5
- the binary rrdtool2 package to be installed.
4
+ you can get from `the RubyRRDTool RubyForge page`_. This package may also
5
+ be available as ``ruby-rrd`` or ``rrdtool-ruby`` in your distribution's package
6
+ management system. The library and/or package will both require the binary
7
+ ``rrdtool`` package from your distribution to be installed.
6
8
 
7
9
  .. _the RubyRRDTool RubyForge page: http://rubyforge.org/projects/rubyrrdtool/
8
10
 
@@ -97,7 +97,7 @@ class Puppet::SSLCertificates::CA
97
97
  if @config[:capass] and File.readable?(@config[:capass])
98
98
  return File.read(@config[:capass])
99
99
  else
100
- raise Puppet::Error, "Could not read CA passfile %s" % @config[:capass]
100
+ raise Puppet::Error, "Could not decrypt CA key with password: %s" % detail
101
101
  end
102
102
  end
103
103
 
@@ -379,9 +379,14 @@ class Puppet::SSLCertificates::CA
379
379
  def sign_with_key(signable, digest = OpenSSL::Digest::SHA1.new)
380
380
  cakey = nil
381
381
  if @config[:password]
382
- cakey = OpenSSL::PKey::RSA.new(
383
- File.read(@config[:cakey]), @config[:password]
384
- )
382
+ begin
383
+ cakey = OpenSSL::PKey::RSA.new(
384
+ File.read(@config[:cakey]), @config[:password]
385
+ )
386
+ rescue
387
+ raise Puppet::Error,
388
+ "Decrypt of CA private key with password stored in @config[:capass] not possible"
389
+ end
385
390
  else
386
391
  cakey = OpenSSL::PKey::RSA.new(
387
392
  File.read(@config[:cakey])
@@ -28,7 +28,8 @@ module Puppet::SSLCertificates::Support
28
28
 
29
29
  # Define the reading method.
30
30
  define_method(reader) do
31
- return nil unless FileTest.exists?(Puppet[param])
31
+ return nil unless FileTest.exists?(Puppet[param]) or rename_files_with_uppercase(Puppet[param])
32
+
32
33
  begin
33
34
  instance_variable_set(var, klass.new(File.read(Puppet[param])))
34
35
  rescue => detail
@@ -121,5 +122,28 @@ module Puppet::SSLCertificates::Support
121
122
  end
122
123
  return retrieved
123
124
  end
124
- end
125
125
 
126
+ # A hack method to deal with files that exist with a different case.
127
+ # Just renames it; doesn't read it in or anything.
128
+ def rename_files_with_uppercase(file)
129
+ dir = File.dirname(file)
130
+ short = File.basename(file)
131
+
132
+ # If the dir isn't present, we clearly don't have the file.
133
+ #return nil unless FileTest.directory?(dir)
134
+
135
+ raise ArgumentError, "Tried to fix SSL files to a file containing uppercase" unless short.downcase == short
136
+ real_file = Dir.entries(dir).reject { |f| f =~ /^\./ }.find do |other|
137
+ other.downcase == short
138
+ end
139
+
140
+ return nil unless real_file
141
+
142
+ full_file = File.join(dir, real_file)
143
+
144
+ Puppet.notice "Fixing case in %s; renaming to %s" % [full_file, file]
145
+ File.rename(full_file, file)
146
+
147
+ return true
148
+ end
149
+ end
@@ -2,10 +2,12 @@
2
2
  # and performs them
3
3
 
4
4
  require 'puppet'
5
- require 'puppet/propertychange'
6
5
 
7
6
  module Puppet
8
7
  class Transaction
8
+ require 'puppet/transaction/change'
9
+ require 'puppet/transaction/event'
10
+
9
11
  attr_accessor :component, :catalog, :ignoreschedules
10
12
  attr_accessor :sorted_resources, :configurator
11
13
 
@@ -96,7 +98,7 @@ class Transaction
96
98
  # Create an edge with this resource as both the source and
97
99
  # target. The triggering method treats these specially for
98
100
  # logging.
99
- events = resourceevents.collect { |e| e.event }
101
+ events = resourceevents.collect { |e| e.name }
100
102
  set_trigger(Puppet::Relationship.new(resource, resource, :callback => :refresh, :event => events))
101
103
  end
102
104
  end
@@ -109,7 +111,6 @@ class Transaction
109
111
  changes.collect { |change|
110
112
  @changes << change
111
113
  @count += 1
112
- change.transaction = self
113
114
  events = nil
114
115
  begin
115
116
  # use an array, so that changes can return more than one
@@ -278,7 +279,7 @@ class Transaction
278
279
  # of course, bad.
279
280
  edge = orig_edge.class.new(orig_edge.source, orig_edge.target)
280
281
  label = orig_edge.label.dup
281
- label[:event] = events.collect { |e| e.event }
282
+ label[:event] = events.collect { |e| e.name }
282
283
  edge.label = label
283
284
  set_trigger(edge)
284
285
  end
@@ -499,10 +500,12 @@ class Transaction
499
500
 
500
501
  # Prepare to evaluate the resources in a transaction.
501
502
  def prepare
502
- prefetch()
503
-
504
503
  # Now add any dynamically generated resources
505
504
  generate()
505
+
506
+ # Then prefetch. It's important that we generate and then prefetch,
507
+ # so that any generated resources also get prefetched.
508
+ prefetch()
506
509
 
507
510
  # This will throw an error if there are cycles in the graph.
508
511
  @sorted_resources = relationship_graph.topsort
@@ -678,11 +681,7 @@ class Transaction
678
681
  [callback, subs.length]
679
682
 
680
683
  # And then add an event for it.
681
- return [Puppet::Event.new(
682
- :event => :noop,
683
- :transaction => self,
684
- :source => resource
685
- )]
684
+ return [Puppet::Transaction::Event.new(:noop, resource)]
686
685
  end
687
686
 
688
687
  if subs.length == 1 and subs[0].source == resource
@@ -710,11 +709,7 @@ class Transaction
710
709
  end
711
710
 
712
711
  # And then add an event for it.
713
- trigged << Puppet::Event.new(
714
- :event => :triggered,
715
- :transaction => self,
716
- :source => resource
717
- )
712
+ trigged << Puppet::Transaction::Event.new(:triggered, resource)
718
713
 
719
714
  triggered(resource, callback)
720
715
  end
@@ -0,0 +1,94 @@
1
+ require 'puppet/transaction'
2
+ require 'puppet/transaction/event'
3
+
4
+ # Handle all of the work around performing an actual change,
5
+ # including calling 'sync' on the properties and producing events.
6
+ class Puppet::Transaction::Change
7
+ attr_accessor :is, :should, :path, :property, :changed, :proxy
8
+
9
+ # Switch the goals of the property, thus running the change in reverse.
10
+ def backward
11
+ @is, @should = @should, @is
12
+ @property.should = @should
13
+
14
+ @property.info "Reversing %s" % self
15
+ return self.go
16
+ end
17
+
18
+ def changed?
19
+ self.changed
20
+ end
21
+
22
+ # Create our event object.
23
+ def event(name)
24
+ # default to a simple event type
25
+ unless name.is_a?(Symbol)
26
+ @property.warning("Property '%s' returned invalid event '%s'; resetting to default" %
27
+ [@property.class, name])
28
+
29
+ name = @property.event(should)
30
+ end
31
+
32
+ Puppet::Transaction::Event.new(name, self.resource)
33
+ end
34
+
35
+ def initialize(property, currentvalue)
36
+ @property = property
37
+ @path = [property.path,"change"].flatten
38
+ @is = currentvalue
39
+
40
+ @should = property.should
41
+
42
+ @changed = false
43
+ end
44
+
45
+ # Perform the actual change. This method can go either forward or
46
+ # backward, and produces an event.
47
+ def go
48
+ if self.noop?
49
+ @property.log "is %s, should be %s (noop)" % [property.is_to_s(@is), property.should_to_s(@should)]
50
+ return [event(:noop)]
51
+ end
52
+
53
+ # The transaction catches any exceptions here.
54
+ events = @property.sync
55
+ if events.nil?
56
+ return nil
57
+ end
58
+
59
+ if events.is_a?(Array)
60
+ if events.empty?
61
+ return nil
62
+ end
63
+ else
64
+ events = [events]
65
+ end
66
+
67
+ return events.collect { |name|
68
+ @report = @property.log(@property.change_to_s(@is, @should))
69
+ event(name)
70
+ }
71
+ end
72
+
73
+ def forward
74
+ return self.go
75
+ end
76
+
77
+ # Is our property noop? This is used for generating special events.
78
+ def noop?
79
+ return @property.noop
80
+ end
81
+
82
+ # The resource that generated this change. This is used for handling events,
83
+ # and the proxy resource is used for generated resources, since we can't
84
+ # send an event to a resource we don't have a direct relationship. If we
85
+ # have a proxy resource, then the events will be considered to be from
86
+ # that resource, rather than us, so the graph resolution will still work.
87
+ def resource
88
+ self.proxy || @property.resource
89
+ end
90
+
91
+ def to_s
92
+ return "change %s" % @property.change_to_s(@is, @should)
93
+ end
94
+ end
@@ -0,0 +1,21 @@
1
+ require 'puppet'
2
+ require 'puppet/util/methodhelper'
3
+ require 'puppet/util/errors'
4
+
5
+ # events are transient packets of information; they result in one or more (or none)
6
+ # subscriptions getting triggered, and then they get cleared
7
+ # eventually, these will be passed on to some central event system
8
+ class Puppet::Transaction::Event
9
+ include Puppet::Util::MethodHelper
10
+ include Puppet::Util::Errors
11
+
12
+ attr_reader :name, :source
13
+
14
+ def initialize(name, source)
15
+ @name, @source = name, source
16
+ end
17
+
18
+ def to_s
19
+ source.to_s + " -> " + name.to_s
20
+ end
21
+ end
@@ -34,6 +34,10 @@ class Puppet::Transaction::Report
34
34
  end
35
35
  end
36
36
 
37
+ def name
38
+ host
39
+ end
40
+
37
41
  # Create a new metric.
38
42
  def newmetric(name, hash)
39
43
  metric = Puppet::Util::Metric.new(name)
@@ -1,6 +1,5 @@
1
1
  require 'puppet'
2
2
  require 'puppet/util/log'
3
- require 'puppet/event'
4
3
  require 'puppet/util/metric'
5
4
  require 'puppet/property'
6
5
  require 'puppet/parameter'
@@ -415,7 +414,6 @@ class Type
415
414
  end # Puppet::Type
416
415
  end
417
416
 
418
- require 'puppet/propertychange'
419
417
  require 'puppet/provider'
420
418
 
421
419
  # Always load these types.
@@ -138,11 +138,6 @@ module Puppet
138
138
  # We have to treat :present specially, because it works with any
139
139
  # type of file.
140
140
  def insync?(currentvalue)
141
- if property = @resource.property(:source) and ! property.described?
142
- warning "No specified sources exist"
143
- return true
144
- end
145
-
146
141
  if self.should == :present
147
142
  if currentvalue.nil? or currentvalue == :absent
148
143
  return false
@@ -11,12 +11,8 @@ module Puppet
11
11
  end
12
12
 
13
13
  def id2name(id)
14
- if id > 70000
15
- return nil
16
- end
17
- if id.is_a?(Symbol)
18
- return id.to_s
19
- end
14
+ return id.to_s if id.is_a?(Symbol)
15
+ return nil if id > Puppet[:maximum_uid].to_i
20
16
  begin
21
17
  group = Etc.getgrgid(id)
22
18
  rescue ArgumentError
@@ -73,7 +69,17 @@ module Puppet
73
69
  @method = :chown
74
70
  end
75
71
 
76
- return stat.gid
72
+ currentvalue = stat.gid
73
+
74
+ # On OS X, files that are owned by -2 get returned as really
75
+ # large GIDs instead of negative ones. This isn't a Ruby bug,
76
+ # it's an OS X bug, since it shows up in perl, too.
77
+ if currentvalue > Puppet[:maximum_uid].to_i
78
+ self.warning "Apparently using negative GID (%s) on a platform that does not consistently handle them" % currentvalue
79
+ currentvalue = :silly
80
+ end
81
+
82
+ return currentvalue
77
83
  end
78
84
 
79
85
  # Determine if the group is valid, and if so, return the GID
@@ -101,8 +101,7 @@ module Puppet
101
101
  begin
102
102
  desc = server.describe(path, @resource[:links])
103
103
  rescue Puppet::Network::XMLRPCClientError => detail
104
- self.err "Could not describe %s: %s" % [path, detail]
105
- return nil
104
+ fail detail, "Could not describe %s: %s" % [path, detail]
106
105
  end
107
106
 
108
107
  return nil if desc == ""
@@ -135,18 +134,8 @@ module Puppet
135
134
  return args
136
135
  end
137
136
 
138
- # Have we successfully described the remote source?
139
- def described?
140
- ! @stats.nil? and ! @stats[:type].nil? #and @is != :notdescribed
141
- end
142
-
143
137
  # Use the info we get from describe() to check if we're in sync.
144
138
  def insync?(currentvalue)
145
- unless described?
146
- warning "No specified sources exist"
147
- return true
148
- end
149
-
150
139
  if currentvalue == :nocopy
151
140
  return true
152
141
  end
@@ -180,7 +169,11 @@ module Puppet
180
169
  def pinparams
181
170
  [:mode, :type, :owner, :group]
182
171
  end
183
-
172
+
173
+ def found?
174
+ ! (@stats.nil? or @stats[:type].nil?)
175
+ end
176
+
184
177
  # This basically calls describe() on our file, and then sets all
185
178
  # of the local states appropriately. If the remote file is a normal
186
179
  # file then we set it to copy; if it's a directory, then we just mark
@@ -202,8 +195,8 @@ module Puppet
202
195
  }
203
196
  end
204
197
 
205
- if @stats.nil? or @stats[:type].nil?
206
- return nil # :notdescribed
198
+ if !found?
199
+ raise Puppet::Error, "No specified source was found from" + @should.inject("") { |s, source| s + " #{source},"}.gsub(/,$/,"")
207
200
  end
208
201
 
209
202
  case @stats[:type]