puppet 0.25.5 → 2.6.0

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 (1474) hide show
  1. data/CHANGELOG +667 -0
  2. data/LICENSE +2 -2
  3. data/README +5 -1
  4. data/README.queueing +1 -1
  5. data/README.rst +7 -4
  6. data/Rakefile +6 -18
  7. data/bin/filebucket +0 -94
  8. data/bin/pi +2 -47
  9. data/bin/puppet +2 -69
  10. data/bin/puppetca +2 -100
  11. data/bin/puppetd +2 -158
  12. data/bin/puppetdoc +2 -63
  13. data/bin/puppetmasterd +2 -64
  14. data/bin/puppetqd +2 -51
  15. data/bin/puppetrun +2 -127
  16. data/bin/ralsh +2 -87
  17. data/conf/epm.list +2 -2
  18. data/conf/osx/PackageInfo.plist +1 -1
  19. data/conf/redhat/client.init +11 -8
  20. data/conf/redhat/puppet.conf +1 -1
  21. data/conf/redhat/puppet.spec +1 -1
  22. data/conf/redhat/rundir-perms.patch +13 -13
  23. data/conf/redhat/server.init +11 -5
  24. data/conf/solaris/pkginfo +2 -2
  25. data/conf/solaris/smf/puppetd.xml +3 -3
  26. data/conf/solaris/smf/puppetmasterd.xml +3 -3
  27. data/conf/suse/client.init +3 -2
  28. data/conf/suse/puppet.spec +22 -18
  29. data/conf/suse/server.init +12 -11
  30. data/examples/modules/sample-module/README.txt +3 -3
  31. data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +4 -4
  32. data/ext/extlookup.rb +94 -96
  33. data/ext/nagios/check_puppet.rb +94 -88
  34. data/ext/nagios/naggen +3 -3
  35. data/ext/puppet-test +27 -3
  36. data/ext/puppetlisten/puppetlisten.rb +39 -39
  37. data/ext/puppetlisten/puppetrun.rb +6 -6
  38. data/ext/puppetstoredconfigclean.rb +49 -43
  39. data/ext/pure_ruby_dsl/dsl_test.rb +7 -0
  40. data/ext/regexp_nodes/regexp_nodes.rb +133 -133
  41. data/ext/yaml_nodes.rb +99 -0
  42. data/install.rb +109 -118
  43. data/lib/puppet.rb +118 -131
  44. data/lib/puppet/agent.rb +86 -119
  45. data/lib/puppet/agent/locker.rb +28 -30
  46. data/lib/puppet/application.rb +276 -184
  47. data/lib/puppet/application/agent.rb +266 -0
  48. data/lib/puppet/application/apply.rb +165 -0
  49. data/lib/puppet/application/cert.rb +85 -0
  50. data/lib/puppet/application/describe.rb +203 -0
  51. data/lib/puppet/application/doc.rb +215 -0
  52. data/lib/puppet/application/filebucket.rb +73 -73
  53. data/lib/puppet/application/kick.rb +212 -0
  54. data/lib/puppet/application/master.rb +156 -0
  55. data/lib/puppet/application/queue.rb +91 -0
  56. data/lib/puppet/application/resource.rb +118 -0
  57. data/lib/puppet/configurer.rb +214 -197
  58. data/lib/puppet/configurer/downloader.rb +63 -63
  59. data/lib/puppet/configurer/fact_handler.rb +51 -51
  60. data/lib/puppet/configurer/plugin_handler.rb +19 -19
  61. data/lib/puppet/daemon.rb +100 -103
  62. data/lib/puppet/defaults.rb +793 -796
  63. data/lib/puppet/dsl.rb +5 -269
  64. data/lib/puppet/dsl/resource_api.rb +120 -0
  65. data/lib/puppet/dsl/resource_type_api.rb +40 -0
  66. data/lib/puppet/error.rb +34 -36
  67. data/lib/puppet/external/base64.rb +8 -8
  68. data/lib/puppet/external/dot.rb +262 -262
  69. data/lib/puppet/external/event-loop/better-definers.rb +297 -297
  70. data/lib/puppet/external/event-loop/event-loop.rb +264 -272
  71. data/lib/puppet/external/event-loop/signal-system.rb +161 -163
  72. data/lib/puppet/external/lock.rb +41 -41
  73. data/lib/puppet/external/nagios.rb +32 -32
  74. data/lib/puppet/external/nagios/base.rb +453 -458
  75. data/lib/puppet/external/nagios/parser.rb +264 -287
  76. data/lib/puppet/external/pson/common.rb +8 -5
  77. data/lib/puppet/external/pson/pure/generator.rb +26 -26
  78. data/lib/puppet/external/pson/pure/parser.rb +43 -48
  79. data/lib/puppet/feature/base.rb +21 -1
  80. data/lib/puppet/feature/pson.rb +4 -4
  81. data/lib/puppet/feature/rack.rb +14 -14
  82. data/lib/puppet/feature/rails.rb +23 -25
  83. data/lib/puppet/file_bucket.rb +4 -0
  84. data/lib/puppet/file_bucket/dipper.rb +99 -0
  85. data/lib/puppet/file_bucket/file.rb +136 -0
  86. data/lib/puppet/file_bucket/file/indirection_hooks.rb +9 -0
  87. data/lib/puppet/file_collection.rb +20 -20
  88. data/lib/puppet/file_collection/lookup.rb +11 -11
  89. data/lib/puppet/file_serving/base.rb +67 -71
  90. data/lib/puppet/file_serving/configuration.rb +84 -86
  91. data/lib/puppet/file_serving/configuration/parser.rb +103 -102
  92. data/lib/puppet/file_serving/content.rb +34 -33
  93. data/lib/puppet/file_serving/fileset.rb +131 -133
  94. data/lib/puppet/file_serving/indirection_hooks.rb +17 -17
  95. data/lib/puppet/file_serving/metadata.rb +98 -95
  96. data/lib/puppet/file_serving/mount.rb +22 -22
  97. data/lib/puppet/file_serving/mount/file.rb +101 -106
  98. data/lib/puppet/file_serving/mount/modules.rb +15 -15
  99. data/lib/puppet/file_serving/mount/plugins.rb +15 -16
  100. data/lib/puppet/file_serving/terminus_helper.rb +13 -13
  101. data/lib/puppet/indirector.rb +48 -49
  102. data/lib/puppet/indirector/active_record.rb +19 -19
  103. data/lib/puppet/indirector/catalog/active_record.rb +25 -25
  104. data/lib/puppet/indirector/catalog/compiler.rb +134 -145
  105. data/lib/puppet/indirector/catalog/rest.rb +1 -1
  106. data/lib/puppet/indirector/catalog/yaml.rb +13 -13
  107. data/lib/puppet/indirector/certificate/ca.rb +3 -3
  108. data/lib/puppet/indirector/certificate/file.rb +3 -3
  109. data/lib/puppet/indirector/certificate/rest.rb +8 -8
  110. data/lib/puppet/indirector/certificate_request/ca.rb +7 -7
  111. data/lib/puppet/indirector/certificate_request/file.rb +2 -2
  112. data/lib/puppet/indirector/certificate_request/rest.rb +3 -3
  113. data/lib/puppet/indirector/certificate_revocation_list/ca.rb +2 -2
  114. data/lib/puppet/indirector/certificate_revocation_list/file.rb +2 -2
  115. data/lib/puppet/indirector/certificate_revocation_list/rest.rb +3 -3
  116. data/lib/puppet/indirector/couch.rb +76 -0
  117. data/lib/puppet/indirector/direct_file_server.rb +11 -11
  118. data/lib/puppet/indirector/envelope.rb +4 -4
  119. data/lib/puppet/indirector/exec.rb +38 -42
  120. data/lib/puppet/indirector/facts/active_record.rb +24 -24
  121. data/lib/puppet/indirector/facts/couch.rb +31 -0
  122. data/lib/puppet/indirector/facts/facter.rb +63 -61
  123. data/lib/puppet/indirector/facts/memory.rb +4 -4
  124. data/lib/puppet/indirector/facts/rest.rb +1 -1
  125. data/lib/puppet/indirector/facts/yaml.rb +2 -2
  126. data/lib/puppet/indirector/file.rb +67 -46
  127. data/lib/puppet/indirector/file_bucket_file/file.rb +146 -0
  128. data/lib/puppet/indirector/file_bucket_file/rest.rb +8 -0
  129. data/lib/puppet/indirector/file_content/file.rb +1 -1
  130. data/lib/puppet/indirector/file_content/file_server.rb +1 -1
  131. data/lib/puppet/indirector/file_content/rest.rb +1 -1
  132. data/lib/puppet/indirector/file_metadata/file.rb +11 -11
  133. data/lib/puppet/indirector/file_metadata/file_server.rb +1 -1
  134. data/lib/puppet/indirector/file_metadata/rest.rb +1 -1
  135. data/lib/puppet/indirector/file_server.rb +44 -44
  136. data/lib/puppet/indirector/indirection.rb +249 -260
  137. data/lib/puppet/indirector/key/ca.rb +5 -5
  138. data/lib/puppet/indirector/key/file.rb +29 -29
  139. data/lib/puppet/indirector/ldap.rb +62 -64
  140. data/lib/puppet/indirector/memory.rb +13 -13
  141. data/lib/puppet/indirector/node/active_record.rb +6 -6
  142. data/lib/puppet/indirector/node/exec.rb +40 -44
  143. data/lib/puppet/indirector/node/ldap.rb +246 -212
  144. data/lib/puppet/indirector/node/memory.rb +5 -5
  145. data/lib/puppet/indirector/node/plain.rb +12 -12
  146. data/lib/puppet/indirector/node/rest.rb +2 -2
  147. data/lib/puppet/indirector/node/yaml.rb +2 -2
  148. data/lib/puppet/indirector/plain.rb +4 -4
  149. data/lib/puppet/indirector/queue.rb +49 -51
  150. data/lib/puppet/indirector/report/processor.rb +34 -37
  151. data/lib/puppet/indirector/report/rest.rb +3 -3
  152. data/lib/puppet/indirector/request.rb +171 -157
  153. data/lib/puppet/indirector/resource/ral.rb +48 -0
  154. data/lib/puppet/indirector/resource/rest.rb +5 -0
  155. data/lib/puppet/indirector/resource_type.rb +5 -0
  156. data/lib/puppet/indirector/resource_type/parser.rb +27 -0
  157. data/lib/puppet/indirector/resource_type/rest.rb +7 -0
  158. data/lib/puppet/indirector/rest.rb +83 -79
  159. data/lib/puppet/indirector/run/local.rb +8 -0
  160. data/lib/puppet/indirector/run/rest.rb +6 -0
  161. data/lib/puppet/indirector/ssl_file.rb +165 -165
  162. data/lib/puppet/indirector/status.rb +3 -0
  163. data/lib/puppet/indirector/status/local.rb +7 -0
  164. data/lib/puppet/indirector/status/rest.rb +5 -0
  165. data/lib/puppet/indirector/terminus.rb +129 -133
  166. data/lib/puppet/indirector/yaml.rb +47 -49
  167. data/lib/puppet/metatype/manager.rb +120 -114
  168. data/lib/puppet/module.rb +182 -124
  169. data/lib/puppet/network/authconfig.rb +146 -156
  170. data/lib/puppet/network/authorization.rb +63 -70
  171. data/lib/puppet/network/authstore.rb +226 -232
  172. data/lib/puppet/network/client.rb +141 -152
  173. data/lib/puppet/network/client/ca.rb +47 -49
  174. data/lib/puppet/network/client/file.rb +3 -3
  175. data/lib/puppet/network/client/proxy.rb +19 -19
  176. data/lib/puppet/network/client/report.rb +17 -21
  177. data/lib/puppet/network/client/runner.rb +5 -7
  178. data/lib/puppet/network/client/status.rb +1 -1
  179. data/lib/puppet/network/client_request.rb +20 -22
  180. data/lib/puppet/network/format.rb +79 -81
  181. data/lib/puppet/network/format_handler.rb +135 -130
  182. data/lib/puppet/network/formats.rb +128 -154
  183. data/lib/puppet/network/handler.rb +43 -46
  184. data/lib/puppet/network/handler/ca.rb +129 -135
  185. data/lib/puppet/network/handler/filebucket.rb +39 -170
  186. data/lib/puppet/network/handler/fileserver.rb +624 -656
  187. data/lib/puppet/network/handler/master.rb +62 -75
  188. data/lib/puppet/network/handler/report.rb +60 -67
  189. data/lib/puppet/network/handler/runner.rb +20 -20
  190. data/lib/puppet/network/handler/status.rb +9 -9
  191. data/lib/puppet/network/http.rb +12 -12
  192. data/lib/puppet/network/http/api/v1.rb +49 -44
  193. data/lib/puppet/network/http/compression.rb +111 -0
  194. data/lib/puppet/network/http/handler.rb +183 -183
  195. data/lib/puppet/network/http/mongrel.rb +46 -48
  196. data/lib/puppet/network/http/mongrel/rest.rb +73 -66
  197. data/lib/puppet/network/http/rack.rb +45 -45
  198. data/lib/puppet/network/http/rack/httphandler.rb +7 -7
  199. data/lib/puppet/network/http/rack/rest.rb +84 -61
  200. data/lib/puppet/network/http/rack/xmlrpc.rb +49 -49
  201. data/lib/puppet/network/http/webrick.rb +108 -112
  202. data/lib/puppet/network/http/webrick/rest.rb +60 -57
  203. data/lib/puppet/network/http_pool.rb +95 -83
  204. data/lib/puppet/network/http_server/mongrel.rb +90 -90
  205. data/lib/puppet/network/http_server/webrick.rb +139 -148
  206. data/lib/puppet/network/rest_authconfig.rb +76 -71
  207. data/lib/puppet/network/rest_authorization.rb +11 -13
  208. data/lib/puppet/network/rights.rb +217 -226
  209. data/lib/puppet/network/server.rb +147 -151
  210. data/lib/puppet/network/xmlrpc/client.rb +197 -205
  211. data/lib/puppet/network/xmlrpc/processor.rb +68 -72
  212. data/lib/puppet/network/xmlrpc/server.rb +10 -10
  213. data/lib/puppet/network/xmlrpc/webrick_servlet.rb +94 -100
  214. data/lib/puppet/node.rb +99 -107
  215. data/lib/puppet/node/environment.rb +109 -62
  216. data/lib/puppet/node/facts.rb +48 -43
  217. data/lib/puppet/parameter.rb +246 -498
  218. data/lib/puppet/parameter/value.rb +63 -0
  219. data/lib/puppet/parameter/value_collection.rb +143 -0
  220. data/lib/puppet/parser.rb +4 -0
  221. data/lib/puppet/parser/ast.rb +81 -67
  222. data/lib/puppet/parser/ast/arithmetic_operator.rb +27 -29
  223. data/lib/puppet/parser/ast/astarray.rb +50 -50
  224. data/lib/puppet/parser/ast/asthash.rb +37 -0
  225. data/lib/puppet/parser/ast/boolean_operator.rb +33 -35
  226. data/lib/puppet/parser/ast/branch.rb +29 -31
  227. data/lib/puppet/parser/ast/caseopt.rb +50 -56
  228. data/lib/puppet/parser/ast/casestatement.rb +30 -30
  229. data/lib/puppet/parser/ast/collection.rb +43 -37
  230. data/lib/puppet/parser/ast/collexpr.rb +66 -69
  231. data/lib/puppet/parser/ast/comparison_operator.rb +32 -35
  232. data/lib/puppet/parser/ast/else.rb +13 -13
  233. data/lib/puppet/parser/ast/function.rb +34 -43
  234. data/lib/puppet/parser/ast/ifstatement.rb +23 -27
  235. data/lib/puppet/parser/ast/in_operator.rb +24 -0
  236. data/lib/puppet/parser/ast/leaf.rb +173 -156
  237. data/lib/puppet/parser/ast/match_operator.rb +16 -19
  238. data/lib/puppet/parser/ast/minus.rb +13 -13
  239. data/lib/puppet/parser/ast/nop.rb +6 -6
  240. data/lib/puppet/parser/ast/not.rb +9 -9
  241. data/lib/puppet/parser/ast/relationship.rb +60 -0
  242. data/lib/puppet/parser/ast/resource.rb +58 -57
  243. data/lib/puppet/parser/ast/resource_defaults.rb +16 -16
  244. data/lib/puppet/parser/ast/resource_override.rb +51 -51
  245. data/lib/puppet/parser/ast/resource_reference.rb +17 -72
  246. data/lib/puppet/parser/ast/resourceparam.rb +20 -17
  247. data/lib/puppet/parser/ast/selector.rb +30 -34
  248. data/lib/puppet/parser/ast/tag.rb +16 -16
  249. data/lib/puppet/parser/ast/vardef.rb +20 -16
  250. data/lib/puppet/parser/collector.rb +181 -189
  251. data/lib/puppet/parser/compiler.rb +395 -364
  252. data/lib/puppet/parser/files.rb +65 -69
  253. data/lib/puppet/parser/functions.rb +85 -97
  254. data/lib/puppet/parser/functions/defined.rb +23 -23
  255. data/lib/puppet/parser/functions/fail.rb +2 -2
  256. data/lib/puppet/parser/functions/file.rb +21 -19
  257. data/lib/puppet/parser/functions/fqdn_rand.rb +7 -7
  258. data/lib/puppet/parser/functions/generate.rb +24 -26
  259. data/lib/puppet/parser/functions/include.rb +16 -18
  260. data/lib/puppet/parser/functions/inline_template.rb +16 -17
  261. data/lib/puppet/parser/functions/realize.rb +8 -8
  262. data/lib/puppet/parser/functions/regsubst.rb +74 -59
  263. data/lib/puppet/parser/functions/require.rb +35 -33
  264. data/lib/puppet/parser/functions/search.rb +5 -5
  265. data/lib/puppet/parser/functions/sha1.rb +3 -4
  266. data/lib/puppet/parser/functions/shellquote.rb +31 -33
  267. data/lib/puppet/parser/functions/split.rb +8 -8
  268. data/lib/puppet/parser/functions/sprintf.rb +10 -9
  269. data/lib/puppet/parser/functions/tag.rb +3 -3
  270. data/lib/puppet/parser/functions/tagged.rb +13 -13
  271. data/lib/puppet/parser/functions/template.rb +18 -19
  272. data/lib/puppet/parser/functions/versioncmp.rb +17 -14
  273. data/lib/puppet/parser/grammar.ra +485 -422
  274. data/lib/puppet/parser/lexer.rb +500 -442
  275. data/lib/puppet/parser/parser.rb +1438 -1084
  276. data/lib/puppet/parser/parser_support.rb +227 -502
  277. data/lib/puppet/parser/relationship.rb +43 -0
  278. data/lib/puppet/parser/resource.rb +280 -375
  279. data/lib/puppet/parser/resource/param.rb +18 -18
  280. data/lib/puppet/parser/scope.rb +450 -447
  281. data/lib/puppet/parser/templatewrapper.rb +92 -94
  282. data/lib/puppet/parser/type_loader.rb +146 -0
  283. data/lib/puppet/parser/yaml_trimmer.rb +6 -8
  284. data/lib/puppet/property.rb +290 -453
  285. data/lib/puppet/property/ensure.rb +92 -0
  286. data/lib/puppet/property/keyvalue.rb +74 -82
  287. data/lib/puppet/property/list.rb +71 -81
  288. data/lib/puppet/property/ordered_list.rb +15 -15
  289. data/lib/puppet/provider.rb +229 -241
  290. data/lib/puppet/provider/augeas/augeas.rb +318 -320
  291. data/lib/puppet/provider/computer/computer.rb +13 -13
  292. data/lib/puppet/provider/confine.rb +63 -63
  293. data/lib/puppet/provider/confine/exists.rb +14 -14
  294. data/lib/puppet/provider/confine/false.rb +12 -12
  295. data/lib/puppet/provider/confine/feature.rb +10 -10
  296. data/lib/puppet/provider/confine/true.rb +13 -13
  297. data/lib/puppet/provider/confine/variable.rb +51 -54
  298. data/lib/puppet/provider/confine_collection.rb +38 -38
  299. data/lib/puppet/provider/confiner.rb +10 -14
  300. data/lib/puppet/provider/cron/crontab.rb +172 -173
  301. data/lib/puppet/provider/file/posix.rb +99 -0
  302. data/lib/puppet/provider/file/win32.rb +74 -0
  303. data/lib/puppet/provider/group/directoryservice.rb +6 -6
  304. data/lib/puppet/provider/group/groupadd.rb +18 -20
  305. data/lib/puppet/provider/group/ldap.rb +40 -43
  306. data/lib/puppet/provider/group/pw.rb +23 -23
  307. data/lib/puppet/provider/host/parsed.rb +51 -50
  308. data/lib/puppet/provider/ldap.rb +121 -123
  309. data/lib/puppet/provider/macauthorization/macauthorization.rb +263 -272
  310. data/lib/puppet/provider/mailalias/aliases.rb +34 -31
  311. data/lib/puppet/provider/maillist/mailman.rb +87 -93
  312. data/lib/puppet/provider/mcx/mcxcontent.rb +155 -151
  313. data/lib/puppet/provider/mount.rb +36 -40
  314. data/lib/puppet/provider/mount/parsed.rb +28 -26
  315. data/lib/puppet/provider/naginator.rb +46 -48
  316. data/lib/puppet/provider/nameservice.rb +215 -257
  317. data/lib/puppet/provider/nameservice/directoryservice.rb +455 -471
  318. data/lib/puppet/provider/nameservice/objectadd.rb +21 -21
  319. data/lib/puppet/provider/nameservice/pw.rb +13 -13
  320. data/lib/puppet/provider/package.rb +18 -20
  321. data/lib/puppet/provider/package/aix.rb +128 -0
  322. data/lib/puppet/provider/package/appdmg.rb +78 -82
  323. data/lib/puppet/provider/package/apple.rb +39 -40
  324. data/lib/puppet/provider/package/apt.rb +95 -104
  325. data/lib/puppet/provider/package/aptitude.rb +19 -21
  326. data/lib/puppet/provider/package/aptrpm.rb +70 -72
  327. data/lib/puppet/provider/package/blastwave.rb +88 -94
  328. data/lib/puppet/provider/package/darwinport.rb +67 -69
  329. data/lib/puppet/provider/package/dpkg.rb +123 -97
  330. data/lib/puppet/provider/package/fink.rb +66 -68
  331. data/lib/puppet/provider/package/freebsd.rb +38 -40
  332. data/lib/puppet/provider/package/gem.rb +98 -102
  333. data/lib/puppet/provider/package/hpux.rb +37 -39
  334. data/lib/puppet/provider/package/nim.rb +35 -0
  335. data/lib/puppet/provider/package/openbsd.rb +100 -75
  336. data/lib/puppet/provider/package/pkg.rb +108 -0
  337. data/lib/puppet/provider/package/pkgdmg.rb +95 -87
  338. data/lib/puppet/provider/package/portage.rb +101 -104
  339. data/lib/puppet/provider/package/ports.rb +71 -73
  340. data/lib/puppet/provider/package/portupgrade.rb +251 -0
  341. data/lib/puppet/provider/package/rpm.rb +113 -115
  342. data/lib/puppet/provider/package/rug.rb +46 -46
  343. data/lib/puppet/provider/package/sun.rb +135 -151
  344. data/lib/puppet/provider/package/sunfreeware.rb +5 -5
  345. data/lib/puppet/provider/package/up2date.rb +31 -31
  346. data/lib/puppet/provider/package/urpmi.rb +51 -51
  347. data/lib/puppet/provider/package/yum.rb +90 -98
  348. data/lib/puppet/provider/package/zypper.rb +52 -0
  349. data/lib/puppet/provider/parsedfile.rb +306 -329
  350. data/lib/puppet/provider/port/parsed.rb +5 -5
  351. data/lib/puppet/provider/selboolean/getsetsebool.rb +34 -34
  352. data/lib/puppet/provider/selmodule/semodule.rb +103 -111
  353. data/lib/puppet/provider/service/base.rb +134 -139
  354. data/lib/puppet/provider/service/bsd.rb +48 -0
  355. data/lib/puppet/provider/service/daemontools.rb +158 -162
  356. data/lib/puppet/provider/service/debian.rb +36 -36
  357. data/lib/puppet/provider/service/freebsd.rb +118 -38
  358. data/lib/puppet/provider/service/gentoo.rb +33 -39
  359. data/lib/puppet/provider/service/init.rb +125 -125
  360. data/lib/puppet/provider/service/launchd.rb +234 -254
  361. data/lib/puppet/provider/service/redhat.rb +58 -58
  362. data/lib/puppet/provider/service/runit.rb +74 -74
  363. data/lib/puppet/provider/service/smf.rb +81 -85
  364. data/lib/puppet/provider/service/src.rb +87 -0
  365. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +73 -81
  366. data/lib/puppet/provider/sshkey/parsed.rb +24 -21
  367. data/lib/puppet/provider/user/directoryservice.rb +71 -71
  368. data/lib/puppet/provider/user/hpux.rb +20 -20
  369. data/lib/puppet/provider/user/ldap.rb +106 -110
  370. data/lib/puppet/provider/user/pw.rb +33 -37
  371. data/lib/puppet/provider/user/user_role_add.rb +168 -183
  372. data/lib/puppet/provider/user/useradd.rb +50 -51
  373. data/lib/puppet/provider/zfs/solaris.rb +35 -35
  374. data/lib/puppet/provider/zone/solaris.rb +206 -205
  375. data/lib/puppet/provider/zpool/solaris.rb +95 -97
  376. data/lib/puppet/rails.rb +115 -122
  377. data/lib/puppet/rails/benchmark.rb +43 -49
  378. data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +8 -12
  379. data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +8 -12
  380. data/lib/puppet/rails/database/003_add_environment_to_host.rb +6 -10
  381. data/lib/puppet/rails/database/schema.rb +100 -97
  382. data/lib/puppet/rails/fact_name.rb +1 -1
  383. data/lib/puppet/rails/fact_value.rb +5 -5
  384. data/lib/puppet/rails/host.rb +252 -249
  385. data/lib/puppet/rails/param_name.rb +15 -15
  386. data/lib/puppet/rails/param_value.rb +55 -55
  387. data/lib/puppet/rails/puppet_tag.rb +4 -4
  388. data/lib/puppet/rails/resource.rb +189 -203
  389. data/lib/puppet/rails/resource_tag.rb +19 -19
  390. data/lib/puppet/rails/source_file.rb +5 -5
  391. data/lib/puppet/reference/configuration.rb +53 -56
  392. data/lib/puppet/reference/function.rb +1 -1
  393. data/lib/puppet/reference/indirection.rb +13 -13
  394. data/lib/puppet/reference/metaparameter.rb +40 -40
  395. data/lib/puppet/reference/network.rb +16 -16
  396. data/lib/puppet/reference/providers.rb +97 -98
  397. data/lib/puppet/reference/report.rb +1 -1
  398. data/lib/puppet/reference/type.rb +67 -70
  399. data/lib/puppet/relationship.rb +65 -67
  400. data/lib/puppet/reports.rb +32 -34
  401. data/lib/puppet/reports/http.rb +22 -0
  402. data/lib/puppet/reports/log.rb +7 -6
  403. data/lib/puppet/reports/rrdgraph.rb +105 -114
  404. data/lib/puppet/reports/store.rb +53 -56
  405. data/lib/puppet/reports/tagmail.rb +149 -157
  406. data/lib/puppet/resource.rb +428 -194
  407. data/lib/puppet/resource/catalog.rb +496 -512
  408. data/lib/puppet/resource/status.rb +58 -0
  409. data/lib/puppet/resource/type.rb +311 -0
  410. data/lib/puppet/resource/type_collection.rb +217 -0
  411. data/lib/puppet/resource/type_collection_helper.rb +7 -0
  412. data/lib/puppet/run.rb +77 -0
  413. data/lib/puppet/simple_graph.rb +381 -413
  414. data/lib/puppet/ssl.rb +2 -1
  415. data/lib/puppet/ssl/base.rb +60 -43
  416. data/lib/puppet/ssl/certificate.rb +21 -21
  417. data/lib/puppet/ssl/certificate_authority.rb +215 -229
  418. data/lib/puppet/ssl/certificate_authority/interface.rb +84 -68
  419. data/lib/puppet/ssl/certificate_factory.rb +119 -119
  420. data/lib/puppet/ssl/certificate_request.rb +52 -45
  421. data/lib/puppet/ssl/certificate_revocation_list.rb +78 -78
  422. data/lib/puppet/ssl/host.rb +230 -228
  423. data/lib/puppet/ssl/inventory.rb +33 -33
  424. data/lib/puppet/ssl/key.rb +37 -37
  425. data/lib/puppet/sslcertificates.rb +124 -123
  426. data/lib/puppet/sslcertificates/ca.rb +327 -344
  427. data/lib/puppet/sslcertificates/certificate.rb +197 -224
  428. data/lib/puppet/sslcertificates/inventory.rb +27 -29
  429. data/lib/puppet/sslcertificates/support.rb +113 -119
  430. data/lib/puppet/status.rb +28 -0
  431. data/lib/puppet/transaction.rb +349 -696
  432. data/lib/puppet/transaction/change.rb +80 -85
  433. data/lib/puppet/transaction/event.rb +54 -14
  434. data/lib/puppet/transaction/event_manager.rb +99 -0
  435. data/lib/puppet/transaction/report.rb +121 -59
  436. data/lib/puppet/transaction/resource_harness.rb +150 -0
  437. data/lib/puppet/transportable.rb +215 -226
  438. data/lib/puppet/type.rb +1644 -1849
  439. data/lib/puppet/type/augeas.rb +153 -134
  440. data/lib/puppet/type/component.rb +63 -65
  441. data/lib/puppet/type/computer.rb +44 -44
  442. data/lib/puppet/type/cron.rb +364 -384
  443. data/lib/puppet/type/exec.rb +583 -521
  444. data/lib/puppet/type/file.rb +786 -823
  445. data/lib/puppet/type/file/checksum.rb +23 -240
  446. data/lib/puppet/type/file/content.rb +193 -129
  447. data/lib/puppet/type/file/ensure.rb +149 -153
  448. data/lib/puppet/type/file/group.rb +94 -104
  449. data/lib/puppet/type/file/mode.rb +109 -122
  450. data/lib/puppet/type/file/owner.rb +39 -131
  451. data/lib/puppet/type/file/selcontext.rb +69 -73
  452. data/lib/puppet/type/file/source.rb +165 -153
  453. data/lib/puppet/type/file/target.rb +56 -60
  454. data/lib/puppet/type/file/type.rb +18 -18
  455. data/lib/puppet/type/filebucket.rb +91 -92
  456. data/lib/puppet/type/group.rb +77 -82
  457. data/lib/puppet/type/host.rb +85 -85
  458. data/lib/puppet/type/k5login.rb +65 -65
  459. data/lib/puppet/type/macauthorization.rb +141 -143
  460. data/lib/puppet/type/mailalias.rb +37 -37
  461. data/lib/puppet/type/maillist.rb +51 -51
  462. data/lib/puppet/type/mcx.rb +62 -62
  463. data/lib/puppet/type/mount.rb +199 -193
  464. data/lib/puppet/type/notify.rb +33 -33
  465. data/lib/puppet/type/package.rb +301 -298
  466. data/lib/puppet/type/port.rb +4 -4
  467. data/lib/puppet/type/resources.rb +107 -123
  468. data/lib/puppet/type/schedule.rb +317 -326
  469. data/lib/puppet/type/selboolean.rb +19 -19
  470. data/lib/puppet/type/selmodule.rb +34 -34
  471. data/lib/puppet/type/service.rb +152 -152
  472. data/lib/puppet/type/ssh_authorized_key.rb +74 -78
  473. data/lib/puppet/type/sshkey.rb +52 -56
  474. data/lib/puppet/type/stage.rb +18 -0
  475. data/lib/puppet/type/tidy.rb +289 -300
  476. data/lib/puppet/type/user.rb +300 -312
  477. data/lib/puppet/type/yumrepo.rb +300 -335
  478. data/lib/puppet/type/zfs.rb +36 -36
  479. data/lib/puppet/type/zone.rb +376 -347
  480. data/lib/puppet/type/zpool.rb +71 -77
  481. data/lib/puppet/util.rb +383 -387
  482. data/lib/puppet/util/autoload.rb +125 -143
  483. data/lib/puppet/util/autoload/file_cache.rb +78 -101
  484. data/lib/puppet/util/backups.rb +66 -66
  485. data/lib/puppet/util/cacher.rb +112 -120
  486. data/lib/puppet/util/checksums.rb +119 -84
  487. data/lib/puppet/util/classgen.rb +157 -167
  488. data/lib/puppet/util/command_line.rb +95 -0
  489. data/lib/puppet/util/command_line/filebucket +97 -0
  490. data/lib/puppet/util/command_line/pi +48 -0
  491. data/lib/puppet/util/command_line/puppet +69 -0
  492. data/lib/puppet/util/command_line/puppetca +110 -0
  493. data/lib/puppet/util/command_line/puppetd +186 -0
  494. data/lib/puppet/util/command_line/puppetdoc +67 -0
  495. data/lib/puppet/util/command_line/puppetmasterd +65 -0
  496. data/lib/puppet/util/command_line/puppetqd +53 -0
  497. data/lib/puppet/util/command_line/puppetrun +128 -0
  498. data/lib/puppet/util/command_line/ralsh +89 -0
  499. data/lib/puppet/util/constant_inflector.rb +7 -7
  500. data/lib/puppet/util/diff.rb +59 -56
  501. data/lib/puppet/util/docs.rb +97 -99
  502. data/lib/puppet/util/errors.rb +53 -44
  503. data/lib/puppet/util/execution.rb +15 -15
  504. data/lib/puppet/util/feature.rb +62 -72
  505. data/lib/puppet/util/file_locking.rb +33 -33
  506. data/lib/puppet/util/fileparsing.rb +292 -318
  507. data/lib/puppet/util/filetype.rb +246 -263
  508. data/lib/puppet/util/graph.rb +16 -18
  509. data/lib/puppet/util/inifile.rb +170 -184
  510. data/lib/puppet/util/inline_docs.rb +26 -0
  511. data/lib/puppet/util/instance_loader.rb +58 -58
  512. data/lib/puppet/util/ldap/connection.rb +57 -59
  513. data/lib/puppet/util/ldap/generator.rb +31 -31
  514. data/lib/puppet/util/ldap/manager.rb +233 -235
  515. data/lib/puppet/util/loadedfile.rb +49 -51
  516. data/lib/puppet/util/log.rb +210 -494
  517. data/lib/puppet/util/log/destination.rb +49 -0
  518. data/lib/puppet/util/log/destinations.rb +217 -0
  519. data/lib/puppet/util/log_paths.rb +15 -17
  520. data/lib/puppet/util/logging.rb +34 -13
  521. data/lib/puppet/util/metaid.rb +15 -15
  522. data/lib/puppet/util/methodhelper.rb +24 -26
  523. data/lib/puppet/util/metric.rb +123 -125
  524. data/lib/puppet/util/monkey_patches.rb +21 -20
  525. data/lib/puppet/util/nagios_maker.rb +41 -41
  526. data/lib/puppet/util/package.rb +24 -26
  527. data/lib/puppet/util/pidlock.rb +49 -49
  528. data/lib/puppet/util/posix.rb +115 -115
  529. data/lib/puppet/util/provider_features.rb +147 -155
  530. data/lib/puppet/util/pson.rb +5 -5
  531. data/lib/puppet/util/queue.rb +55 -55
  532. data/lib/puppet/util/queue/stomp.rb +27 -27
  533. data/lib/puppet/util/rails/cache_accumulator.rb +49 -49
  534. data/lib/puppet/util/rails/collection_merger.rb +13 -13
  535. data/lib/puppet/util/rails/reference_serializer.rb +26 -26
  536. data/lib/puppet/util/rdoc.rb +77 -74
  537. data/lib/puppet/util/rdoc/code_objects.rb +235 -217
  538. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +732 -676
  539. data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +38 -12
  540. data/lib/puppet/util/rdoc/parser.rb +418 -392
  541. data/lib/puppet/util/reference.rb +168 -174
  542. data/lib/puppet/util/resource_template.rb +17 -17
  543. data/lib/puppet/util/run_mode.rb +81 -0
  544. data/lib/puppet/util/selinux.rb +184 -200
  545. data/lib/puppet/util/settings.rb +886 -919
  546. data/lib/puppet/util/settings/boolean_setting.rb +20 -23
  547. data/lib/puppet/util/settings/file_setting.rb +98 -99
  548. data/lib/puppet/util/settings/setting.rb +71 -87
  549. data/lib/puppet/util/storage.rb +73 -84
  550. data/lib/puppet/util/subclass_loader.rb +59 -66
  551. data/lib/puppet/util/suidmanager.rb +87 -84
  552. data/lib/puppet/util/tagging.rb +37 -39
  553. data/lib/puppet/util/user_attr.rb +14 -14
  554. data/lib/puppet/util/warnings.rb +20 -20
  555. data/lib/puppet/util/zaml.rb +242 -241
  556. data/man/man5/puppet.conf.5 +148 -76
  557. data/man/man8/filebucket.8 +6 -6
  558. data/man/man8/pi.8 +5 -5
  559. data/man/man8/puppet.8 +2 -73
  560. data/man/man8/puppetca.8 +47 -32
  561. data/man/man8/puppetd.8 +118 -76
  562. data/man/man8/puppetdoc.8 +16 -12
  563. data/man/man8/puppetmasterd.8 +4 -4
  564. data/man/man8/puppetqd.8 +4 -4
  565. data/man/man8/puppetrun.8 +23 -22
  566. data/man/man8/ralsh.8 +16 -17
  567. data/spec/fixtures/yaml/test.local.yaml +16 -0
  568. data/spec/integration/application/apply_spec.rb +33 -0
  569. data/spec/integration/configurer_spec.rb +35 -0
  570. data/spec/integration/defaults_spec.rb +258 -0
  571. data/spec/integration/file_serving/content_spec.rb +20 -0
  572. data/spec/integration/file_serving/fileset_spec.rb +14 -0
  573. data/spec/integration/file_serving/metadata_spec.rb +21 -0
  574. data/spec/integration/file_serving/terminus_helper_spec.rb +22 -0
  575. data/spec/integration/indirector/bucket_file/rest_spec.rb +68 -0
  576. data/spec/integration/indirector/catalog/compiler_spec.rb +68 -0
  577. data/spec/integration/indirector/catalog/queue_spec.rb +61 -0
  578. data/spec/integration/indirector/certificate/rest_spec.rb +68 -0
  579. data/spec/integration/indirector/certificate_request/rest_spec.rb +88 -0
  580. data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +76 -0
  581. data/spec/integration/indirector/direct_file_server_spec.rb +73 -0
  582. data/spec/integration/indirector/file_content/file_server_spec.rb +94 -0
  583. data/spec/integration/indirector/file_metadata/file_server_spec.rb +18 -0
  584. data/spec/integration/indirector/node/ldap_spec.rb +15 -0
  585. data/spec/integration/indirector/report/rest_spec.rb +96 -0
  586. data/spec/integration/indirector/rest_spec.rb +524 -0
  587. data/spec/integration/network/client_spec.rb +19 -0
  588. data/spec/integration/network/formats_spec.rb +110 -0
  589. data/spec/integration/network/handler_spec.rb +25 -0
  590. data/spec/integration/network/server/mongrel_spec.rb +66 -0
  591. data/spec/integration/network/server/webrick_spec.rb +85 -0
  592. data/spec/integration/node/environment_spec.rb +58 -0
  593. data/spec/integration/node/facts_spec.rb +47 -0
  594. data/spec/integration/node_spec.rb +93 -0
  595. data/spec/integration/parser/collector_spec.rb +38 -0
  596. data/spec/integration/parser/compiler_spec.rb +29 -0
  597. data/spec/integration/parser/functions/require_spec.rb +44 -0
  598. data/spec/integration/parser/parser_spec.rb +113 -0
  599. data/spec/integration/provider/mailalias/aliases_spec.rb +25 -0
  600. data/spec/integration/provider/package_spec.rb +26 -0
  601. data/spec/integration/provider/service/init_spec.rb +32 -0
  602. data/spec/integration/reference/providers_spec.rb +17 -0
  603. data/spec/integration/reports_spec.rb +18 -0
  604. data/spec/integration/resource/catalog_spec.rb +61 -0
  605. data/spec/integration/resource/type_collection_spec.rb +96 -0
  606. data/spec/integration/ssl/certificate_authority_spec.rb +135 -0
  607. data/spec/integration/ssl/certificate_request_spec.rb +61 -0
  608. data/spec/integration/ssl/certificate_revocation_list_spec.rb +42 -0
  609. data/spec/integration/ssl/host_spec.rb +90 -0
  610. data/spec/integration/transaction/report_spec.rb +29 -0
  611. data/spec/integration/transaction_spec.rb +284 -0
  612. data/spec/integration/type/file_spec.rb +506 -0
  613. data/spec/integration/type/package_spec.rb +25 -0
  614. data/spec/integration/type/tidy_spec.rb +32 -0
  615. data/spec/integration/type_spec.rb +22 -0
  616. data/spec/integration/util/autoload_spec.rb +114 -0
  617. data/spec/integration/util/feature_spec.rb +54 -0
  618. data/spec/integration/util/file_locking_spec.rb +37 -0
  619. data/spec/integration/util/rdoc/parser_spec.rb +59 -0
  620. data/spec/integration/util/settings_spec.rb +30 -0
  621. data/spec/lib/puppet_spec/files.rb +16 -6
  622. data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +27 -27
  623. data/spec/monkey_patches/alias_should_to_must.rb +4 -4
  624. data/spec/shared_behaviours/file_server_terminus.rb +28 -28
  625. data/spec/shared_behaviours/file_serving.rb +53 -53
  626. data/spec/shared_behaviours/memory_terminus.rb +22 -22
  627. data/spec/spec.opts +1 -0
  628. data/spec/spec_helper.rb +61 -18
  629. data/spec/spec_specs/runnable_spec.rb +95 -0
  630. data/spec/unit/agent/locker_spec.rb +100 -0
  631. data/spec/unit/agent_spec.rb +281 -0
  632. data/spec/unit/application/agent_spec.rb +588 -0
  633. data/spec/unit/application/apply_spec.rb +387 -0
  634. data/spec/unit/application/cert_spec.rb +194 -0
  635. data/spec/unit/application/describe_spec.rb +84 -0
  636. data/spec/unit/application/doc_spec.rb +368 -0
  637. data/spec/unit/application/filebucket_spec.rb +223 -0
  638. data/spec/unit/application/kick_spec.rb +313 -0
  639. data/spec/unit/application/master_spec.rb +453 -0
  640. data/spec/unit/application/queue_spec.rb +186 -0
  641. data/spec/unit/application/resource_spec.rb +233 -0
  642. data/spec/unit/application_spec.rb +531 -0
  643. data/spec/unit/configurer/downloader_spec.rb +188 -0
  644. data/spec/unit/configurer/fact_handler_spec.rb +164 -0
  645. data/spec/unit/configurer/plugin_handler_spec.rb +112 -0
  646. data/spec/unit/configurer_spec.rb +494 -0
  647. data/spec/unit/daemon_spec.rb +306 -0
  648. data/spec/unit/dsl/resource_api_spec.rb +181 -0
  649. data/spec/unit/dsl/resource_type_api_spec.rb +46 -0
  650. data/spec/unit/file_bucket/dipper_spec.rb +122 -0
  651. data/spec/unit/file_bucket/file_spec.rb +230 -0
  652. data/spec/unit/file_collection/lookup_spec.rb +46 -0
  653. data/spec/unit/file_collection_spec.rb +53 -0
  654. data/spec/unit/file_serving/base_spec.rb +132 -0
  655. data/spec/unit/file_serving/configuration/parser_spec.rb +181 -0
  656. data/spec/unit/file_serving/configuration_spec.rb +249 -0
  657. data/spec/unit/file_serving/content_spec.rb +118 -0
  658. data/spec/unit/file_serving/fileset_spec.rb +347 -0
  659. data/spec/unit/file_serving/indirection_hooks_spec.rb +63 -0
  660. data/spec/unit/file_serving/metadata_spec.rb +286 -0
  661. data/spec/unit/file_serving/mount/file_spec.rb +196 -0
  662. data/spec/unit/file_serving/mount/modules_spec.rb +63 -0
  663. data/spec/unit/file_serving/mount/plugins_spec.rb +61 -0
  664. data/spec/unit/file_serving/mount_spec.rb +32 -0
  665. data/spec/unit/file_serving/terminus_helper_spec.rb +98 -0
  666. data/spec/unit/indirector/active_record_spec.rb +76 -0
  667. data/spec/unit/indirector/catalog/active_record_spec.rb +141 -0
  668. data/spec/unit/indirector/catalog/compiler_spec.rb +275 -0
  669. data/spec/unit/indirector/catalog/queue_spec.rb +20 -0
  670. data/spec/unit/indirector/catalog/rest_spec.rb +11 -0
  671. data/spec/unit/indirector/catalog/yaml_spec.rb +25 -0
  672. data/spec/unit/indirector/certificate/ca_spec.rb +28 -0
  673. data/spec/unit/indirector/certificate/file_spec.rb +28 -0
  674. data/spec/unit/indirector/certificate/rest_spec.rb +58 -0
  675. data/spec/unit/indirector/certificate_request/ca_spec.rb +19 -0
  676. data/spec/unit/indirector/certificate_request/file_spec.rb +19 -0
  677. data/spec/unit/indirector/certificate_request/rest_spec.rb +23 -0
  678. data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +21 -0
  679. data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +20 -0
  680. data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +23 -0
  681. data/spec/unit/indirector/code_spec.rb +33 -0
  682. data/spec/unit/indirector/direct_file_server_spec.rb +84 -0
  683. data/spec/unit/indirector/envelope_spec.rb +47 -0
  684. data/spec/unit/indirector/exec_spec.rb +56 -0
  685. data/spec/unit/indirector/facts/active_record_spec.rb +104 -0
  686. data/spec/unit/indirector/facts/couch_spec.rb +98 -0
  687. data/spec/unit/indirector/facts/facter_spec.rb +143 -0
  688. data/spec/unit/indirector/facts/rest_spec.rb +11 -0
  689. data/spec/unit/indirector/facts/yaml_spec.rb +26 -0
  690. data/spec/unit/indirector/file_bucket_file/file_spec.rb +290 -0
  691. data/spec/unit/indirector/file_bucket_file/rest_spec.rb +11 -0
  692. data/spec/unit/indirector/file_content/file_server_spec.rb +18 -0
  693. data/spec/unit/indirector/file_content/file_spec.rb +18 -0
  694. data/spec/unit/indirector/file_content/rest_spec.rb +11 -0
  695. data/spec/unit/indirector/file_metadata/file_server_spec.rb +18 -0
  696. data/spec/unit/indirector/file_metadata/file_spec.rb +52 -0
  697. data/spec/unit/indirector/file_metadata/rest_spec.rb +9 -0
  698. data/spec/unit/indirector/file_server_spec.rb +267 -0
  699. data/spec/unit/indirector/file_spec.rb +181 -0
  700. data/spec/unit/indirector/indirection_spec.rb +795 -0
  701. data/spec/unit/indirector/key/ca_spec.rb +28 -0
  702. data/spec/unit/indirector/key/file_spec.rb +104 -0
  703. data/spec/unit/indirector/ldap_spec.rb +143 -0
  704. data/spec/unit/indirector/memory_spec.rb +29 -0
  705. data/spec/unit/indirector/node/active_record_spec.rb +41 -0
  706. data/spec/unit/indirector/node/exec_spec.rb +70 -0
  707. data/spec/unit/indirector/node/ldap_spec.rb +456 -0
  708. data/spec/unit/indirector/node/memory_spec.rb +19 -0
  709. data/spec/unit/indirector/node/plain_spec.rb +19 -0
  710. data/spec/unit/indirector/node/rest_spec.rb +13 -0
  711. data/spec/unit/indirector/node/yaml_spec.rb +25 -0
  712. data/spec/unit/indirector/plain_spec.rb +29 -0
  713. data/spec/unit/indirector/queue_spec.rb +123 -0
  714. data/spec/unit/indirector/report/processor_spec.rb +81 -0
  715. data/spec/unit/indirector/report/rest_spec.rb +28 -0
  716. data/spec/unit/indirector/request_spec.rb +304 -0
  717. data/spec/unit/indirector/resource/ral_spec.rb +129 -0
  718. data/spec/unit/indirector/resource/rest_spec.rb +11 -0
  719. data/spec/unit/indirector/resource_type/parser_spec.rb +75 -0
  720. data/spec/unit/indirector/resource_type/rest_spec.rb +15 -0
  721. data/spec/unit/indirector/rest_spec.rb +455 -0
  722. data/spec/unit/indirector/run/local_spec.rb +20 -0
  723. data/spec/unit/indirector/run/rest_spec.rb +11 -0
  724. data/spec/unit/indirector/ssl_file_spec.rb +281 -0
  725. data/spec/unit/indirector/status/rest_spec.rb +11 -0
  726. data/spec/unit/indirector/terminus_spec.rb +245 -0
  727. data/spec/unit/indirector/yaml_spec.rb +146 -0
  728. data/spec/unit/indirector_spec.rb +157 -0
  729. data/spec/unit/module_spec.rb +547 -0
  730. data/spec/unit/network/authconfig_spec.rb +292 -0
  731. data/spec/unit/network/authstore_spec.rb +370 -0
  732. data/spec/unit/network/client_spec.rb +45 -0
  733. data/spec/unit/network/format_handler_spec.rb +336 -0
  734. data/spec/unit/network/format_spec.rb +198 -0
  735. data/spec/unit/network/formats_spec.rb +337 -0
  736. data/spec/unit/network/handler/fileserver_spec.rb +172 -0
  737. data/spec/unit/network/http/api/v1_spec.rb +122 -0
  738. data/spec/unit/network/http/compression_spec.rb +199 -0
  739. data/spec/unit/network/http/handler_spec.rb +455 -0
  740. data/spec/unit/network/http/mongrel/rest_spec.rb +249 -0
  741. data/spec/unit/network/http/mongrel/{xmlrpc.rb → xmlrpc_spec.rb} +0 -0
  742. data/spec/unit/network/http/mongrel_spec.rb +131 -0
  743. data/spec/unit/network/http/rack/rest_spec.rb +249 -0
  744. data/spec/unit/network/http/rack/xmlrpc_spec.rb +157 -0
  745. data/spec/unit/network/http/rack_spec.rb +102 -0
  746. data/spec/unit/network/http/webrick/rest_spec.rb +180 -0
  747. data/spec/unit/network/http/webrick/{xmlrpc.rb → xmlrpc_spec.rb} +0 -0
  748. data/spec/unit/network/http/webrick_spec.rb +339 -0
  749. data/spec/unit/network/http_pool_spec.rb +206 -0
  750. data/spec/unit/network/http_spec.rb +35 -0
  751. data/spec/unit/network/rest_authconfig_spec.rb +148 -0
  752. data/spec/unit/network/rest_authorization_spec.rb +43 -0
  753. data/spec/unit/network/rights_spec.rb +519 -0
  754. data/spec/unit/network/server_spec.rb +534 -0
  755. data/spec/unit/network/xmlrpc/client_spec.rb +171 -0
  756. data/spec/unit/node/environment_spec.rb +248 -0
  757. data/spec/unit/node/facts_spec.rb +102 -0
  758. data/spec/unit/node_spec.rb +210 -0
  759. data/spec/unit/other/selinux_spec.rb +94 -0
  760. data/spec/unit/other/transbucket_spec.rb +188 -0
  761. data/spec/unit/other/transobject_spec.rb +112 -0
  762. data/spec/unit/parameter/value_collection_spec.rb +167 -0
  763. data/spec/unit/parameter/value_spec.rb +88 -0
  764. data/spec/unit/parameter_spec.rb +172 -0
  765. data/spec/unit/parser/ast/arithmetic_operator_spec.rb +73 -0
  766. data/spec/unit/parser/ast/astarray_spec.rb +72 -0
  767. data/spec/unit/parser/ast/asthash_spec.rb +98 -0
  768. data/spec/unit/parser/ast/boolean_operator_spec.rb +53 -0
  769. data/spec/unit/parser/ast/casestatement_spec.rb +161 -0
  770. data/spec/unit/parser/ast/collection_spec.rb +63 -0
  771. data/spec/unit/parser/ast/collexpr_spec.rb +115 -0
  772. data/spec/unit/parser/ast/comparison_operator_spec.rb +116 -0
  773. data/spec/unit/parser/ast/function_spec.rb +83 -0
  774. data/spec/unit/parser/ast/ifstatement_spec.rb +76 -0
  775. data/spec/unit/parser/ast/in_operator_spec.rb +60 -0
  776. data/spec/unit/parser/ast/leaf_spec.rb +362 -0
  777. data/spec/unit/parser/ast/match_operator_spec.rb +50 -0
  778. data/spec/unit/parser/ast/minus_spec.rb +36 -0
  779. data/spec/unit/parser/ast/nop_spec.rb +20 -0
  780. data/spec/unit/parser/ast/not_spec.rb +30 -0
  781. data/spec/unit/parser/ast/relationship_spec.rb +88 -0
  782. data/spec/unit/parser/ast/resource_defaults_spec.rb +22 -0
  783. data/spec/unit/parser/ast/resource_override_spec.rb +51 -0
  784. data/spec/unit/parser/ast/resource_reference_spec.rb +46 -0
  785. data/spec/unit/parser/ast/resource_spec.rb +120 -0
  786. data/spec/unit/parser/ast/selector_spec.rb +139 -0
  787. data/spec/unit/parser/ast/vardef_spec.rb +60 -0
  788. data/spec/unit/parser/ast_spec.rb +111 -0
  789. data/spec/unit/parser/collector_spec.rb +559 -0
  790. data/spec/unit/parser/compiler_spec.rb +754 -0
  791. data/spec/unit/parser/files_spec.rb +201 -0
  792. data/spec/unit/parser/functions/defined_spec.rb +50 -0
  793. data/spec/unit/parser/functions/fqdn_rand_spec.rb +62 -0
  794. data/spec/unit/parser/functions/generate_spec.rb +41 -0
  795. data/spec/unit/parser/functions/inline_template_spec.rb +59 -0
  796. data/spec/unit/parser/functions/realize_spec.rb +51 -0
  797. data/spec/unit/parser/functions/regsubst_spec.rb +192 -0
  798. data/spec/unit/parser/functions/require_spec.rb +74 -0
  799. data/spec/unit/parser/functions/shellquote_spec.rb +81 -0
  800. data/spec/unit/parser/functions/split_spec.rb +49 -0
  801. data/spec/unit/parser/functions/sprintf_spec.rb +41 -0
  802. data/spec/unit/parser/functions/tag_spec.rb +24 -0
  803. data/spec/unit/parser/functions/template_spec.rb +62 -0
  804. data/spec/unit/parser/functions/versioncmp_spec.rb +29 -0
  805. data/spec/unit/parser/functions_spec.rb +102 -0
  806. data/spec/unit/parser/lexer_spec.rb +646 -0
  807. data/spec/unit/parser/parser_spec.rb +412 -0
  808. data/spec/unit/parser/relationship_spec.rb +70 -0
  809. data/spec/unit/parser/resource_spec.rb +564 -0
  810. data/spec/unit/parser/scope_spec.rb +629 -0
  811. data/spec/unit/parser/templatewrapper_spec.rb +144 -0
  812. data/spec/unit/parser/type_loader_spec.rb +201 -0
  813. data/spec/unit/property/ensure_spec.rb +13 -0
  814. data/spec/unit/property/keyvalue_spec.rb +168 -0
  815. data/spec/unit/property/list_spec.rb +166 -0
  816. data/spec/unit/property/ordered_list_spec.rb +64 -0
  817. data/spec/unit/property_spec.rb +410 -0
  818. data/spec/unit/provider/augeas/augeas_spec.rb +413 -0
  819. data/spec/unit/provider/confine/exists_spec.rb +81 -0
  820. data/spec/unit/provider/confine/false_spec.rb +53 -0
  821. data/spec/unit/provider/confine/feature_spec.rb +60 -0
  822. data/spec/unit/provider/confine/true_spec.rb +53 -0
  823. data/spec/unit/provider/confine/variable_spec.rb +107 -0
  824. data/spec/unit/provider/confine_collection_spec.rb +134 -0
  825. data/spec/unit/provider/confine_spec.rb +78 -0
  826. data/spec/unit/provider/confiner_spec.rb +63 -0
  827. data/spec/unit/provider/group/groupadd_spec.rb +31 -0
  828. data/spec/unit/provider/group/ldap_spec.rb +105 -0
  829. data/spec/unit/provider/ldap_spec.rb +248 -0
  830. data/spec/unit/provider/macauthorization_spec.rb +147 -0
  831. data/spec/unit/provider/mcx/mcxcontent_spec.rb +175 -0
  832. data/spec/unit/provider/mount/parsed_spec.rb +193 -0
  833. data/spec/unit/provider/mount_spec.rb +130 -0
  834. data/spec/unit/provider/naginator_spec.rb +58 -0
  835. data/spec/unit/provider/package/aix_spec.rb +66 -0
  836. data/spec/unit/provider/package/apt_spec.rb +145 -0
  837. data/spec/unit/provider/package/dpkg_spec.rb +225 -0
  838. data/spec/unit/provider/package/gem_spec.rb +87 -0
  839. data/spec/unit/provider/package/hpux_spec.rb +52 -0
  840. data/spec/unit/provider/package/nim_spec.rb +42 -0
  841. data/spec/unit/provider/package/pkg_spec.rb +63 -0
  842. data/spec/unit/provider/package/pkgdmg_spec.rb +84 -0
  843. data/spec/unit/provider/package/zypper_spec.rb +81 -0
  844. data/spec/unit/provider/parsedfile_spec.rb +95 -0
  845. data/spec/unit/provider/selboolean_spec.rb +37 -0
  846. data/spec/unit/provider/selmodule_spec.rb +66 -0
  847. data/spec/unit/provider/service/daemontools_spec.rb +166 -0
  848. data/spec/unit/provider/service/debian_spec.rb +89 -0
  849. data/spec/unit/provider/service/init_spec.rb +168 -0
  850. data/spec/unit/provider/service/launchd_spec.rb +200 -0
  851. data/spec/unit/provider/service/redhat_spec.rb +121 -0
  852. data/spec/unit/provider/service/runit_spec.rb +140 -0
  853. data/spec/unit/provider/service/src_spec.rb +97 -0
  854. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +228 -0
  855. data/spec/unit/provider/sshkey/parsed_spec.rb +38 -0
  856. data/spec/unit/provider/user/hpux_spec.rb +25 -0
  857. data/spec/unit/provider/user/ldap_spec.rb +279 -0
  858. data/spec/unit/provider/user/user_role_add_spec.rb +249 -0
  859. data/spec/unit/provider/user/useradd_spec.rb +115 -0
  860. data/spec/unit/provider/zfs/solaris_spec.rb +99 -0
  861. data/spec/unit/provider/zone/solaris_spec.rb +55 -0
  862. data/spec/unit/provider/zpool/solaris_spec.rb +179 -0
  863. data/spec/unit/provider_spec.rb +31 -0
  864. data/spec/unit/puppet_spec.rb +12 -0
  865. data/spec/unit/rails/host_spec.rb +163 -0
  866. data/spec/unit/rails/param_value_spec.rb +49 -0
  867. data/spec/unit/rails/resource_spec.rb +123 -0
  868. data/spec/unit/rails_spec.rb +258 -0
  869. data/spec/unit/relationship_spec.rb +236 -0
  870. data/spec/unit/reports/http_spec.rb +56 -0
  871. data/spec/unit/reports/tagmail_spec.rb +94 -0
  872. data/spec/unit/reports_spec.rb +61 -0
  873. data/spec/unit/resource/catalog_spec.rb +1078 -0
  874. data/spec/unit/resource/status_spec.rb +103 -0
  875. data/spec/unit/resource/type_collection_helper_spec.rb +25 -0
  876. data/spec/unit/resource/type_collection_spec.rb +432 -0
  877. data/spec/unit/resource/type_spec.rb +722 -0
  878. data/spec/unit/resource_spec.rb +818 -0
  879. data/spec/unit/run_spec.rb +137 -0
  880. data/spec/unit/simple_graph_spec.rb +544 -0
  881. data/spec/unit/ssl/base_spec.rb +43 -0
  882. data/spec/unit/ssl/certificate_authority/interface_spec.rb +333 -0
  883. data/spec/unit/ssl/certificate_authority_spec.rb +772 -0
  884. data/spec/unit/ssl/certificate_factory_spec.rb +107 -0
  885. data/spec/unit/ssl/certificate_request_spec.rb +220 -0
  886. data/spec/unit/ssl/certificate_revocation_list_spec.rb +168 -0
  887. data/spec/unit/ssl/certificate_spec.rb +124 -0
  888. data/spec/unit/ssl/host_spec.rb +707 -0
  889. data/spec/unit/ssl/inventory_spec.rb +180 -0
  890. data/spec/unit/ssl/key_spec.rb +198 -0
  891. data/spec/unit/status_spec.rb +31 -0
  892. data/spec/unit/transaction/change_spec.rb +193 -0
  893. data/spec/unit/transaction/event_manager_spec.rb +260 -0
  894. data/spec/unit/transaction/event_spec.rb +108 -0
  895. data/spec/unit/transaction/report_spec.rb +234 -0
  896. data/spec/unit/transaction/resource_harness_spec.rb +401 -0
  897. data/spec/unit/transaction_spec.rb +452 -0
  898. data/spec/unit/transportable_spec.rb +0 -0
  899. data/spec/unit/type/augeas_spec.rb +122 -0
  900. data/spec/unit/type/component_spec.rb +63 -0
  901. data/spec/unit/type/computer_spec.rb +81 -0
  902. data/spec/unit/type/cron_spec.rb +33 -0
  903. data/spec/unit/type/exec_spec.rb +162 -0
  904. data/spec/unit/type/file/checksum_spec.rb +73 -0
  905. data/spec/unit/type/file/content_spec.rb +460 -0
  906. data/spec/unit/type/file/ensure_spec.rb +84 -0
  907. data/spec/unit/type/file/group_spec.rb +123 -0
  908. data/spec/unit/type/file/owner_spec.rb +150 -0
  909. data/spec/unit/type/file/selinux_spec.rb +83 -0
  910. data/spec/unit/type/file/source_spec.rb +272 -0
  911. data/spec/unit/type/file_spec.rb +1070 -0
  912. data/spec/unit/type/filebucket_spec.rb +74 -0
  913. data/spec/unit/type/group_spec.rb +57 -0
  914. data/spec/unit/type/macauthorization_spec.rb +111 -0
  915. data/spec/unit/type/maillist_spec.rb +42 -0
  916. data/spec/unit/type/mcx_spec.rb +100 -0
  917. data/spec/unit/type/mount_spec.rb +261 -0
  918. data/spec/unit/type/nagios_spec.rb +63 -0
  919. data/spec/unit/type/noop_metaparam_spec.rb +37 -0
  920. data/spec/unit/type/package_spec.rb +240 -0
  921. data/spec/unit/type/resources_spec.rb +102 -0
  922. data/spec/unit/type/schedule_spec.rb +333 -0
  923. data/spec/unit/type/selboolean_spec.rb +45 -0
  924. data/spec/unit/type/selmodule_spec.rb +18 -0
  925. data/spec/unit/type/service_spec.rb +222 -0
  926. data/spec/unit/type/ssh_authorized_key_spec.rb +152 -0
  927. data/spec/unit/type/stage_spec.rb +9 -0
  928. data/spec/unit/type/tidy_spec.rb +424 -0
  929. data/spec/unit/type/user_spec.rb +281 -0
  930. data/spec/unit/type/zfs_spec.rb +45 -0
  931. data/spec/unit/type/zone_spec.rb +60 -0
  932. data/spec/unit/type/zpool_spec.rb +110 -0
  933. data/spec/unit/type_spec.rb +566 -0
  934. data/spec/unit/util/autoload/file_cache_spec.rb +159 -0
  935. data/spec/unit/util/autoload_spec.rb +120 -0
  936. data/spec/unit/util/backups_spec.rb +159 -0
  937. data/spec/unit/util/cache_accumulator_spec.rb +75 -0
  938. data/spec/unit/util/cacher_spec.rb +185 -0
  939. data/spec/unit/util/checksums_spec.rb +153 -0
  940. data/spec/unit/util/command_line_spec.rb +108 -0
  941. data/spec/unit/util/constant_inflector_spec.rb +70 -0
  942. data/spec/unit/util/errors_spec.rb +38 -0
  943. data/spec/unit/util/feature_spec.rb +72 -0
  944. data/spec/unit/util/file_locking_spec.rb +156 -0
  945. data/spec/unit/util/filetype_spec.rb +100 -0
  946. data/spec/unit/util/inline_docs_spec.rb +32 -0
  947. data/spec/unit/util/json_spec.rb +21 -0
  948. data/spec/unit/util/ldap/connection_spec.rb +169 -0
  949. data/spec/unit/util/ldap/generator_spec.rb +54 -0
  950. data/spec/unit/util/ldap/manager_spec.rb +654 -0
  951. data/spec/unit/util/loadedfile_spec.rb +65 -0
  952. data/spec/unit/util/log/destinations_spec.rb +24 -0
  953. data/spec/unit/util/log_spec.rb +215 -0
  954. data/spec/unit/util/logging_spec.rb +95 -0
  955. data/spec/unit/util/metric_spec.rb +95 -0
  956. data/spec/unit/util/monkey_patches_spec.rb +7 -0
  957. data/spec/unit/util/nagios_maker_spec.rb +126 -0
  958. data/spec/unit/util/package_spec.rb +21 -0
  959. data/spec/unit/util/posix_spec.rb +256 -0
  960. data/spec/unit/util/queue/stomp_spec.rb +140 -0
  961. data/spec/unit/util/queue_spec.rb +96 -0
  962. data/spec/unit/util/rdoc/parser_spec.rb +540 -0
  963. data/spec/unit/util/rdoc_spec.rb +165 -0
  964. data/spec/unit/util/reference_serializer_spec.rb +52 -0
  965. data/spec/unit/util/resource_template_spec.rb +58 -0
  966. data/spec/unit/util/run_mode_spec.rb +51 -0
  967. data/spec/unit/util/selinux_spec.rb +278 -0
  968. data/spec/unit/util/settings/file_setting_spec.rb +256 -0
  969. data/spec/unit/util/settings_spec.rb +1099 -0
  970. data/spec/unit/util/storage_spec.rb +235 -0
  971. data/spec/unit/util/tagging_spec.rb +102 -0
  972. data/spec/unit/util/user_attr_spec.rb +47 -0
  973. data/spec/unit/util/warnings_spec.rb +39 -0
  974. data/spec/unit/util/zaml_spec.rb +38 -0
  975. data/tasks/rake/git_workflow.rake +1 -1
  976. data/tasks/rake/sign.rake +2 -2
  977. data/test/certmgr/ca.rb +61 -61
  978. data/test/certmgr/certmgr.rb +292 -283
  979. data/test/certmgr/inventory.rb +44 -42
  980. data/test/certmgr/support.rb +78 -77
  981. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
  982. data/test/data/snippets/hash.pp +33 -0
  983. data/test/language/ast.rb +68 -117
  984. data/test/language/ast/variable.rb +14 -15
  985. data/test/language/functions.rb +404 -463
  986. data/test/language/parser.rb +670 -1135
  987. data/test/language/scope.rb +198 -402
  988. data/test/language/snippets.rb +439 -447
  989. data/test/language/transportable.rb +67 -66
  990. data/test/lib/puppettest.rb +260 -268
  991. data/test/lib/puppettest/certificates.rb +51 -53
  992. data/test/lib/puppettest/exetest.rb +107 -111
  993. data/test/lib/puppettest/fakes.rb +153 -158
  994. data/test/lib/puppettest/fileparsing.rb +17 -17
  995. data/test/lib/puppettest/filetesting.rb +204 -213
  996. data/test/lib/puppettest/parsertesting.rb +382 -365
  997. data/test/lib/puppettest/railstesting.rb +49 -50
  998. data/test/lib/puppettest/reporttesting.rb +10 -10
  999. data/test/lib/puppettest/resourcetesting.rb +45 -36
  1000. data/test/lib/puppettest/runnable_test.rb +36 -28
  1001. data/test/lib/puppettest/servertest.rb +54 -51
  1002. data/test/lib/puppettest/support/assertions.rb +48 -55
  1003. data/test/lib/puppettest/support/helpers.rb +12 -16
  1004. data/test/lib/puppettest/support/resources.rb +23 -25
  1005. data/test/lib/puppettest/support/utils.rb +138 -148
  1006. data/test/lib/puppettest/testcase.rb +15 -17
  1007. data/test/lib/rake/puppet_test_loader.rb +1 -3
  1008. data/test/lib/rake/puppet_testtask.rb +10 -10
  1009. data/test/network/authconfig.rb +48 -50
  1010. data/test/network/authorization.rb +114 -113
  1011. data/test/network/authstore.rb +454 -406
  1012. data/test/network/client/ca.rb +46 -48
  1013. data/test/network/client/dipper.rb +22 -22
  1014. data/test/network/client_request.rb +20 -20
  1015. data/test/network/handler/ca.rb +251 -252
  1016. data/test/network/handler/fileserver.rb +1071 -1001
  1017. data/test/network/handler/master.rb +58 -58
  1018. data/test/network/handler/report.rb +64 -64
  1019. data/test/network/handler/runner.rb +8 -8
  1020. data/test/network/rights.rb +22 -19
  1021. data/test/network/server/mongrel_test.rb +87 -87
  1022. data/test/network/server/webrick.rb +99 -87
  1023. data/test/network/xmlrpc/client.rb +30 -30
  1024. data/test/network/xmlrpc/processor.rb +52 -53
  1025. data/test/network/xmlrpc/server.rb +10 -11
  1026. data/test/network/xmlrpc/webrick_servlet.rb +21 -18
  1027. data/test/other/provider.rb +69 -84
  1028. data/test/other/puppet.rb +61 -76
  1029. data/test/other/relationships.rb +73 -65
  1030. data/test/other/report.rb +88 -187
  1031. data/test/other/transactions.rb +363 -885
  1032. data/test/puppet/defaults.rb +51 -54
  1033. data/test/puppet/errortest.rb +8 -8
  1034. data/test/puppet/tc_suidmanager.rb +106 -103
  1035. data/test/rails/rails.rb +8 -9
  1036. data/test/rails/railsparameter.rb +60 -54
  1037. data/test/ral/manager/attributes.rb +262 -260
  1038. data/test/ral/manager/instances.rb +77 -78
  1039. data/test/ral/manager/manager.rb +36 -36
  1040. data/test/ral/manager/provider.rb +56 -79
  1041. data/test/ral/manager/type.rb +308 -449
  1042. data/test/ral/providers/cron/crontab.rb +561 -545
  1043. data/test/ral/providers/group.rb +203 -212
  1044. data/test/ral/providers/host/parsed.rb +189 -180
  1045. data/test/ral/providers/mailalias/aliases.rb +40 -40
  1046. data/test/ral/providers/nameservice.rb +21 -21
  1047. data/test/ral/providers/package.rb +207 -214
  1048. data/test/ral/providers/package/aptitude.rb +75 -63
  1049. data/test/ral/providers/package/aptrpm.rb +84 -72
  1050. data/test/ral/providers/parsedfile.rb +510 -509
  1051. data/test/ral/providers/port/parsed.rb +5 -5
  1052. data/test/ral/providers/provider.rb +421 -421
  1053. data/test/ral/providers/service/base.rb +59 -53
  1054. data/test/ral/providers/sshkey/parsed.rb +86 -83
  1055. data/test/ral/providers/user.rb +471 -451
  1056. data/test/ral/providers/user/useradd.rb +168 -177
  1057. data/test/ral/type/cron.rb +406 -393
  1058. data/test/ral/type/exec.rb +721 -641
  1059. data/test/ral/type/file.rb +827 -896
  1060. data/test/ral/type/file/target.rb +295 -251
  1061. data/test/ral/type/fileignoresource.rb +232 -205
  1062. data/test/ral/type/filesources.rb +446 -485
  1063. data/test/ral/type/host.rb +124 -153
  1064. data/test/ral/type/mailalias.rb +28 -31
  1065. data/test/ral/type/port.rb +7 -7
  1066. data/test/ral/type/resources.rb +88 -93
  1067. data/test/ral/type/service.rb +19 -19
  1068. data/test/ral/type/sshkey.rb +120 -160
  1069. data/test/ral/type/user.rb +132 -414
  1070. data/test/ral/type/yumrepo.rb +95 -92
  1071. data/test/ral/type/zone.rb +316 -287
  1072. data/test/test +1 -1
  1073. data/test/util/classgen.rb +182 -167
  1074. data/test/util/execution.rb +18 -18
  1075. data/test/util/fileparsing.rb +580 -540
  1076. data/test/util/inifile.rb +117 -106
  1077. data/test/util/instance_loader.rb +29 -29
  1078. data/test/util/log.rb +202 -198
  1079. data/test/util/metrics.rb +51 -51
  1080. data/test/util/package.rb +11 -12
  1081. data/test/util/pidlock.rb +115 -115
  1082. data/test/util/settings.rb +613 -557
  1083. data/test/util/storage.rb +71 -88
  1084. data/test/util/subclass_loader.rb +69 -72
  1085. data/test/util/utiltest.rb +204 -203
  1086. metadata +493 -395
  1087. data/lib/puppet/agent/runner.rb +0 -65
  1088. data/lib/puppet/application/pi.rb +0 -214
  1089. data/lib/puppet/application/puppet.rb +0 -181
  1090. data/lib/puppet/application/puppetca.rb +0 -71
  1091. data/lib/puppet/application/puppetd.rb +0 -250
  1092. data/lib/puppet/application/puppetdoc.rb +0 -224
  1093. data/lib/puppet/application/puppetmasterd.rb +0 -168
  1094. data/lib/puppet/application/puppetqd.rb +0 -96
  1095. data/lib/puppet/application/puppetrun.rb +0 -210
  1096. data/lib/puppet/application/ralsh.rb +0 -152
  1097. data/lib/puppet/checksum.rb +0 -57
  1098. data/lib/puppet/indirector/checksum/file.rb +0 -33
  1099. data/lib/puppet/indirector/runner/rest.rb +0 -7
  1100. data/lib/puppet/network/client/dipper.rb +0 -85
  1101. data/lib/puppet/network/client/resource.rb +0 -38
  1102. data/lib/puppet/network/handler/resource.rb +0 -190
  1103. data/lib/puppet/parser/ast/definition.rb +0 -207
  1104. data/lib/puppet/parser/ast/hostclass.rb +0 -95
  1105. data/lib/puppet/parser/ast/node.rb +0 -42
  1106. data/lib/puppet/parser/interpreter.rb +0 -84
  1107. data/lib/puppet/parser/loaded_code.rb +0 -119
  1108. data/lib/puppet/parser/resource/reference.rb +0 -99
  1109. data/lib/puppet/resource/reference.rb +0 -90
  1110. data/lib/puppet/util/config_store.rb +0 -61
  1111. data/spec/integration/application/puppet.rb +0 -33
  1112. data/spec/integration/bin/puppetmasterd.rb +0 -122
  1113. data/spec/integration/checksum.rb +0 -48
  1114. data/spec/integration/configurer.rb +0 -18
  1115. data/spec/integration/defaults.rb +0 -230
  1116. data/spec/integration/file_serving/content.rb +0 -20
  1117. data/spec/integration/file_serving/fileset.rb +0 -14
  1118. data/spec/integration/file_serving/metadata.rb +0 -21
  1119. data/spec/integration/file_serving/terminus_helper.rb +0 -22
  1120. data/spec/integration/indirector/catalog/compiler.rb +0 -67
  1121. data/spec/integration/indirector/catalog/queue.rb +0 -61
  1122. data/spec/integration/indirector/certificate/rest.rb +0 -70
  1123. data/spec/integration/indirector/certificate_request/rest.rb +0 -88
  1124. data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -76
  1125. data/spec/integration/indirector/direct_file_server.rb +0 -73
  1126. data/spec/integration/indirector/file_content/file_server.rb +0 -94
  1127. data/spec/integration/indirector/file_metadata/file_server.rb +0 -18
  1128. data/spec/integration/indirector/node/ldap.rb +0 -15
  1129. data/spec/integration/indirector/report/rest.rb +0 -94
  1130. data/spec/integration/indirector/rest.rb +0 -523
  1131. data/spec/integration/network/client.rb +0 -19
  1132. data/spec/integration/network/formats.rb +0 -110
  1133. data/spec/integration/network/handler.rb +0 -25
  1134. data/spec/integration/network/server/mongrel.rb +0 -66
  1135. data/spec/integration/network/server/webrick.rb +0 -86
  1136. data/spec/integration/node.rb +0 -93
  1137. data/spec/integration/node/environment.rb +0 -58
  1138. data/spec/integration/node/facts.rb +0 -47
  1139. data/spec/integration/parser/compiler.rb +0 -29
  1140. data/spec/integration/parser/functions/require.rb +0 -86
  1141. data/spec/integration/provider/mailalias/aliases.rb +0 -25
  1142. data/spec/integration/provider/package.rb +0 -26
  1143. data/spec/integration/provider/service/init.rb +0 -32
  1144. data/spec/integration/reference/providers.rb +0 -17
  1145. data/spec/integration/reports.rb +0 -18
  1146. data/spec/integration/resource/catalog.rb +0 -61
  1147. data/spec/integration/ssl/certificate_authority.rb +0 -135
  1148. data/spec/integration/ssl/certificate_request.rb +0 -61
  1149. data/spec/integration/ssl/certificate_revocation_list.rb +0 -42
  1150. data/spec/integration/ssl/host.rb +0 -90
  1151. data/spec/integration/transaction.rb +0 -66
  1152. data/spec/integration/transaction/report.rb +0 -29
  1153. data/spec/integration/type.rb +0 -22
  1154. data/spec/integration/type/file.rb +0 -477
  1155. data/spec/integration/type/package.rb +0 -25
  1156. data/spec/integration/type/tidy.rb +0 -27
  1157. data/spec/integration/util/autoload.rb +0 -114
  1158. data/spec/integration/util/feature.rb +0 -54
  1159. data/spec/integration/util/file_locking.rb +0 -37
  1160. data/spec/integration/util/settings.rb +0 -27
  1161. data/spec/unit/agent.rb +0 -259
  1162. data/spec/unit/agent/locker.rb +0 -100
  1163. data/spec/unit/agent/runner.rb +0 -118
  1164. data/spec/unit/application.rb +0 -420
  1165. data/spec/unit/application/filebucket.rb +0 -220
  1166. data/spec/unit/application/pi.rb +0 -84
  1167. data/spec/unit/application/puppet.rb +0 -399
  1168. data/spec/unit/application/puppetca.rb +0 -142
  1169. data/spec/unit/application/puppetd.rb +0 -502
  1170. data/spec/unit/application/puppetdoc.rb +0 -360
  1171. data/spec/unit/application/puppetmasterd.rb +0 -457
  1172. data/spec/unit/application/puppetqd.rb +0 -186
  1173. data/spec/unit/application/puppetrun.rb +0 -289
  1174. data/spec/unit/application/ralsh.rb +0 -254
  1175. data/spec/unit/configurer.rb +0 -339
  1176. data/spec/unit/configurer/downloader.rb +0 -188
  1177. data/spec/unit/configurer/fact_handler.rb +0 -164
  1178. data/spec/unit/configurer/plugin_handler.rb +0 -112
  1179. data/spec/unit/daemon.rb +0 -287
  1180. data/spec/unit/file_collection.rb +0 -53
  1181. data/spec/unit/file_collection/lookup.rb +0 -46
  1182. data/spec/unit/file_serving/base.rb +0 -132
  1183. data/spec/unit/file_serving/configuration.rb +0 -249
  1184. data/spec/unit/file_serving/configuration/parser.rb +0 -181
  1185. data/spec/unit/file_serving/content.rb +0 -110
  1186. data/spec/unit/file_serving/fileset.rb +0 -347
  1187. data/spec/unit/file_serving/indirection_hooks.rb +0 -63
  1188. data/spec/unit/file_serving/metadata.rb +0 -286
  1189. data/spec/unit/file_serving/mount.rb +0 -32
  1190. data/spec/unit/file_serving/mount/file.rb +0 -196
  1191. data/spec/unit/file_serving/mount/modules.rb +0 -63
  1192. data/spec/unit/file_serving/mount/plugins.rb +0 -61
  1193. data/spec/unit/file_serving/terminus_helper.rb +0 -98
  1194. data/spec/unit/indirector.rb +0 -157
  1195. data/spec/unit/indirector/active_record.rb +0 -76
  1196. data/spec/unit/indirector/catalog/active_record.rb +0 -141
  1197. data/spec/unit/indirector/catalog/compiler.rb +0 -261
  1198. data/spec/unit/indirector/catalog/queue.rb +0 -20
  1199. data/spec/unit/indirector/catalog/rest.rb +0 -11
  1200. data/spec/unit/indirector/catalog/yaml.rb +0 -25
  1201. data/spec/unit/indirector/certificate/ca.rb +0 -28
  1202. data/spec/unit/indirector/certificate/file.rb +0 -28
  1203. data/spec/unit/indirector/certificate/rest.rb +0 -57
  1204. data/spec/unit/indirector/certificate_request/ca.rb +0 -19
  1205. data/spec/unit/indirector/certificate_request/file.rb +0 -19
  1206. data/spec/unit/indirector/certificate_request/rest.rb +0 -23
  1207. data/spec/unit/indirector/certificate_revocation_list/ca.rb +0 -21
  1208. data/spec/unit/indirector/certificate_revocation_list/file.rb +0 -20
  1209. data/spec/unit/indirector/certificate_revocation_list/rest.rb +0 -23
  1210. data/spec/unit/indirector/checksum/file.rb +0 -139
  1211. data/spec/unit/indirector/code.rb +0 -33
  1212. data/spec/unit/indirector/direct_file_server.rb +0 -84
  1213. data/spec/unit/indirector/envelope.rb +0 -47
  1214. data/spec/unit/indirector/exec.rb +0 -56
  1215. data/spec/unit/indirector/facts/active_record.rb +0 -104
  1216. data/spec/unit/indirector/facts/facter.rb +0 -142
  1217. data/spec/unit/indirector/facts/rest.rb +0 -11
  1218. data/spec/unit/indirector/facts/yaml.rb +0 -26
  1219. data/spec/unit/indirector/file.rb +0 -161
  1220. data/spec/unit/indirector/file_content/file.rb +0 -18
  1221. data/spec/unit/indirector/file_content/file_server.rb +0 -18
  1222. data/spec/unit/indirector/file_content/rest.rb +0 -11
  1223. data/spec/unit/indirector/file_metadata/file.rb +0 -52
  1224. data/spec/unit/indirector/file_metadata/file_server.rb +0 -18
  1225. data/spec/unit/indirector/file_metadata/rest.rb +0 -9
  1226. data/spec/unit/indirector/file_server.rb +0 -267
  1227. data/spec/unit/indirector/indirection.rb +0 -795
  1228. data/spec/unit/indirector/key/ca.rb +0 -28
  1229. data/spec/unit/indirector/key/file.rb +0 -104
  1230. data/spec/unit/indirector/ldap.rb +0 -143
  1231. data/spec/unit/indirector/memory.rb +0 -29
  1232. data/spec/unit/indirector/node/active_record.rb +0 -34
  1233. data/spec/unit/indirector/node/exec.rb +0 -69
  1234. data/spec/unit/indirector/node/ldap.rb +0 -458
  1235. data/spec/unit/indirector/node/memory.rb +0 -19
  1236. data/spec/unit/indirector/node/plain.rb +0 -19
  1237. data/spec/unit/indirector/node/rest.rb +0 -13
  1238. data/spec/unit/indirector/node/yaml.rb +0 -25
  1239. data/spec/unit/indirector/plain.rb +0 -29
  1240. data/spec/unit/indirector/queue.rb +0 -123
  1241. data/spec/unit/indirector/report/processor.rb +0 -81
  1242. data/spec/unit/indirector/report/rest.rb +0 -28
  1243. data/spec/unit/indirector/request.rb +0 -308
  1244. data/spec/unit/indirector/rest.rb +0 -403
  1245. data/spec/unit/indirector/runner/rest.rb +0 -11
  1246. data/spec/unit/indirector/ssl_file.rb +0 -280
  1247. data/spec/unit/indirector/terminus.rb +0 -245
  1248. data/spec/unit/indirector/yaml.rb +0 -145
  1249. data/spec/unit/module.rb +0 -247
  1250. data/spec/unit/network/authconfig.rb +0 -292
  1251. data/spec/unit/network/authstore.rb +0 -370
  1252. data/spec/unit/network/client.rb +0 -45
  1253. data/spec/unit/network/client/dipper.rb +0 -16
  1254. data/spec/unit/network/format.rb +0 -191
  1255. data/spec/unit/network/format_handler.rb +0 -327
  1256. data/spec/unit/network/formats.rb +0 -365
  1257. data/spec/unit/network/handler/fileserver.rb +0 -176
  1258. data/spec/unit/network/http.rb +0 -35
  1259. data/spec/unit/network/http/api/v1.rb +0 -122
  1260. data/spec/unit/network/http/handler.rb +0 -458
  1261. data/spec/unit/network/http/mongrel.rb +0 -131
  1262. data/spec/unit/network/http/mongrel/rest.rb +0 -232
  1263. data/spec/unit/network/http/rack.rb +0 -102
  1264. data/spec/unit/network/http/rack/rest.rb +0 -199
  1265. data/spec/unit/network/http/rack/xmlrpc.rb +0 -157
  1266. data/spec/unit/network/http/webrick.rb +0 -339
  1267. data/spec/unit/network/http/webrick/rest.rb +0 -157
  1268. data/spec/unit/network/http_pool.rb +0 -206
  1269. data/spec/unit/network/rest_authconfig.rb +0 -146
  1270. data/spec/unit/network/rest_authorization.rb +0 -43
  1271. data/spec/unit/network/rights.rb +0 -519
  1272. data/spec/unit/network/server.rb +0 -534
  1273. data/spec/unit/network/xmlrpc/client.rb +0 -171
  1274. data/spec/unit/node.rb +0 -200
  1275. data/spec/unit/node/environment.rb +0 -187
  1276. data/spec/unit/node/facts.rb +0 -97
  1277. data/spec/unit/other/checksum.rb +0 -92
  1278. data/spec/unit/other/selinux.rb +0 -85
  1279. data/spec/unit/other/transbucket.rb +0 -188
  1280. data/spec/unit/other/transobject.rb +0 -112
  1281. data/spec/unit/parameter.rb +0 -405
  1282. data/spec/unit/parser/ast.rb +0 -41
  1283. data/spec/unit/parser/ast/arithmetic_operator.rb +0 -73
  1284. data/spec/unit/parser/ast/astarray.rb +0 -72
  1285. data/spec/unit/parser/ast/boolean_operator.rb +0 -53
  1286. data/spec/unit/parser/ast/casestatement.rb +0 -135
  1287. data/spec/unit/parser/ast/collection.rb +0 -63
  1288. data/spec/unit/parser/ast/collexpr.rb +0 -115
  1289. data/spec/unit/parser/ast/comparison_operator.rb +0 -92
  1290. data/spec/unit/parser/ast/definition.rb +0 -213
  1291. data/spec/unit/parser/ast/function.rb +0 -83
  1292. data/spec/unit/parser/ast/hostclass.rb +0 -148
  1293. data/spec/unit/parser/ast/ifstatement.rb +0 -76
  1294. data/spec/unit/parser/ast/leaf.rb +0 -298
  1295. data/spec/unit/parser/ast/match_operator.rb +0 -50
  1296. data/spec/unit/parser/ast/minus.rb +0 -36
  1297. data/spec/unit/parser/ast/node.rb +0 -145
  1298. data/spec/unit/parser/ast/nop.rb +0 -20
  1299. data/spec/unit/parser/ast/not.rb +0 -30
  1300. data/spec/unit/parser/ast/resource.rb +0 -103
  1301. data/spec/unit/parser/ast/resource_override.rb +0 -51
  1302. data/spec/unit/parser/ast/resource_reference.rb +0 -69
  1303. data/spec/unit/parser/ast/selector.rb +0 -155
  1304. data/spec/unit/parser/ast/vardef.rb +0 -47
  1305. data/spec/unit/parser/collector.rb +0 -556
  1306. data/spec/unit/parser/compiler.rb +0 -604
  1307. data/spec/unit/parser/files.rb +0 -190
  1308. data/spec/unit/parser/functions.rb +0 -83
  1309. data/spec/unit/parser/functions/fqdn_rand.rb +0 -62
  1310. data/spec/unit/parser/functions/generate.rb +0 -41
  1311. data/spec/unit/parser/functions/inline_template.rb +0 -59
  1312. data/spec/unit/parser/functions/realize.rb +0 -51
  1313. data/spec/unit/parser/functions/regsubst.rb +0 -168
  1314. data/spec/unit/parser/functions/require.rb +0 -69
  1315. data/spec/unit/parser/functions/shellquote.rb +0 -92
  1316. data/spec/unit/parser/functions/split.rb +0 -51
  1317. data/spec/unit/parser/functions/sprintf.rb +0 -42
  1318. data/spec/unit/parser/functions/template.rb +0 -62
  1319. data/spec/unit/parser/functions/versioncmp.rb +0 -29
  1320. data/spec/unit/parser/interpreter.rb +0 -147
  1321. data/spec/unit/parser/lexer.rb +0 -731
  1322. data/spec/unit/parser/loaded_code.rb +0 -215
  1323. data/spec/unit/parser/parser.rb +0 -423
  1324. data/spec/unit/parser/resource.rb +0 -529
  1325. data/spec/unit/parser/resource/reference.rb +0 -111
  1326. data/spec/unit/parser/scope.rb +0 -387
  1327. data/spec/unit/parser/templatewrapper.rb +0 -134
  1328. data/spec/unit/property.rb +0 -305
  1329. data/spec/unit/property/keyvalue.rb +0 -168
  1330. data/spec/unit/property/list.rb +0 -166
  1331. data/spec/unit/property/ordered_list.rb +0 -64
  1332. data/spec/unit/provider.rb +0 -31
  1333. data/spec/unit/provider/augeas/augeas.rb +0 -413
  1334. data/spec/unit/provider/confine.rb +0 -78
  1335. data/spec/unit/provider/confine/exists.rb +0 -81
  1336. data/spec/unit/provider/confine/false.rb +0 -53
  1337. data/spec/unit/provider/confine/feature.rb +0 -60
  1338. data/spec/unit/provider/confine/true.rb +0 -53
  1339. data/spec/unit/provider/confine/variable.rb +0 -107
  1340. data/spec/unit/provider/confine_collection.rb +0 -134
  1341. data/spec/unit/provider/confiner.rb +0 -63
  1342. data/spec/unit/provider/group/groupadd.rb +0 -31
  1343. data/spec/unit/provider/group/ldap.rb +0 -105
  1344. data/spec/unit/provider/ldap.rb +0 -248
  1345. data/spec/unit/provider/macauthorization.rb +0 -147
  1346. data/spec/unit/provider/mcx/mcxcontent.rb +0 -175
  1347. data/spec/unit/provider/mount.rb +0 -130
  1348. data/spec/unit/provider/mount/parsed.rb +0 -194
  1349. data/spec/unit/provider/naginator.rb +0 -58
  1350. data/spec/unit/provider/package/apt.rb +0 -138
  1351. data/spec/unit/provider/package/dpkg.rb +0 -170
  1352. data/spec/unit/provider/package/gem.rb +0 -87
  1353. data/spec/unit/provider/package/hpux.rb +0 -52
  1354. data/spec/unit/provider/package/pkgdmg.rb +0 -73
  1355. data/spec/unit/provider/parsedfile.rb +0 -95
  1356. data/spec/unit/provider/selboolean.rb +0 -37
  1357. data/spec/unit/provider/selmodule.rb +0 -66
  1358. data/spec/unit/provider/service/daemontools.rb +0 -166
  1359. data/spec/unit/provider/service/debian.rb +0 -89
  1360. data/spec/unit/provider/service/init.rb +0 -121
  1361. data/spec/unit/provider/service/launchd.rb +0 -200
  1362. data/spec/unit/provider/service/redhat.rb +0 -96
  1363. data/spec/unit/provider/service/runit.rb +0 -140
  1364. data/spec/unit/provider/ssh_authorized_key/parsed.rb +0 -206
  1365. data/spec/unit/provider/sshkey/parsed.rb +0 -38
  1366. data/spec/unit/provider/user/hpux.rb +0 -25
  1367. data/spec/unit/provider/user/ldap.rb +0 -279
  1368. data/spec/unit/provider/user/user_role_add.rb +0 -249
  1369. data/spec/unit/provider/user/useradd.rb +0 -115
  1370. data/spec/unit/provider/zfs/solaris.rb +0 -99
  1371. data/spec/unit/provider/zone/solaris.rb +0 -42
  1372. data/spec/unit/provider/zpool/solaris.rb +0 -179
  1373. data/spec/unit/rails.rb +0 -133
  1374. data/spec/unit/rails/host.rb +0 -163
  1375. data/spec/unit/rails/param_value.rb +0 -49
  1376. data/spec/unit/rails/resource.rb +0 -107
  1377. data/spec/unit/relationship.rb +0 -236
  1378. data/spec/unit/reports.rb +0 -61
  1379. data/spec/unit/resource.rb +0 -495
  1380. data/spec/unit/resource/catalog.rb +0 -1053
  1381. data/spec/unit/resource/reference.rb +0 -111
  1382. data/spec/unit/simple_graph.rb +0 -551
  1383. data/spec/unit/ssl/certificate.rb +0 -124
  1384. data/spec/unit/ssl/certificate_authority.rb +0 -741
  1385. data/spec/unit/ssl/certificate_authority/interface.rb +0 -269
  1386. data/spec/unit/ssl/certificate_factory.rb +0 -107
  1387. data/spec/unit/ssl/certificate_request.rb +0 -193
  1388. data/spec/unit/ssl/certificate_revocation_list.rb +0 -168
  1389. data/spec/unit/ssl/host.rb +0 -704
  1390. data/spec/unit/ssl/inventory.rb +0 -180
  1391. data/spec/unit/ssl/key.rb +0 -198
  1392. data/spec/unit/transaction.rb +0 -146
  1393. data/spec/unit/transaction/change.rb +0 -187
  1394. data/spec/unit/transaction/event.rb +0 -25
  1395. data/spec/unit/transaction/report.rb +0 -40
  1396. data/spec/unit/type.rb +0 -426
  1397. data/spec/unit/type/augeas.rb +0 -106
  1398. data/spec/unit/type/component.rb +0 -63
  1399. data/spec/unit/type/computer.rb +0 -78
  1400. data/spec/unit/type/cron.rb +0 -33
  1401. data/spec/unit/type/exec.rb +0 -116
  1402. data/spec/unit/type/file.rb +0 -810
  1403. data/spec/unit/type/file/checksum.rb +0 -28
  1404. data/spec/unit/type/file/content.rb +0 -297
  1405. data/spec/unit/type/file/ensure.rb +0 -84
  1406. data/spec/unit/type/file/group.rb +0 -123
  1407. data/spec/unit/type/file/owner.rb +0 -143
  1408. data/spec/unit/type/file/selinux.rb +0 -84
  1409. data/spec/unit/type/file/source.rb +0 -264
  1410. data/spec/unit/type/filebucket.rb +0 -74
  1411. data/spec/unit/type/group.rb +0 -39
  1412. data/spec/unit/type/macauthorization.rb +0 -111
  1413. data/spec/unit/type/maillist.rb +0 -42
  1414. data/spec/unit/type/mcx.rb +0 -100
  1415. data/spec/unit/type/mount.rb +0 -211
  1416. data/spec/unit/type/nagios.rb +0 -63
  1417. data/spec/unit/type/noop_metaparam.rb +0 -37
  1418. data/spec/unit/type/package.rb +0 -236
  1419. data/spec/unit/type/resources.rb +0 -89
  1420. data/spec/unit/type/schedule.rb +0 -333
  1421. data/spec/unit/type/selboolean.rb +0 -45
  1422. data/spec/unit/type/selmodule.rb +0 -18
  1423. data/spec/unit/type/service.rb +0 -230
  1424. data/spec/unit/type/ssh_authorized_key.rb +0 -140
  1425. data/spec/unit/type/tidy.rb +0 -422
  1426. data/spec/unit/type/user.rb +0 -285
  1427. data/spec/unit/type/zfs.rb +0 -45
  1428. data/spec/unit/type/zone.rb +0 -20
  1429. data/spec/unit/type/zpool.rb +0 -110
  1430. data/spec/unit/util/autoload.rb +0 -133
  1431. data/spec/unit/util/autoload/file_cache.rb +0 -183
  1432. data/spec/unit/util/backups.rb +0 -159
  1433. data/spec/unit/util/cache_accumulator.rb +0 -69
  1434. data/spec/unit/util/cacher.rb +0 -185
  1435. data/spec/unit/util/checksums.rb +0 -113
  1436. data/spec/unit/util/constant_inflector.rb +0 -70
  1437. data/spec/unit/util/feature.rb +0 -72
  1438. data/spec/unit/util/file_locking.rb +0 -115
  1439. data/spec/unit/util/filetype.rb +0 -100
  1440. data/spec/unit/util/json.rb +0 -21
  1441. data/spec/unit/util/ldap/connection.rb +0 -169
  1442. data/spec/unit/util/ldap/generator.rb +0 -54
  1443. data/spec/unit/util/ldap/manager.rb +0 -654
  1444. data/spec/unit/util/loadedfile.rb +0 -65
  1445. data/spec/unit/util/log.rb +0 -202
  1446. data/spec/unit/util/metric.rb +0 -95
  1447. data/spec/unit/util/monkey_patches.rb +0 -103
  1448. data/spec/unit/util/nagios_maker.rb +0 -126
  1449. data/spec/unit/util/package.rb +0 -21
  1450. data/spec/unit/util/posix.rb +0 -256
  1451. data/spec/unit/util/queue.rb +0 -96
  1452. data/spec/unit/util/queue/stomp.rb +0 -140
  1453. data/spec/unit/util/reference_serializer.rb +0 -52
  1454. data/spec/unit/util/resource_template.rb +0 -58
  1455. data/spec/unit/util/selinux.rb +0 -280
  1456. data/spec/unit/util/settings.rb +0 -1058
  1457. data/spec/unit/util/settings/file_setting.rb +0 -248
  1458. data/spec/unit/util/storage.rb +0 -248
  1459. data/spec/unit/util/tagging.rb +0 -102
  1460. data/spec/unit/util/user_attr.rb +0 -47
  1461. data/spec/unit/util/warnings.rb +0 -39
  1462. data/spec/unit/util/zaml.rb +0 -38
  1463. data/test/language/ast/casestatement.rb +0 -103
  1464. data/test/language/ast/resource.rb +0 -58
  1465. data/test/language/ast/resource_reference.rb +0 -77
  1466. data/test/language/ast/selector.rb +0 -61
  1467. data/test/language/resource.rb +0 -172
  1468. data/test/lib/puppettest/support/collection.rb +0 -29
  1469. data/test/network/client/resource.rb +0 -52
  1470. data/test/network/handler/bucket.rb +0 -313
  1471. data/test/network/handler/resource.rb +0 -250
  1472. data/test/other/dsl.rb +0 -215
  1473. data/test/other/events.rb +0 -124
  1474. data/test/ral/type/group.rb +0 -170
@@ -3,180 +3,49 @@ require 'digest/md5'
3
3
  require 'puppet/external/base64'
4
4
 
5
5
  class Puppet::Network::Handler # :nodoc:
6
- class BucketError < RuntimeError; end
7
- # Accept files and store them by md5 sum, returning the md5 sum back
8
- # to the client. Alternatively, accept an md5 sum and return the
9
- # associated content.
10
- class FileBucket < Handler
11
- desc "The interface to Puppet's FileBucket system. Can be used to store
12
- files in and retrieve files from a filebucket."
13
-
14
- @interface = XMLRPC::Service::Interface.new("puppetbucket") { |iface|
15
- iface.add_method("string addfile(string, string)")
16
- iface.add_method("string getfile(string)")
17
- }
18
-
19
- Puppet::Util.logmethods(self, true)
20
- attr_reader :name, :path
21
-
22
- # this doesn't work for relative paths
23
- def self.oldpaths(base,md5)
24
- return [
25
- File.join(base, md5),
26
- File.join(base, md5, "contents"),
27
- File.join(base, md5, "paths")
28
- ]
29
- end
30
-
31
- # this doesn't work for relative paths
32
- def self.paths(base,md5)
33
- dir = File.join(md5[0..7].split(""))
34
- basedir = File.join(base, dir, md5)
35
- return [
36
- basedir,
37
- File.join(basedir, "contents"),
38
- File.join(basedir, "paths")
39
- ]
40
- end
41
-
42
- # Should we check each file as it comes in to make sure the md5
43
- # sums match? Defaults to false.
44
- def conflict_check?
45
- @confictchk
46
- end
47
-
48
- def initialize(hash)
49
- if hash.include?(:ConflictCheck)
50
- @conflictchk = hash[:ConflictCheck]
51
- hash.delete(:ConflictCheck)
52
- else
53
- @conflictchk = false
54
- end
55
-
56
- if hash.include?(:Path)
57
- @path = hash[:Path]
58
- hash.delete(:Path)
59
- else
60
- if defined? Puppet
61
- @path = Puppet[:bucketdir]
62
- else
63
- @path = File.expand_path("~/.filebucket")
64
- end
65
- end
66
-
67
- Puppet.settings.use(:filebucket)
68
-
69
- @name = "Filebucket[#{@path}]"
70
- end
71
-
72
- # Accept a file from a client and store it by md5 sum, returning
73
- # the sum.
74
- def addfile(contents, path, client = nil, clientip = nil)
75
- if client
76
- contents = Base64.decode64(contents)
77
- end
78
- md5 = Digest::MD5.hexdigest(contents)
79
-
80
- bpath, bfile, pathpath = FileBucket.paths(@path,md5)
81
-
82
- # If the file already exists, just return the md5 sum.
83
- if FileTest.exists?(bfile)
84
- # If verification is enabled, then make sure the text matches.
85
- if conflict_check?
86
- verify(contents, md5, bfile)
87
- end
88
- return md5
89
- end
90
-
91
- # Make the directories if necessary.
92
- unless FileTest.directory?(bpath)
93
- Puppet::Util.withumask(0007) do
94
- FileUtils.mkdir_p(bpath)
95
- end
96
- end
97
-
98
- # Write the file to disk.
99
- msg = "Adding %s(%s)" % [path, md5]
100
- msg += " from #{client}" if client
101
- self.info msg
102
-
103
- # ...then just create the file
104
- Puppet::Util.withumask(0007) do
105
- File.open(bfile, File::WRONLY|File::CREAT, 0440) { |of|
106
- of.print contents
107
- }
108
- end
109
-
110
- # Write the path to the paths file.
111
- add_path(path, pathpath)
112
-
113
- return md5
114
- end
115
-
116
- # Return the contents associated with a given md5 sum.
117
- def getfile(md5, client = nil, clientip = nil)
118
- bpath, bfile, bpaths = FileBucket.paths(@path,md5)
119
-
120
- unless FileTest.exists?(bfile)
121
- # Try the old flat style.
122
- bpath, bfile, bpaths = FileBucket.oldpaths(@path,md5)
123
- unless FileTest.exists?(bfile)
124
- return false
125
- end
126
- end
127
-
128
- contents = nil
129
- File.open(bfile) { |of|
130
- contents = of.read
131
- }
132
-
133
- if client
134
- return Base64.encode64(contents)
135
- else
136
- return contents
137
- end
138
- end
139
-
140
- def paths(md5)
141
- self.class(@path, md5)
142
- end
143
-
144
- def to_s
145
- self.name
146
- end
147
-
148
- private
6
+ # Accept files and store them by md5 sum, returning the md5 sum back
7
+ # to the client. Alternatively, accept an md5 sum and return the
8
+ # associated content.
9
+ class FileBucket < Handler
10
+ desc "The interface to Puppet's FileBucket system. Can be used to store
11
+ files in and retrieve files from a filebucket."
12
+
13
+ @interface = XMLRPC::Service::Interface.new("puppetbucket") { |iface|
14
+ iface.add_method("string addfile(string, string)")
15
+ iface.add_method("string getfile(string)")
16
+ }
17
+
18
+ Puppet::Util.logmethods(self, true)
19
+ attr_reader :name, :path
20
+
21
+ def initialize(hash)
22
+ @path = hash[:Path] || Puppet[:bucketdir]
23
+ @name = "Filebucket[#{@path}]"
24
+ end
149
25
 
150
- # Add our path to the paths file if necessary.
151
- def add_path(path, file)
152
- if FileTest.exists?(file)
153
- File.open(file) { |of|
154
- return if of.readlines.collect { |l| l.chomp }.include?(path)
155
- }
156
- end
26
+ # Accept a file from a client and store it by md5 sum, returning
27
+ # the sum.
28
+ def addfile(contents, path, client = nil, clientip = nil)
29
+ contents = Base64.decode64(contents) if client
30
+ bucket = Puppet::FileBucket::File.new(contents)
31
+ bucket.save
32
+ end
157
33
 
158
- # if it's a new file, or if our path isn't in the file yet, add it
159
- File.open(file, File::WRONLY|File::CREAT|File::APPEND) { |of|
160
- of.puts path
161
- }
162
- end
34
+ # Return the contents associated with a given md5 sum.
35
+ def getfile(md5, client = nil, clientip = nil)
36
+ bucket = Puppet::FileBucket::File.find("md5:#{md5}")
37
+ contents = bucket.contents
163
38
 
164
- # If conflict_check is enabled, verify that the passed text is
165
- # the same as the text in our file.
166
- def verify(content, md5, bfile)
167
- curfile = File.read(bfile)
39
+ if client
40
+ return Base64.encode64(contents)
41
+ else
42
+ return contents
43
+ end
44
+ end
168
45
 
169
- # If the contents don't match, then we've found a conflict.
170
- # Unlikely, but quite bad.
171
- if curfile != contents
172
- raise(BucketError,
173
- "Got passed new contents for sum %s" % md5, caller)
174
- else
175
- msg = "Got duplicate %s(%s)" % [path, md5]
176
- msg += " from #{client}" if client
177
- self.info msg
178
- end
179
- end
46
+ def to_s
47
+ self.name
180
48
  end
49
+ end
181
50
  end
182
51
 
@@ -9,749 +9,717 @@ require 'puppet/file_serving'
9
9
  require 'puppet/file_serving/metadata'
10
10
 
11
11
  class Puppet::Network::Handler
12
- AuthStoreError = Puppet::AuthStoreError
13
- class FileServerError < Puppet::Error; end
14
- class FileServer < Handler
15
- desc "The interface to Puppet's fileserving abilities."
12
+ AuthStoreError = Puppet::AuthStoreError
13
+ class FileServerError < Puppet::Error; end
14
+ class FileServer < Handler
15
+ desc "The interface to Puppet's fileserving abilities."
16
16
 
17
- attr_accessor :local
17
+ attr_accessor :local
18
18
 
19
- CHECKPARAMS = [:mode, :type, :owner, :group, :checksum]
19
+ CHECKPARAMS = [:mode, :type, :owner, :group, :checksum]
20
20
 
21
- # Special filserver module for puppet's module system
22
- MODULES = "modules"
23
- PLUGINS = "plugins"
21
+ # Special filserver module for puppet's module system
22
+ MODULES = "modules"
23
+ PLUGINS = "plugins"
24
24
 
25
- @interface = XMLRPC::Service::Interface.new("fileserver") { |iface|
26
- iface.add_method("string describe(string, string)")
27
- iface.add_method("string list(string, string, boolean, array)")
28
- iface.add_method("string retrieve(string, string)")
29
- }
25
+ @interface = XMLRPC::Service::Interface.new("fileserver") { |iface|
26
+ iface.add_method("string describe(string, string)")
27
+ iface.add_method("string list(string, string, boolean, array)")
28
+ iface.add_method("string retrieve(string, string)")
29
+ }
30
30
 
31
- def self.params
32
- CHECKPARAMS.dup
33
- end
31
+ def self.params
32
+ CHECKPARAMS.dup
33
+ end
34
34
 
35
- # If the configuration file exists, then create (if necessary) a LoadedFile
36
- # object to manage it; else, return nil.
37
- def configuration
38
- # Short-circuit the default case.
39
- return @configuration if defined?(@configuration)
35
+ # If the configuration file exists, then create (if necessary) a LoadedFile
36
+ # object to manage it; else, return nil.
37
+ def configuration
38
+ # Short-circuit the default case.
39
+ return @configuration if defined?(@configuration)
40
40
 
41
- config_path = @passed_configuration_path || Puppet[:fileserverconfig]
42
- return nil unless FileTest.exist?(config_path)
41
+ config_path = @passed_configuration_path || Puppet[:fileserverconfig]
42
+ return nil unless FileTest.exist?(config_path)
43
43
 
44
- # The file exists but we don't have a LoadedFile instance for it.
45
- @configuration = Puppet::Util::LoadedFile.new(config_path)
46
- end
44
+ # The file exists but we don't have a LoadedFile instance for it.
45
+ @configuration = Puppet::Util::LoadedFile.new(config_path)
46
+ end
47
47
 
48
- # Create our default mounts for modules and plugins. This is duplicated code,
49
- # but I'm not really worried about that.
50
- def create_default_mounts
51
- @mounts = {}
52
- Puppet.debug "No file server configuration file; autocreating #{MODULES} mount with default permissions"
53
- mount = Mount.new(MODULES)
54
- mount.allow("*")
55
- @mounts[MODULES] = mount
56
-
57
- Puppet.debug "No file server configuration file; autocreating #{PLUGINS} mount with default permissions"
58
- mount = PluginMount.new(PLUGINS)
59
- mount.allow("*")
60
- @mounts[PLUGINS] = mount
61
- end
48
+ # Create our default mounts for modules and plugins. This is duplicated code,
49
+ # but I'm not really worried about that.
50
+ def create_default_mounts
51
+ @mounts = {}
52
+ Puppet.debug "No file server configuration file; autocreating #{MODULES} mount with default permissions"
53
+ mount = Mount.new(MODULES)
54
+ mount.allow("*")
55
+ @mounts[MODULES] = mount
56
+
57
+ Puppet.debug "No file server configuration file; autocreating #{PLUGINS} mount with default permissions"
58
+ mount = PluginMount.new(PLUGINS)
59
+ mount.allow("*")
60
+ @mounts[PLUGINS] = mount
61
+ end
62
62
 
63
- # Describe a given file. This returns all of the manageable aspects
64
- # of that file.
65
- def describe(url, links = :follow, client = nil, clientip = nil)
66
- links = links.intern if links.is_a? String
63
+ # Describe a given file. This returns all of the manageable aspects
64
+ # of that file.
65
+ def describe(url, links = :follow, client = nil, clientip = nil)
66
+ links = links.intern if links.is_a? String
67
67
 
68
- mount, path = convert(url, client, clientip)
68
+ mount, path = convert(url, client, clientip)
69
69
 
70
- mount.debug("Describing %s for %s" % [url, client]) if client
70
+ mount.debug("Describing #{url} for #{client}") if client
71
71
 
72
- # use the mount to resolve the path for us.
73
- return "" unless full_path = mount.file_path(path, client)
72
+ # use the mount to resolve the path for us.
73
+ return "" unless full_path = mount.file_path(path, client)
74
74
 
75
- metadata = Puppet::FileServing::Metadata.new(url, :path => full_path, :links => links)
75
+ metadata = Puppet::FileServing::Metadata.new(url, :path => full_path, :links => links)
76
76
 
77
- return "" unless metadata.exist?
77
+ return "" unless metadata.exist?
78
78
 
79
- begin
80
- metadata.collect
81
- rescue => detail
82
- puts detail.backtrace if Puppet[:trace]
83
- Puppet.err detail
84
- return ""
85
- end
79
+ begin
80
+ metadata.collect
81
+ rescue => detail
82
+ puts detail.backtrace if Puppet[:trace]
83
+ Puppet.err detail
84
+ return ""
85
+ end
86
86
 
87
- return metadata.attributes_with_tabs
88
- end
87
+ metadata.attributes_with_tabs
88
+ end
89
89
 
90
- # Create a new fileserving module.
91
- def initialize(hash = {})
92
- @mounts = {}
93
- @files = {}
90
+ # Create a new fileserving module.
91
+ def initialize(hash = {})
92
+ @mounts = {}
93
+ @files = {}
94
94
 
95
- if hash[:Local]
96
- @local = hash[:Local]
97
- else
98
- @local = false
99
- end
95
+ @local = hash[:Local]
100
96
 
101
- if hash[:Config] == false
102
- @noreadconfig = true
103
- end
97
+ @noreadconfig = true if hash[:Config] == false
104
98
 
105
- @passed_configuration_path = hash[:Config]
99
+ @passed_configuration_path = hash[:Config]
106
100
 
107
- if hash.include?(:Mount)
108
- @passedconfig = true
109
- unless hash[:Mount].is_a?(Hash)
110
- raise Puppet::DevError, "Invalid mount hash %s" %
111
- hash[:Mount].inspect
112
- end
101
+ if hash.include?(:Mount)
102
+ @passedconfig = true
103
+ raise Puppet::DevError, "Invalid mount hash #{hash[:Mount].inspect}" unless hash[:Mount].is_a?(Hash)
113
104
 
114
- hash[:Mount].each { |dir, name|
115
- if FileTest.exists?(dir)
116
- self.mount(dir, name)
117
- end
118
- }
119
- self.mount(nil, MODULES)
120
- self.mount(nil, PLUGINS)
121
- else
122
- @passedconfig = false
123
- if configuration
124
- readconfig(false) # don't check the file the first time.
125
- else
126
- create_default_mounts()
127
- end
128
- end
105
+ hash[:Mount].each { |dir, name|
106
+ self.mount(dir, name) if FileTest.exists?(dir)
107
+ }
108
+ self.mount(nil, MODULES)
109
+ self.mount(nil, PLUGINS)
110
+ else
111
+ @passedconfig = false
112
+ if configuration
113
+ readconfig(false) # don't check the file the first time.
114
+ else
115
+ create_default_mounts
129
116
  end
117
+ end
118
+ end
130
119
 
131
- # List a specific directory's contents.
132
- def list(url, links = :ignore, recurse = false, ignore = false, client = nil, clientip = nil)
133
- mount, path = convert(url, client, clientip)
120
+ # List a specific directory's contents.
121
+ def list(url, links = :ignore, recurse = false, ignore = false, client = nil, clientip = nil)
122
+ mount, path = convert(url, client, clientip)
134
123
 
135
- mount.debug "Listing %s for %s" % [url, client] if client
124
+ mount.debug "Listing #{url} for #{client}" if client
136
125
 
137
- return "" unless mount.path_exists?(path, client)
126
+ return "" unless mount.path_exists?(path, client)
138
127
 
139
- desc = mount.list(path, recurse, ignore, client)
128
+ desc = mount.list(path, recurse, ignore, client)
140
129
 
141
- if desc.length == 0
142
- mount.notice "Got no information on //%s/%s" % [mount, path]
143
- return ""
144
- end
130
+ if desc.length == 0
131
+ mount.notice "Got no information on //#{mount}/#{path}"
132
+ return ""
133
+ end
145
134
 
146
- desc.collect { |sub| sub.join("\t") }.join("\n")
147
- end
135
+ desc.collect { |sub| sub.join("\t") }.join("\n")
136
+ end
148
137
 
149
- def local?
150
- self.local
151
- end
138
+ def local?
139
+ self.local
140
+ end
152
141
 
153
- # Is a given mount available?
154
- def mounted?(name)
155
- @mounts.include?(name)
156
- end
142
+ # Is a given mount available?
143
+ def mounted?(name)
144
+ @mounts.include?(name)
145
+ end
157
146
 
158
- # Mount a new directory with a name.
159
- def mount(path, name)
160
- if @mounts.include?(name)
161
- if @mounts[name] != path
162
- raise FileServerError, "%s is already mounted at %s" %
163
- [@mounts[name].path, name]
164
- else
165
- # it's already mounted; no problem
166
- return
167
- end
168
- end
147
+ # Mount a new directory with a name.
148
+ def mount(path, name)
149
+ if @mounts.include?(name)
150
+ if @mounts[name] != path
151
+ raise FileServerError, "#{@mounts[name].path} is already mounted at #{name}"
152
+ else
153
+ # it's already mounted; no problem
154
+ return
155
+ end
156
+ end
169
157
 
170
- # Let the mounts do their own error-checking.
171
- @mounts[name] = Mount.new(name, path)
172
- @mounts[name].info "Mounted %s" % path
158
+ # Let the mounts do their own error-checking.
159
+ @mounts[name] = Mount.new(name, path)
160
+ @mounts[name].info "Mounted #{path}"
173
161
 
174
- return @mounts[name]
175
- end
162
+ @mounts[name]
163
+ end
176
164
 
177
- # Retrieve a file from the local disk and pass it to the remote
178
- # client.
179
- def retrieve(url, links = :ignore, client = nil, clientip = nil)
180
- links = links.intern if links.is_a? String
165
+ # Retrieve a file from the local disk and pass it to the remote
166
+ # client.
167
+ def retrieve(url, links = :ignore, client = nil, clientip = nil)
168
+ links = links.intern if links.is_a? String
181
169
 
182
- mount, path = convert(url, client, clientip)
170
+ mount, path = convert(url, client, clientip)
183
171
 
184
- if client
185
- mount.info "Sending %s to %s" % [url, client]
186
- end
172
+ mount.info "Sending #{url} to #{client}" if client
187
173
 
188
- unless mount.path_exists?(path, client)
189
- mount.debug "#{mount} reported that #{path} does not exist"
190
- return ""
191
- end
174
+ unless mount.path_exists?(path, client)
175
+ mount.debug "#{mount} reported that #{path} does not exist"
176
+ return ""
177
+ end
192
178
 
193
- links = links.intern if links.is_a? String
179
+ links = links.intern if links.is_a? String
194
180
 
195
- if links == :ignore and FileTest.symlink?(path)
196
- mount.debug "I think that #{path} is a symlink and we're ignoring them"
197
- return ""
198
- end
181
+ if links == :ignore and FileTest.symlink?(path)
182
+ mount.debug "I think that #{path} is a symlink and we're ignoring them"
183
+ return ""
184
+ end
199
185
 
200
- str = mount.read_file(path, client)
186
+ str = mount.read_file(path, client)
201
187
 
202
- if @local
203
- return str
204
- else
205
- return CGI.escape(str)
206
- end
207
- end
188
+ if @local
189
+ return str
190
+ else
191
+ return CGI.escape(str)
192
+ end
193
+ end
208
194
 
209
- def umount(name)
210
- @mounts.delete(name) if @mounts.include? name
211
- end
195
+ def umount(name)
196
+ @mounts.delete(name) if @mounts.include? name
197
+ end
212
198
 
213
- private
199
+ private
200
+
201
+ def authcheck(file, mount, client, clientip)
202
+ # If we're local, don't bother passing in information.
203
+ if local?
204
+ client = nil
205
+ clientip = nil
206
+ end
207
+ unless mount.allowed?(client, clientip)
208
+ mount.warning "#{client} cannot access #{file}"
209
+ raise Puppet::AuthorizationError, "Cannot access #{mount}"
210
+ end
211
+ end
214
212
 
215
- def authcheck(file, mount, client, clientip)
216
- # If we're local, don't bother passing in information.
217
- if local?
218
- client = nil
219
- clientip = nil
220
- end
221
- unless mount.allowed?(client, clientip)
222
- mount.warning "%s cannot access %s" %
223
- [client, file]
224
- raise Puppet::AuthorizationError, "Cannot access %s" % mount
225
- end
226
- end
213
+ # Take a URL and some client info and return a mount and relative
214
+ # path pair.
215
+ #
216
+ def convert(url, client, clientip)
217
+ readconfig
227
218
 
228
- # Take a URL and some client info and return a mount and relative
229
- # path pair.
230
- #
231
- def convert(url, client, clientip)
232
- readconfig
219
+ url = URI.unescape(url)
233
220
 
234
- url = URI.unescape(url)
221
+ mount, stub = splitpath(url, client)
235
222
 
236
- mount, stub = splitpath(url, client)
223
+ authcheck(url, mount, client, clientip)
237
224
 
238
- authcheck(url, mount, client, clientip)
225
+ return mount, stub
226
+ end
239
227
 
240
- return mount, stub
241
- end
228
+ # Return the mount for the Puppet modules; allows file copying from
229
+ # the modules.
230
+ def modules_mount(module_name, client)
231
+ # Find our environment, if we have one.
232
+ unless hostname = (client || Facter.value("hostname"))
233
+ raise ArgumentError, "Could not find hostname"
234
+ end
235
+ env = (node = Puppet::Node.find(hostname)) ? node.environment : nil
236
+
237
+ # And use the environment to look up the module.
238
+ (mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?) ? @mounts[MODULES].copy(mod.name, mod.file_directory) : nil
239
+ end
242
240
 
243
- # Return the mount for the Puppet modules; allows file copying from
244
- # the modules.
245
- def modules_mount(module_name, client)
246
- # Find our environment, if we have one.
247
- unless hostname = (client || Facter.value("hostname"))
248
- raise ArgumentError, "Could not find hostname"
249
- end
250
- if node = Puppet::Node.find(hostname)
251
- env = node.environment
241
+ # Read the configuration file.
242
+ def readconfig(check = true)
243
+ return if @noreadconfig
244
+
245
+ return unless configuration
246
+
247
+ return if check and ! @configuration.changed?
248
+
249
+ newmounts = {}
250
+ begin
251
+ File.open(@configuration.file) { |f|
252
+ mount = nil
253
+ count = 1
254
+ f.each { |line|
255
+ case line
256
+ when /^\s*#/; next # skip comments
257
+ when /^\s*$/; next # skip blank lines
258
+ when /\[([-\w]+)\]/
259
+ name = $1
260
+ raise FileServerError, "#{newmounts[name]} is already mounted as #{name} in #{@configuration.file}" if newmounts.include?(name)
261
+ mount = Mount.new(name)
262
+ newmounts[name] = mount
263
+ when /^\s*(\w+)\s+(.+)$/
264
+ var = $1
265
+ value = $2
266
+ case var
267
+ when "path"
268
+ if mount.name == MODULES
269
+ Puppet.warning "The '#{mount.name}' module can not have a path. Ignoring attempt to set it"
270
+ else
271
+ begin
272
+ mount.path = value
273
+ rescue FileServerError => detail
274
+ Puppet.err "Removing mount #{mount.name}: #{detail}"
275
+ newmounts.delete(mount.name)
276
+ end
277
+ end
278
+ when "allow"
279
+ value.split(/\s*,\s*/).each { |val|
280
+ begin
281
+ mount.info "allowing #{val} access"
282
+ mount.allow(val)
283
+ rescue AuthStoreError => detail
284
+ puts detail.backtrace if Puppet[:trace]
285
+
286
+ raise FileServerError.new(
287
+ detail.to_s,
288
+
289
+ count, @configuration.file)
290
+ end
291
+ }
292
+ when "deny"
293
+ value.split(/\s*,\s*/).each { |val|
294
+ begin
295
+ mount.info "denying #{val} access"
296
+ mount.deny(val)
297
+ rescue AuthStoreError => detail
298
+
299
+ raise FileServerError.new(
300
+ detail.to_s,
301
+
302
+ count, @configuration.file)
303
+ end
304
+ }
305
+ else
306
+ raise FileServerError.new("Invalid argument '#{var}'", count, @configuration.file)
307
+ end
252
308
  else
253
- env = nil
309
+ raise FileServerError.new("Invalid line '#{line.chomp}'", count, @configuration.file)
254
310
  end
311
+ count += 1
312
+ }
313
+ }
314
+ rescue Errno::EACCES => detail
315
+ Puppet.err "FileServer error: Cannot read #{@configuration}; cannot serve"
316
+ #raise Puppet::Error, "Cannot read #{@configuration}"
317
+ rescue Errno::ENOENT => detail
318
+ Puppet.err "FileServer error: '#{@configuration}' does not exist; cannot serve"
319
+ end
320
+
321
+ unless newmounts[MODULES]
322
+ Puppet.debug "No #{MODULES} mount given; autocreating with default permissions"
323
+ mount = Mount.new(MODULES)
324
+ mount.allow("*")
325
+ newmounts[MODULES] = mount
326
+ end
327
+
328
+ unless newmounts[PLUGINS]
329
+ Puppet.debug "No #{PLUGINS} mount given; autocreating with default permissions"
330
+ mount = PluginMount.new(PLUGINS)
331
+ mount.allow("*")
332
+ newmounts[PLUGINS] = mount
333
+ end
334
+
335
+ unless newmounts[PLUGINS].valid?
336
+ Puppet.debug "No path given for #{PLUGINS} mount; creating a special PluginMount"
337
+ # We end up here if the user has specified access rules for
338
+ # the plugins mount, without specifying a path (which means
339
+ # they want to have the default behaviour for the mount, but
340
+ # special access control). So we need to move all the
341
+ # user-specified access controls into the new PluginMount
342
+ # object...
343
+ mount = PluginMount.new(PLUGINS)
344
+ # Yes, you're allowed to hate me for this.
345
+
346
+ mount.instance_variable_set(
347
+ :@declarations,
348
+
349
+ newmounts[PLUGINS].instance_variable_get(:@declarations)
350
+ )
351
+ newmounts[PLUGINS] = mount
352
+ end
353
+
354
+ # Verify each of the mounts are valid.
355
+ # We let the check raise an error, so that it can raise an error
356
+ # pointing to the specific problem.
357
+ newmounts.each { |name, mount|
358
+ raise FileServerError, "Invalid mount #{name}" unless mount.valid?
359
+ }
360
+ @mounts = newmounts
361
+ end
255
362
 
256
- # And use the environment to look up the module.
257
- if mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?
258
- return @mounts[MODULES].copy(mod.name, mod.file_directory)
259
- else
260
- return nil
261
- end
363
+ # Split the path into the separate mount point and path.
364
+ def splitpath(dir, client)
365
+ # the dir is based on one of the mounts
366
+ # so first retrieve the mount path
367
+ mount = nil
368
+ path = nil
369
+ if dir =~ %r{/([-\w]+)}
370
+ # Strip off the mount name.
371
+ mount_name, path = dir.sub(%r{^/}, '').split(File::Separator, 2)
372
+
373
+ unless mount = modules_mount(mount_name, client)
374
+ unless mount = @mounts[mount_name]
375
+ raise FileServerError, "Fileserver module '#{mount_name}' not mounted"
376
+ end
262
377
  end
378
+ else
379
+ raise FileServerError, "Fileserver error: Invalid path '#{dir}'"
380
+ end
381
+
382
+ if path.nil? or path == ''
383
+ path = '/'
384
+ elsif path
385
+ # Remove any double slashes that might have occurred
386
+ path = URI.unescape(path.gsub(/\/\//, "/"))
387
+ end
388
+
389
+ return mount, path
390
+ end
263
391
 
264
- # Read the configuration file.
265
- def readconfig(check = true)
266
- return if @noreadconfig
267
-
268
- return unless configuration
269
-
270
- if check and ! @configuration.changed?
271
- return
272
- end
392
+ def to_s
393
+ "fileserver"
394
+ end
273
395
 
274
- newmounts = {}
275
- begin
276
- File.open(@configuration.file) { |f|
277
- mount = nil
278
- count = 1
279
- f.each { |line|
280
- case line
281
- when /^\s*#/; next # skip comments
282
- when /^\s*$/; next # skip blank lines
283
- when /\[([-\w]+)\]/
284
- name = $1
285
- if newmounts.include?(name)
286
- raise FileServerError, "%s is already mounted as %s in %s" %
287
- [newmounts[name], name, @configuration.file]
288
- end
289
- mount = Mount.new(name)
290
- newmounts[name] = mount
291
- when /^\s*(\w+)\s+(.+)$/
292
- var = $1
293
- value = $2
294
- case var
295
- when "path"
296
- if mount.name == MODULES
297
- Puppet.warning "The '#{mount.name}' module can not have a path. Ignoring attempt to set it"
298
- else
299
- begin
300
- mount.path = value
301
- rescue FileServerError => detail
302
- Puppet.err "Removing mount %s: %s" %
303
- [mount.name, detail]
304
- newmounts.delete(mount.name)
305
- end
306
- end
307
- when "allow"
308
- value.split(/\s*,\s*/).each { |val|
309
- begin
310
- mount.info "allowing %s access" % val
311
- mount.allow(val)
312
- rescue AuthStoreError => detail
313
- puts detail.backtrace if Puppet[:trace]
314
- raise FileServerError.new(detail.to_s,
315
- count, @configuration.file)
316
- end
317
- }
318
- when "deny"
319
- value.split(/\s*,\s*/).each { |val|
320
- begin
321
- mount.info "denying %s access" % val
322
- mount.deny(val)
323
- rescue AuthStoreError => detail
324
- raise FileServerError.new(detail.to_s,
325
- count, @configuration.file)
326
- end
327
- }
328
- else
329
- raise FileServerError.new("Invalid argument '%s'" % var,
330
- count, @configuration.file)
331
- end
332
- else
333
- raise FileServerError.new("Invalid line '%s'" % line.chomp,
334
- count, @configuration.file)
335
- end
336
- count += 1
337
- }
338
- }
339
- rescue Errno::EACCES => detail
340
- Puppet.err "FileServer error: Cannot read %s; cannot serve" % @configuration
341
- #raise Puppet::Error, "Cannot read %s" % @configuration
342
- rescue Errno::ENOENT => detail
343
- Puppet.err "FileServer error: '%s' does not exist; cannot serve" %
344
- @configuration
345
- end
396
+ # A simple class for wrapping mount points. Instances of this class
397
+ # don't know about the enclosing object; they're mainly just used for
398
+ # authorization.
399
+ class Mount < Puppet::Network::AuthStore
400
+ attr_reader :name
346
401
 
347
- unless newmounts[MODULES]
348
- Puppet.debug "No #{MODULES} mount given; autocreating with default permissions"
349
- mount = Mount.new(MODULES)
350
- mount.allow("*")
351
- newmounts[MODULES] = mount
352
- end
402
+ @@syncs = {}
353
403
 
354
- unless newmounts[PLUGINS]
355
- Puppet.debug "No #{PLUGINS} mount given; autocreating with default permissions"
356
- mount = PluginMount.new(PLUGINS)
357
- mount.allow("*")
358
- newmounts[PLUGINS] = mount
359
- end
404
+ @@files = {}
360
405
 
361
- unless newmounts[PLUGINS].valid?
362
- Puppet.debug "No path given for #{PLUGINS} mount; creating a special PluginMount"
363
- # We end up here if the user has specified access rules for
364
- # the plugins mount, without specifying a path (which means
365
- # they want to have the default behaviour for the mount, but
366
- # special access control). So we need to move all the
367
- # user-specified access controls into the new PluginMount
368
- # object...
369
- mount = PluginMount.new(PLUGINS)
370
- # Yes, you're allowed to hate me for this.
371
- mount.instance_variable_set(:@declarations,
372
- newmounts[PLUGINS].instance_variable_get(:@declarations)
373
- )
374
- newmounts[PLUGINS] = mount
375
- end
406
+ Puppet::Util.logmethods(self, true)
376
407
 
377
- # Verify each of the mounts are valid.
378
- # We let the check raise an error, so that it can raise an error
379
- # pointing to the specific problem.
380
- newmounts.each { |name, mount|
381
- unless mount.valid?
382
- raise FileServerError, "Invalid mount %s" %
383
- name
384
- end
385
- }
386
- @mounts = newmounts
408
+ # Create a map for a specific client.
409
+ def clientmap(client)
410
+ {
411
+ "h" => client.sub(/\..*$/, ""),
412
+ "H" => client,
413
+ "d" => client.sub(/[^.]+\./, "") # domain name
414
+ }
415
+ end
416
+
417
+ # Replace % patterns as appropriate.
418
+ def expand(path, client = nil)
419
+ # This map should probably be moved into a method.
420
+ map = nil
421
+
422
+ if client
423
+ map = clientmap(client)
424
+ else
425
+ Puppet.notice "No client; expanding '#{path}' with local host"
426
+ # Else, use the local information
427
+ map = localmap
387
428
  end
388
-
389
- # Split the path into the separate mount point and path.
390
- def splitpath(dir, client)
391
- # the dir is based on one of the mounts
392
- # so first retrieve the mount path
393
- mount = nil
394
- path = nil
395
- if dir =~ %r{/([-\w]+)}
396
- # Strip off the mount name.
397
- mount_name, path = dir.sub(%r{^/}, '').split(File::Separator, 2)
398
-
399
- unless mount = modules_mount(mount_name, client)
400
- unless mount = @mounts[mount_name]
401
- raise FileServerError, "Fileserver module '%s' not mounted" % mount_name
402
- end
403
- end
404
- else
405
- raise FileServerError, "Fileserver error: Invalid path '%s'" % dir
406
- end
407
-
408
- if path.nil? or path == ''
409
- path = '/'
410
- elsif path
411
- # Remove any double slashes that might have occurred
412
- path = URI.unescape(path.gsub(/\/\//, "/"))
413
- end
414
-
415
- return mount, path
429
+ path.gsub(/%(.)/) do |v|
430
+ key = $1
431
+ if key == "%"
432
+ "%"
433
+ else
434
+ map[key] || v
435
+ end
416
436
  end
417
-
418
- def to_s
419
- "fileserver"
437
+ end
438
+
439
+ # Do we have any patterns in our path, yo?
440
+ def expandable?
441
+ if defined?(@expandable)
442
+ @expandable
443
+ else
444
+ false
420
445
  end
446
+ end
421
447
 
422
- # A simple class for wrapping mount points. Instances of this class
423
- # don't know about the enclosing object; they're mainly just used for
424
- # authorization.
425
- class Mount < Puppet::Network::AuthStore
426
- attr_reader :name
427
-
428
- @@syncs = {}
429
-
430
- @@files = {}
431
-
432
- Puppet::Util.logmethods(self, true)
433
-
434
- # Create a map for a specific client.
435
- def clientmap(client)
436
- {
437
- "h" => client.sub(/\..*$/, ""),
438
- "H" => client,
439
- "d" => client.sub(/[^.]+\./, "") # domain name
440
- }
441
- end
442
-
443
- # Replace % patterns as appropriate.
444
- def expand(path, client = nil)
445
- # This map should probably be moved into a method.
446
- map = nil
447
-
448
- if client
449
- map = clientmap(client)
450
- else
451
- Puppet.notice "No client; expanding '%s' with local host" %
452
- path
453
- # Else, use the local information
454
- map = localmap()
455
- end
456
- path.gsub(/%(.)/) do |v|
457
- key = $1
458
- if key == "%"
459
- "%"
460
- else
461
- map[key] || v
462
- end
463
- end
464
- end
465
-
466
- # Do we have any patterns in our path, yo?
467
- def expandable?
468
- if defined? @expandable
469
- @expandable
470
- else
471
- false
472
- end
473
- end
474
-
475
- # Return a fully qualified path, given a short path and
476
- # possibly a client name.
477
- def file_path(relative_path, node = nil)
478
- full_path = path(node)
479
-
480
- unless full_path
481
- p self
482
- raise ArgumentError.new("Mounts without paths are not usable") unless full_path
483
- end
484
-
485
- # If there's no relative path name, then we're serving the mount itself.
486
- return full_path unless relative_path and relative_path != "/"
487
-
488
- return File.join(full_path, relative_path)
489
- end
490
-
491
- # Create out object. It must have a name.
492
- def initialize(name, path = nil)
493
- unless name =~ %r{^[-\w]+$}
494
- raise FileServerError, "Invalid name format '%s'" % name
495
- end
496
- @name = name
497
-
498
- if path
499
- self.path = path
500
- else
501
- @path = nil
502
- end
503
-
504
- @files = {}
505
-
506
- super()
507
- end
508
-
509
- def fileobj(path, links, client)
510
- obj = nil
511
- if obj = @files[file_path(path, client)]
512
- # This can only happen in local fileserving, but it's an
513
- # important one. It'd be nice if we didn't just set
514
- # the check params every time, but I'm not sure it's worth
515
- # the effort.
516
- obj[:check] = CHECKPARAMS
517
- else
518
- obj = Puppet::Type.type(:file).new(
519
- :name => file_path(path, client),
520
- :check => CHECKPARAMS
521
- )
522
- @files[file_path(path, client)] = obj
523
- end
524
-
525
- if links == :manage
526
- links = :follow
527
- end
528
-
529
- # This, ah, might be completely redundant
530
- unless obj[:links] == links
531
- obj[:links] = links
532
- end
533
-
534
- return obj
535
- end
536
-
537
- # Read the contents of the file at the relative path given.
538
- def read_file(relpath, client)
539
- File.read(file_path(relpath, client))
540
- end
541
-
542
- # Cache this manufactured map, since if it's used it's likely
543
- # to get used a lot.
544
- def localmap
545
- unless defined? @@localmap
546
- @@localmap = {
547
- "h" => Facter.value("hostname"),
548
- "H" => [Facter.value("hostname"),
549
- Facter.value("domain")].join("."),
550
- "d" => Facter.value("domain")
551
- }
552
- end
553
- @@localmap
554
- end
555
-
556
- # Return the path as appropriate, expanding as necessary.
557
- def path(client = nil)
558
- if expandable?
559
- return expand(@path, client)
560
- else
561
- return @path
562
- end
563
- end
564
-
565
- # Set the path.
566
- def path=(path)
567
- # FIXME: For now, just don't validate paths with replacement
568
- # patterns in them.
569
- if path =~ /%./
570
- # Mark that we're expandable.
571
- @expandable = true
572
- else
573
- unless FileTest.exists?(path)
574
- raise FileServerError, "%s does not exist" % path
575
- end
576
- unless FileTest.directory?(path)
577
- raise FileServerError, "%s is not a directory" % path
578
- end
579
- unless FileTest.readable?(path)
580
- raise FileServerError, "%s is not readable" % path
581
- end
582
- @expandable = false
583
- end
584
- @path = path
585
- end
586
-
587
- # Verify that the path given exists within this mount's subtree.
588
- #
589
- def path_exists?(relpath, client = nil)
590
- File.exists?(file_path(relpath, client))
591
- end
448
+ # Return a fully qualified path, given a short path and
449
+ # possibly a client name.
450
+ def file_path(relative_path, node = nil)
451
+ full_path = path(node)
592
452
 
593
- # Return the current values for the object.
594
- def properties(obj)
595
- obj.retrieve.inject({}) { |props, ary| props[ary[0].name] = ary[1]; props }
596
- end
453
+ unless full_path
454
+ p self
455
+ raise ArgumentError.new("Mounts without paths are not usable") unless full_path
456
+ end
597
457
 
598
- # Retrieve a specific directory relative to a mount point.
599
- # If they pass in a client, then expand as necessary.
600
- def subdir(dir = nil, client = nil)
601
- basedir = self.path(client)
458
+ # If there's no relative path name, then we're serving the mount itself.
459
+ return full_path unless relative_path and relative_path != "/"
602
460
 
603
- dirname = if dir
604
- File.join(basedir, *dir.split("/"))
605
- else
606
- basedir
607
- end
461
+ File.join(full_path, relative_path)
462
+ end
608
463
 
609
- dirname
610
- end
611
-
612
- def sync(path)
613
- @@syncs[path] ||= Sync.new
614
- @@syncs[path]
615
- end
464
+ # Create out object. It must have a name.
465
+ def initialize(name, path = nil)
466
+ unless name =~ %r{^[-\w]+$}
467
+ raise FileServerError, "Invalid name format '#{name}'"
468
+ end
469
+ @name = name
616
470
 
617
- def to_s
618
- "mount[%s]" % @name
619
- end
471
+ if path
472
+ self.path = path
473
+ else
474
+ @path = nil
475
+ end
620
476
 
621
- # Verify our configuration is valid. This should really check to
622
- # make sure at least someone will be allowed, but, eh.
623
- def valid?
624
- if name == MODULES
625
- return @path.nil?
626
- else
627
- return ! @path.nil?
628
- end
629
- end
477
+ @files = {}
630
478
 
631
- # Return a new mount with the same properties as +self+, except
632
- # with a different name and path.
633
- def copy(name, path)
634
- result = self.clone
635
- result.path = path
636
- result.instance_variable_set(:@name, name)
637
- return result
638
- end
479
+ super()
480
+ end
639
481
 
640
- # List the contents of the relative path +relpath+ of this mount.
641
- #
642
- # +recurse+ is the number of levels to recurse into the tree,
643
- # or false to provide no recursion or true if you just want to
644
- # go for broke.
645
- #
646
- # +ignore+ is an array of filenames to ignore when traversing
647
- # the list.
648
- #
649
- # The return value of this method is a complex nest of arrays,
650
- # which describes a directory tree. Each file or directory is
651
- # represented by an array, where the first element is the path
652
- # of the file (relative to the root of the mount), and the
653
- # second element is the type. A directory is represented by an
654
- # array as well, where the first element is a "directory" array,
655
- # while the remaining elements are other file or directory
656
- # arrays. Confusing? Hell yes. As an added bonus, all names
657
- # must start with a slash, because... well, I'm fairly certain
658
- # a complete explanation would involve the words "crack pipe"
659
- # and "bad batch".
660
- #
661
- def list(relpath, recurse, ignore, client = nil)
662
- abspath = file_path(relpath, client)
663
- if FileTest.exists?(abspath)
664
- if FileTest.directory?(abspath) and recurse
665
- return reclist(abspath, recurse, ignore)
666
- else
667
- return [["/", File.stat(abspath).ftype]]
668
- end
669
- end
670
- return nil
671
- end
482
+ def fileobj(path, links, client)
483
+ obj = nil
484
+ if obj = @files[file_path(path, client)]
485
+ # This can only happen in local fileserving, but it's an
486
+ # important one. It'd be nice if we didn't just set
487
+ # the check params every time, but I'm not sure it's worth
488
+ # the effort.
489
+ obj[:audit] = CHECKPARAMS
490
+ else
672
491
 
673
- def reclist(abspath, recurse, ignore)
674
- require 'puppet/file_serving'
675
- require 'puppet/file_serving/fileset'
676
- if recurse.is_a?(Fixnum)
677
- args = { :recurse => true, :recurselimit => recurse, :links => :follow }
678
- else
679
- args = { :recurse => recurse, :links => :follow }
680
- end
681
- args[:ignore] = ignore if ignore
682
- fs = Puppet::FileServing::Fileset.new(abspath, args)
683
- ary = fs.files.collect do |file|
684
- if file == "."
685
- file = "/"
686
- else
687
- file = File.join("/", file )
688
- end
689
- stat = fs.stat(File.join(abspath, file))
690
- next if stat.nil?
691
- [ file, stat.ftype ]
692
- end
492
+ obj = Puppet::Type.type(:file).new(
693
493
 
694
- return ary.compact
695
- end
494
+ :name => file_path(path, client),
696
495
 
496
+ :audit => CHECKPARAMS
497
+ )
498
+ @files[file_path(path, client)] = obj
697
499
  end
698
500
 
699
- # A special mount class specifically for the plugins mount -- just
700
- # has some magic to effectively do a union mount of the 'plugins'
701
- # directory of all modules.
702
- #
703
- class PluginMount < Mount
704
- def path(client)
705
- ''
706
- end
707
-
708
- def mod_path_exists?(mod, relpath, client = nil)
709
- ! mod.plugin(relpath).nil?
710
- end
501
+ if links == :manage
502
+ links = :follow
503
+ end
711
504
 
712
- def path_exists?(relpath, client = nil)
713
- !valid_modules(client).find { |mod| mod.plugin(relpath) }.nil?
714
- end
505
+ # This, ah, might be completely redundant
506
+ obj[:links] = links unless obj[:links] == links
507
+
508
+ obj
509
+ end
510
+
511
+ # Read the contents of the file at the relative path given.
512
+ def read_file(relpath, client)
513
+ File.read(file_path(relpath, client))
514
+ end
515
+
516
+ # Cache this manufactured map, since if it's used it's likely
517
+ # to get used a lot.
518
+ def localmap
519
+ unless defined?(@@localmap)
520
+ @@localmap = {
521
+ "h" => Facter.value("hostname"),
522
+ "H" => [Facter.value("hostname"),
523
+ Facter.value("domain")].join("."),
524
+ "d" => Facter.value("domain")
525
+ }
526
+ end
527
+ @@localmap
528
+ end
529
+
530
+ # Return the path as appropriate, expanding as necessary.
531
+ def path(client = nil)
532
+ if expandable?
533
+ return expand(@path, client)
534
+ else
535
+ return @path
536
+ end
537
+ end
538
+
539
+ # Set the path.
540
+ def path=(path)
541
+ # FIXME: For now, just don't validate paths with replacement
542
+ # patterns in them.
543
+ if path =~ /%./
544
+ # Mark that we're expandable.
545
+ @expandable = true
546
+ else
547
+ raise FileServerError, "#{path} does not exist" unless FileTest.exists?(path)
548
+ raise FileServerError, "#{path} is not a directory" unless FileTest.directory?(path)
549
+ raise FileServerError, "#{path} is not readable" unless FileTest.readable?(path)
550
+ @expandable = false
551
+ end
552
+ @path = path
553
+ end
554
+
555
+ # Verify that the path given exists within this mount's subtree.
556
+ #
557
+ def path_exists?(relpath, client = nil)
558
+ File.exists?(file_path(relpath, client))
559
+ end
560
+
561
+ # Return the current values for the object.
562
+ def properties(obj)
563
+ obj.retrieve.inject({}) { |props, ary| props[ary[0].name] = ary[1]; props }
564
+ end
565
+
566
+ # Retrieve a specific directory relative to a mount point.
567
+ # If they pass in a client, then expand as necessary.
568
+ def subdir(dir = nil, client = nil)
569
+ basedir = self.path(client)
570
+
571
+ dirname = if dir
572
+ File.join(basedir, *dir.split("/"))
573
+ else
574
+ basedir
575
+ end
715
576
 
716
- def valid?
717
- true
718
- end
577
+ dirname
578
+ end
579
+
580
+ def sync(path)
581
+ @@syncs[path] ||= Sync.new
582
+ @@syncs[path]
583
+ end
584
+
585
+ def to_s
586
+ "mount[#{@name}]"
587
+ end
588
+
589
+ # Verify our configuration is valid. This should really check to
590
+ # make sure at least someone will be allowed, but, eh.
591
+ def valid?
592
+ if name == MODULES
593
+ return @path.nil?
594
+ else
595
+ return ! @path.nil?
596
+ end
597
+ end
598
+
599
+ # Return a new mount with the same properties as +self+, except
600
+ # with a different name and path.
601
+ def copy(name, path)
602
+ result = self.clone
603
+ result.path = path
604
+ result.instance_variable_set(:@name, name)
605
+ result
606
+ end
607
+
608
+ # List the contents of the relative path +relpath+ of this mount.
609
+ #
610
+ # +recurse+ is the number of levels to recurse into the tree,
611
+ # or false to provide no recursion or true if you just want to
612
+ # go for broke.
613
+ #
614
+ # +ignore+ is an array of filenames to ignore when traversing
615
+ # the list.
616
+ #
617
+ # The return value of this method is a complex nest of arrays,
618
+ # which describes a directory tree. Each file or directory is
619
+ # represented by an array, where the first element is the path
620
+ # of the file (relative to the root of the mount), and the
621
+ # second element is the type. A directory is represented by an
622
+ # array as well, where the first element is a "directory" array,
623
+ # while the remaining elements are other file or directory
624
+ # arrays. Confusing? Hell yes. As an added bonus, all names
625
+ # must start with a slash, because... well, I'm fairly certain
626
+ # a complete explanation would involve the words "crack pipe"
627
+ # and "bad batch".
628
+ #
629
+ def list(relpath, recurse, ignore, client = nil)
630
+ abspath = file_path(relpath, client)
631
+ if FileTest.exists?(abspath)
632
+ if FileTest.directory?(abspath) and recurse
633
+ return reclist(abspath, recurse, ignore)
634
+ else
635
+ return [["/", File.stat(abspath).ftype]]
636
+ end
637
+ end
638
+ nil
639
+ end
640
+
641
+ def reclist(abspath, recurse, ignore)
642
+ require 'puppet/file_serving'
643
+ require 'puppet/file_serving/fileset'
644
+ if recurse.is_a?(Fixnum)
645
+ args = { :recurse => true, :recurselimit => recurse, :links => :follow }
646
+ else
647
+ args = { :recurse => recurse, :links => :follow }
648
+ end
649
+ args[:ignore] = ignore if ignore
650
+ fs = Puppet::FileServing::Fileset.new(abspath, args)
651
+ ary = fs.files.collect do |file|
652
+ if file == "."
653
+ file = "/"
654
+ else
655
+ file = File.join("/", file )
656
+ end
657
+ stat = fs.stat(File.join(abspath, file))
658
+ next if stat.nil?
659
+ [ file, stat.ftype ]
660
+ end
719
661
 
720
- def mod_file_path(mod, relpath, client = nil)
721
- File.join(mod, PLUGINS, relpath)
722
- end
662
+ ary.compact
663
+ end
723
664
 
724
- def file_path(relpath, client = nil)
725
- return nil unless mod = valid_modules(client).find { |m| m.plugin(relpath) }
726
- mod.plugin(relpath)
727
- end
665
+ end
728
666
 
729
- # create a list of files by merging all modules
730
- def list(relpath, recurse, ignore, client = nil)
731
- result = []
732
- valid_modules(client).each do |mod|
733
- if modpath = mod.plugin(relpath)
734
- if FileTest.directory?(modpath) and recurse
735
- ary = reclist(modpath, recurse, ignore)
736
- ary = [] if ary.nil?
737
- result += ary
738
- else
739
- result += [["/", File.stat(modpath).ftype]]
740
- end
741
- end
742
- end
743
- result
667
+ # A special mount class specifically for the plugins mount -- just
668
+ # has some magic to effectively do a union mount of the 'plugins'
669
+ # directory of all modules.
670
+ #
671
+ class PluginMount < Mount
672
+ def path(client)
673
+ ''
674
+ end
675
+
676
+ def mod_path_exists?(mod, relpath, client = nil)
677
+ ! mod.plugin(relpath).nil?
678
+ end
679
+
680
+ def path_exists?(relpath, client = nil)
681
+ !valid_modules(client).find { |mod| mod.plugin(relpath) }.nil?
682
+ end
683
+
684
+ def valid?
685
+ true
686
+ end
687
+
688
+ def mod_file_path(mod, relpath, client = nil)
689
+ File.join(mod, PLUGINS, relpath)
690
+ end
691
+
692
+ def file_path(relpath, client = nil)
693
+ return nil unless mod = valid_modules(client).find { |m| m.plugin(relpath) }
694
+ mod.plugin(relpath)
695
+ end
696
+
697
+ # create a list of files by merging all modules
698
+ def list(relpath, recurse, ignore, client = nil)
699
+ result = []
700
+ valid_modules(client).each do |mod|
701
+ if modpath = mod.plugin(relpath)
702
+ if FileTest.directory?(modpath) and recurse
703
+ ary = reclist(modpath, recurse, ignore)
704
+ ary ||= []
705
+ result += ary
706
+ else
707
+ result += [["/", File.stat(modpath).ftype]]
744
708
  end
709
+ end
710
+ end
711
+ result
712
+ end
745
713
 
746
- private
747
- def valid_modules(client)
748
- Puppet::Node::Environment.new.modules.find_all { |mod| mod.exist? }
749
- end
714
+ private
715
+ def valid_modules(client)
716
+ Puppet::Node::Environment.new.modules.find_all { |mod| mod.exist? }
717
+ end
750
718
 
751
- def add_to_filetree(f, filetree)
752
- first, rest = f.split(File::SEPARATOR, 2)
753
- end
754
- end
719
+ def add_to_filetree(f, filetree)
720
+ first, rest = f.split(File::SEPARATOR, 2)
721
+ end
755
722
  end
723
+ end
756
724
  end
757
725