puppet 2.6.0 → 2.6.1

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 (246) hide show
  1. data/CHANGELOG +123 -0
  2. data/conf/redhat/puppet.spec +8 -2
  3. data/conf/solaris/smf/svc-puppetd +1 -1
  4. data/conf/solaris/smf/svc-puppetmasterd +1 -1
  5. data/conf/suse/client.init +4 -4
  6. data/conf/suse/fileserver.conf +12 -0
  7. data/conf/suse/logrotate +10 -0
  8. data/conf/suse/puppet.conf +25 -0
  9. data/conf/suse/puppet.spec +114 -49
  10. data/conf/suse/ruby-env.patch +17 -0
  11. data/conf/suse/server.init +4 -4
  12. data/ext/logcheck/puppet +23 -23
  13. data/ext/puppet-load.rb +357 -0
  14. data/ext/puppetstoredconfigclean.rb +3 -3
  15. data/ext/rack/files/config.ru +3 -5
  16. data/ext/vim/syntax/puppet.vim +6 -5
  17. data/install.rb +12 -11
  18. data/lib/puppet.rb +1 -1
  19. data/lib/puppet/agent.rb +3 -1
  20. data/lib/puppet/application.rb +2 -3
  21. data/lib/puppet/application/agent.rb +4 -0
  22. data/lib/puppet/application/apply.rb +14 -6
  23. data/lib/puppet/application/describe.rb +1 -1
  24. data/lib/puppet/application/doc.rb +2 -36
  25. data/lib/puppet/application/master.rb +0 -3
  26. data/lib/puppet/application/queue.rb +1 -0
  27. data/lib/puppet/configurer.rb +4 -0
  28. data/lib/puppet/daemon.rb +1 -1
  29. data/lib/puppet/defaults.rb +38 -44
  30. data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
  31. data/lib/puppet/indirector/facts/memory.rb +1 -1
  32. data/lib/puppet/indirector/node/exec.rb +1 -1
  33. data/lib/puppet/indirector/node/ldap.rb +9 -53
  34. data/lib/puppet/indirector/node/memory.rb +1 -1
  35. data/lib/puppet/indirector/yaml.rb +6 -9
  36. data/lib/puppet/network/format_handler.rb +6 -0
  37. data/lib/puppet/network/formats.rb +4 -4
  38. data/lib/puppet/network/http/handler.rb +1 -1
  39. data/lib/puppet/network/http/rack.rb +3 -0
  40. data/lib/puppet/network/http/rack/rest.rb +1 -1
  41. data/lib/puppet/network/rest_authconfig.rb +6 -3
  42. data/lib/puppet/node/environment.rb +15 -5
  43. data/lib/puppet/parameter/value_collection.rb +3 -3
  44. data/lib/puppet/parser/ast/function.rb +0 -1
  45. data/lib/puppet/parser/ast/leaf.rb +1 -1
  46. data/lib/puppet/parser/ast/resource.rb +4 -3
  47. data/lib/puppet/parser/ast/resource_reference.rb +9 -2
  48. data/lib/puppet/parser/compiler.rb +12 -14
  49. data/lib/puppet/parser/files.rb +1 -1
  50. data/lib/puppet/parser/functions.rb +2 -2
  51. data/lib/puppet/parser/functions/defined.rb +1 -1
  52. data/lib/puppet/parser/functions/extlookup.rb +157 -0
  53. data/lib/puppet/parser/functions/file.rb +1 -1
  54. data/lib/puppet/parser/functions/inline_template.rb +6 -5
  55. data/lib/puppet/parser/functions/md5.rb +5 -0
  56. data/lib/puppet/parser/functions/realize.rb +1 -1
  57. data/lib/puppet/parser/functions/regsubst.rb +19 -19
  58. data/lib/puppet/parser/functions/require.rb +2 -3
  59. data/lib/puppet/parser/functions/split.rb +1 -1
  60. data/lib/puppet/parser/functions/sprintf.rb +1 -1
  61. data/lib/puppet/parser/functions/template.rb +4 -2
  62. data/lib/puppet/parser/functions/versioncmp.rb +12 -12
  63. data/lib/puppet/parser/lexer.rb +13 -14
  64. data/lib/puppet/parser/resource.rb +2 -7
  65. data/lib/puppet/parser/resource/param.rb +1 -1
  66. data/lib/puppet/parser/scope.rb +35 -0
  67. data/lib/puppet/parser/type_loader.rb +1 -1
  68. data/lib/puppet/property.rb +5 -5
  69. data/lib/puppet/provider.rb +3 -3
  70. data/lib/puppet/provider/group/groupadd.rb +1 -1
  71. data/lib/puppet/provider/group/ldap.rb +3 -3
  72. data/lib/puppet/provider/group/pw.rb +1 -1
  73. data/lib/puppet/provider/package/apple.rb +1 -1
  74. data/lib/puppet/provider/package/apt.rb +5 -1
  75. data/lib/puppet/provider/package/aptitude.rb +1 -1
  76. data/lib/puppet/provider/package/aptrpm.rb +1 -1
  77. data/lib/puppet/provider/package/blastwave.rb +1 -1
  78. data/lib/puppet/provider/package/dpkg.rb +2 -2
  79. data/lib/puppet/provider/package/fink.rb +1 -1
  80. data/lib/puppet/provider/package/gem.rb +1 -1
  81. data/lib/puppet/provider/package/openbsd.rb +1 -1
  82. data/lib/puppet/provider/package/rpm.rb +1 -1
  83. data/lib/puppet/provider/package/rug.rb +1 -1
  84. data/lib/puppet/provider/package/sunfreeware.rb +2 -2
  85. data/lib/puppet/provider/package/up2date.rb +1 -1
  86. data/lib/puppet/provider/package/urpmi.rb +1 -1
  87. data/lib/puppet/provider/package/yum.rb +1 -1
  88. data/lib/puppet/provider/package/zypper.rb +1 -1
  89. data/lib/puppet/provider/service/base.rb +1 -1
  90. data/lib/puppet/provider/service/bsd.rb +2 -2
  91. data/lib/puppet/provider/service/debian.rb +2 -2
  92. data/lib/puppet/provider/service/gentoo.rb +2 -2
  93. data/lib/puppet/provider/service/init.rb +2 -2
  94. data/lib/puppet/provider/service/redhat.rb +2 -2
  95. data/lib/puppet/provider/user/ldap.rb +3 -3
  96. data/lib/puppet/provider/user/pw.rb +1 -1
  97. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  98. data/lib/puppet/provider/user/useradd.rb +1 -1
  99. data/lib/puppet/rails/host.rb +1 -0
  100. data/lib/puppet/reference/configuration.rb +37 -34
  101. data/lib/puppet/reference/indirection.rb +3 -4
  102. data/lib/puppet/reference/metaparameter.rb +0 -8
  103. data/lib/puppet/reference/network.rb +6 -4
  104. data/lib/puppet/reference/providers.rb +4 -4
  105. data/lib/puppet/reference/report.rb +5 -6
  106. data/lib/puppet/reference/type.rb +14 -14
  107. data/lib/puppet/reports/http.rb +1 -1
  108. data/lib/puppet/reports/rrdgraph.rb +8 -9
  109. data/lib/puppet/reports/store.rb +2 -2
  110. data/lib/puppet/reports/tagmail.rb +12 -13
  111. data/lib/puppet/resource.rb +15 -115
  112. data/lib/puppet/resource/catalog.rb +1 -1
  113. data/lib/puppet/resource/type.rb +26 -3
  114. data/lib/puppet/resource/type_collection.rb +3 -6
  115. data/lib/puppet/simple_graph.rb +4 -5
  116. data/lib/puppet/transaction/resource_harness.rb +1 -1
  117. data/lib/puppet/type.rb +100 -92
  118. data/lib/puppet/type/augeas.rb +44 -45
  119. data/lib/puppet/type/computer.rb +2 -2
  120. data/lib/puppet/type/cron.rb +29 -29
  121. data/lib/puppet/type/exec.rb +66 -67
  122. data/lib/puppet/type/file.rb +25 -25
  123. data/lib/puppet/type/file/content.rb +7 -1
  124. data/lib/puppet/type/file/ensure.rb +13 -13
  125. data/lib/puppet/type/file/mode.rb +6 -6
  126. data/lib/puppet/type/file/selcontext.rb +5 -5
  127. data/lib/puppet/type/file/source.rb +36 -26
  128. data/lib/puppet/type/filebucket.rb +5 -6
  129. data/lib/puppet/type/group.rb +1 -2
  130. data/lib/puppet/type/host.rb +3 -6
  131. data/lib/puppet/type/k5login.rb +3 -3
  132. data/lib/puppet/type/macauthorization.rb +1 -2
  133. data/lib/puppet/type/mailalias.rb +0 -1
  134. data/lib/puppet/type/maillist.rb +0 -1
  135. data/lib/puppet/type/mcx.rb +9 -9
  136. data/lib/puppet/type/mount.rb +9 -10
  137. data/lib/puppet/type/notify.rb +0 -1
  138. data/lib/puppet/type/package.rb +34 -36
  139. data/lib/puppet/type/resources.rb +1 -5
  140. data/lib/puppet/type/schedule.rb +9 -12
  141. data/lib/puppet/type/selboolean.rb +2 -7
  142. data/lib/puppet/type/selmodule.rb +3 -4
  143. data/lib/puppet/type/service.rb +9 -9
  144. data/lib/puppet/type/ssh_authorized_key.rb +2 -3
  145. data/lib/puppet/type/sshkey.rb +4 -7
  146. data/lib/puppet/type/stage.rb +5 -4
  147. data/lib/puppet/type/tidy.rb +3 -3
  148. data/lib/puppet/type/user.rb +1 -2
  149. data/lib/puppet/type/whit.rb +7 -0
  150. data/lib/puppet/type/yumrepo.rb +16 -3
  151. data/lib/puppet/type/zfs.rb +1 -2
  152. data/lib/puppet/type/zone.rb +28 -28
  153. data/lib/puppet/type/zpool.rb +10 -5
  154. data/lib/puppet/util/autoload.rb +17 -5
  155. data/lib/puppet/util/cacher.rb +15 -10
  156. data/lib/puppet/util/command_line/puppetdoc +5 -5
  157. data/lib/puppet/util/command_line/puppetrun +0 -2
  158. data/lib/puppet/util/command_line/ralsh +13 -13
  159. data/lib/puppet/util/docs.rb +5 -12
  160. data/lib/puppet/util/monkey_patches.rb +5 -2
  161. data/lib/puppet/util/nagios_maker.rb +4 -5
  162. data/lib/puppet/util/provider_features.rb +2 -2
  163. data/lib/puppet/util/rdoc.rb +1 -1
  164. data/lib/puppet/util/rdoc/parser.rb +5 -3
  165. data/lib/puppet/util/reference.rb +3 -52
  166. data/man/man5/puppet.conf.5 +2072 -1526
  167. data/man/man8/filebucket.8 +104 -106
  168. data/man/man8/pi.8 +14 -47
  169. data/man/man8/puppet.8 +8 -9
  170. data/man/man8/puppetca.8 +168 -129
  171. data/man/man8/puppetd.8 +282 -226
  172. data/man/man8/puppetdoc.8 +103 -103
  173. data/man/man8/puppetmasterd.8 +51 -71
  174. data/man/man8/puppetqd.8 +18 -53
  175. data/man/man8/puppetrun.8 +163 -143
  176. data/man/man8/ralsh.8 +77 -114
  177. data/spec/integration/indirector/bucket_file/rest_spec.rb +1 -0
  178. data/spec/integration/indirector/certificate/rest_spec.rb +1 -0
  179. data/spec/integration/indirector/certificate_request/rest_spec.rb +1 -0
  180. data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +1 -0
  181. data/spec/integration/indirector/report/rest_spec.rb +1 -0
  182. data/spec/integration/indirector/rest_spec.rb +1 -0
  183. data/spec/integration/network/server/webrick_spec.rb +1 -0
  184. data/spec/integration/parser/compiler_spec.rb +43 -0
  185. data/spec/integration/provider/mailalias/aliases_spec.rb +5 -5
  186. data/spec/integration/ssl/certificate_authority_spec.rb +1 -0
  187. data/spec/integration/ssl/certificate_request_spec.rb +1 -0
  188. data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -0
  189. data/spec/integration/ssl/host_spec.rb +1 -0
  190. data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +0 -1
  191. data/spec/monkey_patches/publicize_methods.rb +11 -0
  192. data/spec/shared_behaviours/file_serving.rb +12 -1
  193. data/spec/spec_helper.rb +6 -25
  194. data/spec/unit/application/apply_spec.rb +22 -4
  195. data/spec/unit/application/cert_spec.rb +1 -1
  196. data/spec/unit/application/doc_spec.rb +0 -19
  197. data/spec/unit/application/master_spec.rb +1 -1
  198. data/spec/unit/application_spec.rb +2 -12
  199. data/spec/unit/indirector/node/ldap_spec.rb +19 -21
  200. data/spec/unit/indirector/yaml_spec.rb +18 -6
  201. data/spec/unit/network/http/rack/rest_spec.rb +3 -3
  202. data/spec/unit/network/http/webrick/rest_spec.rb +1 -0
  203. data/spec/unit/node/environment_spec.rb +32 -3
  204. data/spec/unit/node/facts_spec.rb +13 -2
  205. data/spec/unit/parameter/value_collection_spec.rb +2 -2
  206. data/spec/unit/parser/ast/leaf_spec.rb +4 -0
  207. data/spec/unit/parser/ast/resource_reference_spec.rb +0 -5
  208. data/spec/unit/parser/ast/resource_spec.rb +7 -0
  209. data/spec/unit/parser/compiler_spec.rb +12 -1
  210. data/spec/unit/parser/files_spec.rb +3 -3
  211. data/spec/unit/parser/functions/extlookup_spec.rb +95 -0
  212. data/spec/unit/parser/functions/include_spec.rb +33 -0
  213. data/spec/unit/parser/functions/require_spec.rb +1 -1
  214. data/spec/unit/parser/functions/tag_spec.rb +1 -0
  215. data/spec/unit/parser/lexer_spec.rb +10 -1
  216. data/spec/unit/parser/resource_spec.rb +3 -9
  217. data/spec/unit/parser/type_loader_spec.rb +1 -1
  218. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +4 -2
  219. data/spec/unit/rails/resource_spec.rb +1 -1
  220. data/spec/unit/reports/tagmail_spec.rb +2 -2
  221. data/spec/unit/resource/catalog_spec.rb +1 -1
  222. data/spec/unit/resource/type_collection_spec.rb +35 -0
  223. data/spec/unit/resource/type_spec.rb +19 -1
  224. data/spec/unit/resource_spec.rb +0 -36
  225. data/spec/unit/simple_graph_spec.rb +12 -2
  226. data/spec/unit/transaction/resource_harness_spec.rb +1 -1
  227. data/spec/unit/type/file/content_spec.rb +2 -1
  228. data/spec/unit/type/schedule_spec.rb +1 -1
  229. data/spec/unit/type/service_spec.rb +8 -0
  230. data/spec/unit/type/user_spec.rb +5 -0
  231. data/spec/unit/util/backups_spec.rb +0 -1
  232. data/spec/unit/util/rdoc/parser_spec.rb +3 -3
  233. data/spec/unit/util/rdoc_spec.rb +13 -0
  234. data/test/certmgr/support.rb +2 -1
  235. data/test/language/parser.rb +6 -6
  236. data/test/lib/puppettest.rb +3 -23
  237. data/test/lib/puppettest/fakes.rb +1 -1
  238. data/test/lib/puppettest/support/assertions.rb +0 -2
  239. data/test/lib/puppettest/support/utils.rb +25 -20
  240. data/test/ral/manager/attributes.rb +4 -1
  241. metadata +15 -9
  242. data/conf/suse/puppet.suse.patch +0 -16
  243. data/ext/extlookup.rb +0 -181
  244. data/ext/puppetlast +0 -16
  245. data/tasks/rake/tracdocs.rake +0 -8
  246. data/test/lib/mocha_standalone.rb +0 -2
@@ -0,0 +1,17 @@
1
+ --- sbin/puppetd 2010-07-18 14:17:38.000000000 -0700
2
+ +++ sbin/puppetd 2010-07-21 17:31:57.057138615 -0700
3
+ @@ -1,4 +1,4 @@
4
+ -#!/usr/bin/env ruby
5
+ +#!/usr/bin/ruby
6
+
7
+ require 'puppet/application/agent'
8
+ Puppet::Application[:agent].run
9
+
10
+ --- sbin/puppetmasterd 2010-07-18 14:17:38.000000000 -0700
11
+ +++ sbin/puppetmasterd 2010-07-21 17:32:10.178513969 -0700
12
+ @@ -1,4 +1,4 @@
13
+ -#!/usr/bin/env ruby
14
+ +#!/usr/bin/ruby
15
+
16
+ require 'puppet/application/master'
17
+ Puppet::Application[:master].run
@@ -11,10 +11,10 @@
11
11
 
12
12
  ### BEGIN INIT INFO
13
13
  # Provides: puppetmaster
14
- # Required-Start: $local_fs $network $syslog
15
- # Should-Start: $null
16
- # Required-Stop: $null
17
- # Should-Stop: $null
14
+ # Required-Start: $local_fs $remote_fs $network $syslog
15
+ # Should-Start: puppetmaster
16
+ # Required-Stop: $local_fs $remote_fs $network $syslog
17
+ # Should-Stop: puppetmaster
18
18
  # Default-Start: 3 4 5
19
19
  # Default-Stop: 0 1 2 6
20
20
  # Short-Description: puppetmaster
@@ -1,23 +1,23 @@
1
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: (Handled resources in|Resource comparison took|Searched for (host|resources|resource params and tags) in) [0-9.]+ seconds
2
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: Starting Puppet server version [.0-9]+$
3
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: Compiled catalog for [._[:alnum:]-]+ in [.0-9]+ seconds$
4
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: Caught TERM; shutting down$
5
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: Shutting down$
6
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Starting Puppet client version [.0-9]+$
7
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: getting config$
8
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Caching configuration at [\/._[:alnum:]-]+$
9
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Loaded state in [.0-9]+ seconds$
10
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Calling puppetmaster.getconfig$
11
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Retrieved configuration in [.0-9]+ seconds$
12
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Starting configuration run$
13
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Finished configuration run in [.0-9]+ seconds$
14
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Caught (TERM|INT); shutting down$
15
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Shutting down$
16
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Restarting with .*$
17
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Starting catalog run$
18
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Finished catalog run in [.0-9]+ seconds$
19
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Loading fact .*$
20
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Ignoring cache$
21
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Ignoring --listen on onetime run$
22
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetd\[[0-9]+\]: Retrieving plugins$
23
- ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppetmasterd\[[0-9]+\]: Reopening log files$
1
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: (Handled resources in|Resource comparison took|Searched for (host|resources|resource params and tags) in) [0-9.]+ seconds
2
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: Starting Puppet server version [.0-9]+$
3
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: Compiled catalog for [._[:alnum:]-]+ in [.0-9]+ seconds$
4
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: Caught TERM; shutting down$
5
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: Shutting down$
6
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Starting Puppet client version [.0-9]+$
7
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: getting config$
8
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Caching configuration at [\/._[:alnum:]-]+$
9
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Loaded state in [.0-9]+ seconds$
10
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Calling puppetmaster.getconfig$
11
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Retrieved configuration in [.0-9]+ seconds$
12
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Starting configuration run$
13
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Finished configuration run in [.0-9]+ seconds$
14
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Caught (TERM|INT); shutting down$
15
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Shutting down$
16
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Restarting with .*$
17
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Starting catalog run$
18
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Finished catalog run in [.0-9]+ seconds$
19
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Loading fact .*$
20
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Ignoring cache$
21
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Ignoring --listen on onetime run$
22
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-agent\[[0-9]+\]: Retrieving plugins$
23
+ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ puppet-master\[[0-9]+\]: Reopening log files$
@@ -0,0 +1,357 @@
1
+ #!/usr/bin/env ruby
2
+ # == Synopsis
3
+ #
4
+ # This tool can exercize a puppetmaster by simulating an arbitraty number of concurrent clients
5
+ # in a lightweight way.
6
+ #
7
+ # = Prerequisites
8
+ #
9
+ # This tool requires Event Machine and em-http-request, and an installation of Puppet.
10
+ # Event Machine can be installed from gem.
11
+ # em-http-request can be installed from gem.
12
+ #
13
+ # = Usage
14
+ #
15
+ # puppet-load [-d|--debug] [--concurrency <num>] [--repeat <num>] [-V|--version] [-v|--verbose]
16
+ # [--node <host.domain.com>] [--facts <factfile>] [--cert <certfile>] [--key <keyfile>]
17
+ # [--server <server.domain.com>]
18
+ #
19
+ # = Description
20
+ #
21
+ # This is a simple script meant for doing performance tests of puppet masters. It does this
22
+ # by simulating concurrent connections to a puppet master and asking for catalog compilation.
23
+ #
24
+ # = Options
25
+ #
26
+ # Unlike other puppet executables, puppet-load doesn't parse puppet.conf nor use puppet options
27
+ #
28
+ # debug::
29
+ # Enable full debugging.
30
+ #
31
+ # concurreny::
32
+ # Number of simulated concurrent clients.
33
+ #
34
+ # server::
35
+ # Set the puppet master hostname or IP address..
36
+ #
37
+ # node::
38
+ # Set the fully-qualified domain name of the client. This is only used for
39
+ # certificate purposes, but can be used to override the discovered hostname.
40
+ #
41
+ # help::
42
+ # Print this help message
43
+ #
44
+ # facts::
45
+ # This can be used to provide facts for the compilation, directly from a YAML
46
+ # file as found in the clientyaml directory. If none are provided, puppet-load
47
+ # will look by itself using Puppet facts indirector.
48
+ #
49
+ # cert::
50
+ # This option is mandatory. It should be set to the cert PEM file that will be used
51
+ # to quthenticate the client connections.
52
+ #
53
+ # key::
54
+ # This option is mandatory. It should be set to the private key PEM file that will be used
55
+ # to quthenticate the client connections.
56
+ #
57
+ # timeout::
58
+ # The number of seconds after which a simulated client is declared in error if it didn't get
59
+ # a catalog. The default is 180s.
60
+ #
61
+ # repeat::
62
+ # How many times to perform the test. This means puppet-load will ask for
63
+ # concurrency * repeat catalogs.
64
+ #
65
+ # verbose::
66
+ # Turn on verbose reporting.
67
+ #
68
+ # version::
69
+ # Print the puppet version number and exit.
70
+ #
71
+ # = Example usage
72
+ #
73
+ # 1) On the master host, generate a new certificate and private key for our test host:
74
+ # puppet ca --generate puppet-load.domain.com [*]
75
+ #
76
+ # 2) Copy the cert and key to the puppet-load host (which can be the same as the master one)
77
+ #
78
+ # 3) On the master host edit or create the auth.conf so that the catalog ACL match:
79
+ # path ~ ^/catalog/([^/]+)$
80
+ # method find
81
+ # allow $1
82
+ # allow puppet-load.domain.com
83
+ #
84
+ # 4) launch the master
85
+ #
86
+ # 5) Prepare or get a fact file. One way to get one is to look on the master in $vardir/yaml/ for the host
87
+ # you want to simulate.
88
+ #
89
+ # 5) launch puppet-load
90
+ # puppet-load -debug --node server.domain.com --server master.domain.com --facts server.domain.com.yaml --concurrency 2 --repeat 20
91
+ #
92
+ # [*]: unfortunately at this stage Puppet trusts the certname of the connecting node more than
93
+ # than the node name request paramater. It means that the master will compile
94
+ # the puppet-load node and not the --node given.
95
+ #
96
+ # = TODO
97
+ # * Allow to simulate any different nodes
98
+ # * More output stats for error connections (ie report errors, HTTP code...)
99
+ #
100
+ #
101
+
102
+ # Do an initial trap, so that cancels don't get a stack trace.
103
+ trap(:INT) do
104
+ $stderr.puts "Cancelling startup"
105
+ exit(1)
106
+ end
107
+
108
+ require 'rubygems'
109
+ require 'eventmachine'
110
+ require 'em-http'
111
+ require 'getoptlong'
112
+ require 'puppet'
113
+
114
+ $cmdargs = [
115
+ [ "--concurrency", "-c", GetoptLong::REQUIRED_ARGUMENT ],
116
+ [ "--node", "-n", GetoptLong::REQUIRED_ARGUMENT ],
117
+ [ "--facts", GetoptLong::REQUIRED_ARGUMENT ],
118
+ [ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ],
119
+ [ "--cert", "-C", GetoptLong::REQUIRED_ARGUMENT ],
120
+ [ "--key", "-k", GetoptLong::REQUIRED_ARGUMENT ],
121
+ [ "--timeout", "-t", GetoptLong::REQUIRED_ARGUMENT ],
122
+ [ "--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
123
+ [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
124
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
125
+ [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
126
+ [ "--version", "-V", GetoptLong::NO_ARGUMENT ],
127
+ ]
128
+
129
+ Puppet::Util::Log.newdestination(:console)
130
+
131
+ times = {}
132
+
133
+ def read_facts(file)
134
+ YAML.load(File.read(file))
135
+ end
136
+
137
+
138
+ result = GetoptLong.new(*$cmdargs)
139
+
140
+ $args = {}
141
+ $options = {:repeat => 1, :concurrency => 1, :pause => false, :cert => nil, :key => nil, :timeout => 180, :masterport => 8140}
142
+
143
+ begin
144
+ result.each { |opt,arg|
145
+ case opt
146
+ when "--concurrency"
147
+ begin
148
+ $options[:concurrency] = Integer(arg)
149
+ rescue => detail
150
+ $stderr.puts "The argument to 'fork' must be an integer"
151
+ exit(14)
152
+ end
153
+ when "--node"
154
+ $options[:node] = arg
155
+ when "--server"
156
+ $options[:server] = arg
157
+ when "--masterport"
158
+ $options[:masterport] = arg
159
+ when "--facts"
160
+ $options[:facts] = arg
161
+ when "--repeat"
162
+ $options[:repeat] = Integer(arg)
163
+ when "--help"
164
+ if Puppet.features.usage?
165
+ RDoc::usage && exit
166
+ else
167
+ puts "No help available unless you have RDoc::usage installed"
168
+ exit
169
+ end
170
+ when "--version"
171
+ puts "%s" % Puppet.version
172
+ exit
173
+ when "--verbose"
174
+ Puppet::Util::Log.level = :info
175
+ Puppet::Util::Log.newdestination(:console)
176
+ when "--debug"
177
+ Puppet::Util::Log.level = :debug
178
+ Puppet::Util::Log.newdestination(:console)
179
+ when "--cert"
180
+ $options[:cert] = arg
181
+ when "--key"
182
+ $options[:key] = arg
183
+ end
184
+ }
185
+ rescue GetoptLong::InvalidOption => detail
186
+ $stderr.puts detail
187
+ $stderr.puts "Try '#{$0} --help'"
188
+ exit(1)
189
+ end
190
+
191
+ unless $options[:cert] and $options[:key]
192
+ raise "--cert and --key are mandatory to authenticate the client"
193
+ end
194
+
195
+ unless $options[:facts] and facts = read_facts($options[:facts])
196
+ unless facts = Puppet::Node::Facts.find($options[:node])
197
+ raise "Could not find facts for %s" % $options[:node]
198
+ end
199
+ end
200
+
201
+ unless $options[:node]
202
+ raise "--node is a mandatory argument. It tells to the master what node to compile"
203
+ end
204
+
205
+ facts.values["fqdn"] = $options[:node]
206
+ facts.values["hostname"] = $options[:node].sub(/\..+/, '')
207
+ facts.values["domain"] = $options[:node].sub(/^[^.]+\./, '')
208
+
209
+ parameters = {:facts_format => "b64_zlib_yaml", :facts => CGI.escape(facts.render(:b64_zlib_yaml))}
210
+
211
+ class RequestPool
212
+ include EventMachine::Deferrable
213
+
214
+ attr_reader :requests, :responses, :times, :sizes
215
+ attr_reader :repeat, :concurrency, :max_request
216
+
217
+ def initialize(concurrency, repeat, parameters)
218
+ @parameters = parameters
219
+ @current_request = 0
220
+ @max_request = repeat * concurrency
221
+ @repeat = repeat
222
+ @concurrency = concurrency
223
+ @requests = []
224
+ @responses = {:succeeded => [], :failed => []}
225
+ @times = {}
226
+ @sizes = {}
227
+
228
+ # initial spawn
229
+ (1..concurrency).each do |i|
230
+ spawn
231
+ end
232
+
233
+ end
234
+
235
+ def spawn_request(index)
236
+ EventMachine::HttpRequest.new("https://#{$options[:server]}:#{$options[:masterport]}/production/catalog/#{$options[:node]}").get(
237
+ :port => $options[:masterport],
238
+ :query => @parameters,
239
+ :timeout => $options[:timeout],
240
+ :head => { "Accept" => "pson, yaml, b64_zlib_yaml, marshal, dot, raw", "Accept-Encoding" => "gzip, deflate" },
241
+ :ssl => { :private_key_file => $options[:key],
242
+ :cert_chain_file => $options[:cert],
243
+ :verify_peer => false } ) do
244
+ Puppet.debug("starting client #{index}")
245
+ @times[index] = Time.now
246
+ @sizes[index] = 0
247
+ end
248
+ end
249
+
250
+ def add(index, conn)
251
+ @requests.push(conn)
252
+
253
+ conn.stream { |data|
254
+ @sizes[index] += data.length
255
+ }
256
+
257
+ conn.callback {
258
+ @times[index] = Time.now - @times[index]
259
+ code = conn.response_header.status
260
+ if code >= 200 && code < 300
261
+ Puppet.debug("Client #{index} finished successfully")
262
+ @responses[:succeeded].push(conn)
263
+ else
264
+ Puppet.debug("Client #{index} finished with HTTP code #{code}")
265
+ @responses[:failed].push(conn)
266
+ end
267
+ check_progress
268
+ }
269
+
270
+ conn.errback {
271
+ Puppet.debug("Client #{index} finished with an error: #{conn.response.error}")
272
+ @times[index] = Time.now - @times[index]
273
+ @responses[:failed].push(conn)
274
+ check_progress
275
+ }
276
+ end
277
+
278
+ def all_responses
279
+ @responses[:succeeded] + @responses[:failed]
280
+ end
281
+
282
+ protected
283
+
284
+ def check_progress
285
+ spawn unless all_spawned?
286
+ succeed if all_finished?
287
+ end
288
+
289
+ def all_spawned?
290
+ @requests.size >= max_request
291
+ end
292
+
293
+ def all_finished?
294
+ @responses[:failed].size + @responses[:succeeded].size >= max_request
295
+ end
296
+
297
+ def spawn
298
+ add(@current_request, spawn_request(@current_request))
299
+ @current_request += 1
300
+ end
301
+ end
302
+
303
+
304
+ def mean(array)
305
+ array.inject(0) { |sum, x| sum += x } / array.size.to_f
306
+ end
307
+
308
+ def median(array)
309
+ array = array.sort
310
+ m_pos = array.size / 2
311
+ return array.size % 2 == 1 ? array[m_pos] : mean(array[m_pos-1..m_pos])
312
+ end
313
+
314
+ def format_bytes(bytes)
315
+ if bytes < 1024
316
+ "%.2f B" % bytes
317
+ elsif bytes < 1024 * 1024
318
+ "%.2f KiB" % (bytes/1024.0)
319
+ else
320
+ "%.2f MiB" % (bytes/(1024.0*1024.0))
321
+ end
322
+ end
323
+
324
+ EM::run {
325
+
326
+ start = Time.now
327
+ multi = RequestPool.new($options[:concurrency], $options[:repeat], parameters)
328
+
329
+ multi.callback do
330
+ duration = Time.now - start
331
+ puts "#{multi.max_request} requests finished in #{duration} s"
332
+ puts "#{multi.responses[:failed].size} requests failed"
333
+ puts "Availability: %3.2f %%" % (100.0*multi.responses[:succeeded].size/(multi.responses[:succeeded].size+multi.responses[:failed].size))
334
+
335
+ minmax = multi.times.values.minmax
336
+ all_time = multi.times.values.reduce(:+)
337
+
338
+ puts "\nTime (s):"
339
+ puts "\tmin: #{minmax[0]} s"
340
+ puts "\tmax: #{minmax[1]} s"
341
+ puts "\taverage: #{mean(multi.times.values)} s"
342
+ puts "\tmedian: #{median(multi.times.values)} s"
343
+
344
+ puts "\nConcurrency: %.2f" % (all_time/duration)
345
+ puts "Transaction Rate (tps): %.2f t/s" % (multi.max_request / duration)
346
+
347
+ transferred = multi.sizes.values.reduce(:+)
348
+
349
+ puts "\nReceived bytes: #{format_bytes(transferred)}"
350
+ puts "Throughput: %.5f MiB/s" % (transferred/duration/(1024.0*1024.0))
351
+
352
+ # this is the end
353
+ EventMachine.stop
354
+ end
355
+ }
356
+
357
+
@@ -19,11 +19,11 @@ end
19
19
 
20
20
 
21
21
  opts = GetoptLong.new(
22
-
22
+
23
23
  [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
24
24
  [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
25
25
  [ "--usage", "-u", GetoptLong::NO_ARGUMENT ],
26
-
26
+
27
27
  [ "--version", "-v", GetoptLong::NO_ARGUMENT ]
28
28
  )
29
29
 
@@ -54,7 +54,7 @@ printusage(1) unless ARGV.size > 0
54
54
  require 'puppet/rails'
55
55
  Puppet[:config] = config
56
56
  Puppet.parse_config
57
- pm_conf = Puppet.settings.instance_variable_get(:@values)[:puppetmasterd]
57
+ pm_conf = Puppet.settings.instance_variable_get(:@values)[:master]
58
58
 
59
59
  adapter = pm_conf[:dbadapter]
60
60
  args = {:adapter => adapter, :log_level => pm_conf[:rails_loglevel]}