puppet 2.7.26 → 3.0.0.rc4

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 (1472) hide show
  1. data/CHANGELOG +533 -204
  2. data/Gemfile +8 -24
  3. data/Gemfile.lock +44 -0
  4. data/LICENSE +1 -1
  5. data/README.md +2 -2
  6. data/README_DEVELOPER.md +18 -210
  7. data/Rakefile +30 -47
  8. data/bin/puppet +5 -3
  9. data/conf/auth.conf +3 -3
  10. data/{ext → conf}/osx/PackageInfo.plist +0 -0
  11. data/{ext → conf}/osx/createpackage.sh +0 -0
  12. data/conf/osx/preflight +24 -0
  13. data/conf/redhat/client.init +8 -8
  14. data/{ext/redhat/puppet.spec.erb → conf/redhat/puppet.spec} +29 -46
  15. data/conf/redhat/queue.init +105 -0
  16. data/conf/redhat/rundir-perms.patch +13 -13
  17. data/conf/redhat/server.init +4 -4
  18. data/conf/solaris/pkginfo +1 -1
  19. data/conf/suse/puppet.spec +8 -3
  20. data/conf/windows/eventlog/puppetres.dll +0 -0
  21. data/ext/emacs/puppet-mode.el +204 -150
  22. data/ext/nagios/naggen +1 -1
  23. data/ext/puppet-test +1 -1
  24. data/ext/puppetlisten/puppetlisten.rb +1 -2
  25. data/ext/puppetlisten/puppetrun.rb +1 -2
  26. data/ext/rack/files/config.ru +21 -3
  27. data/ext/regexp_nodes/environment/development +2 -0
  28. data/ext/regexp_nodes/parameters/{environment → service}/prod +0 -0
  29. data/ext/regexp_nodes/parameters/{environment → service}/qa +0 -0
  30. data/ext/regexp_nodes/parameters/service/sandbox +1 -0
  31. data/ext/regexp_nodes/regexp_nodes.rb +115 -59
  32. data/ext/upload_facts.rb +0 -1
  33. data/install.rb +10 -10
  34. data/lib/puppet.rb +49 -24
  35. data/lib/puppet/agent.rb +40 -16
  36. data/lib/puppet/agent/disabler.rb +53 -0
  37. data/lib/puppet/agent/locker.rb +18 -24
  38. data/lib/puppet/application.rb +93 -72
  39. data/lib/puppet/application/agent.rb +29 -47
  40. data/lib/puppet/application/apply.rb +40 -39
  41. data/lib/puppet/application/cert.rb +9 -11
  42. data/lib/puppet/application/certificate.rb +7 -2
  43. data/lib/puppet/application/certificate_request.rb +3 -0
  44. data/lib/puppet/application/certificate_revocation_list.rb +3 -0
  45. data/lib/puppet/application/describe.rb +1 -3
  46. data/lib/puppet/application/device.rb +15 -16
  47. data/lib/puppet/application/doc.rb +12 -11
  48. data/lib/puppet/application/face_base.rb +9 -13
  49. data/lib/puppet/application/filebucket.rb +2 -8
  50. data/lib/puppet/application/inspect.rb +3 -6
  51. data/lib/puppet/application/instrumentation_data.rb +3 -0
  52. data/lib/puppet/application/instrumentation_listener.rb +3 -0
  53. data/lib/puppet/application/instrumentation_probe.rb +3 -0
  54. data/lib/puppet/application/kick.rb +2 -8
  55. data/lib/puppet/application/master.rb +9 -15
  56. data/lib/puppet/application/module.rb +0 -7
  57. data/lib/puppet/application/queue.rb +7 -6
  58. data/lib/puppet/application/resource.rb +1 -5
  59. data/lib/puppet/application/resource_type.rb +3 -0
  60. data/lib/puppet/application/secret_agent.rb +3 -0
  61. data/lib/puppet/configurer.rb +87 -88
  62. data/lib/puppet/configurer/downloader.rb +8 -23
  63. data/lib/puppet/configurer/fact_handler.rb +5 -17
  64. data/lib/puppet/configurer/plugin_handler.rb +4 -23
  65. data/lib/puppet/daemon.rb +24 -6
  66. data/lib/puppet/data_binding.rb +11 -0
  67. data/lib/puppet/defaults.rb +1058 -518
  68. data/lib/puppet/error.rb +31 -25
  69. data/lib/puppet/external/dot.rb +1 -1
  70. data/lib/puppet/external/nagios/base.rb +8 -4
  71. data/lib/puppet/face/ca.rb +1 -1
  72. data/lib/puppet/face/catalog.rb +1 -2
  73. data/lib/puppet/face/certificate.rb +12 -0
  74. data/lib/puppet/face/config.rb +3 -0
  75. data/lib/puppet/face/help.rb +92 -28
  76. data/lib/puppet/face/help/action.erb +36 -3
  77. data/lib/puppet/face/help/face.erb +35 -3
  78. data/lib/puppet/face/help/global.erb +8 -12
  79. data/lib/puppet/face/help/man.erb +20 -2
  80. data/lib/puppet/face/instrumentation_data.rb +1 -0
  81. data/lib/puppet/face/instrumentation_listener.rb +1 -0
  82. data/lib/puppet/face/instrumentation_probe.rb +1 -0
  83. data/lib/puppet/face/module.rb +2 -0
  84. data/lib/puppet/face/module/build.rb +32 -6
  85. data/lib/puppet/face/module/changes.rb +1 -0
  86. data/lib/puppet/face/module/generate.rb +1 -0
  87. data/lib/puppet/face/module/install.rb +10 -41
  88. data/lib/puppet/face/module/list.rb +2 -19
  89. data/lib/puppet/face/module/search.rb +12 -6
  90. data/lib/puppet/face/module/uninstall.rb +3 -18
  91. data/lib/puppet/face/module/upgrade.rb +2 -9
  92. data/lib/puppet/face/node/clean.rb +25 -27
  93. data/lib/puppet/face/report.rb +2 -4
  94. data/lib/puppet/face/resource.rb +1 -1
  95. data/lib/puppet/feature/base.rb +9 -3
  96. data/lib/puppet/feature/rails.rb +18 -0
  97. data/lib/puppet/feature/rdoc1.rb +16 -0
  98. data/lib/puppet/file_bucket/dipper.rb +3 -2
  99. data/lib/puppet/file_serving/base.rb +4 -8
  100. data/lib/puppet/file_serving/configuration.rb +1 -12
  101. data/lib/puppet/file_serving/configuration/parser.rb +1 -1
  102. data/lib/puppet/file_serving/metadata.rb +0 -14
  103. data/lib/puppet/file_serving/mount/plugins.rb +10 -1
  104. data/lib/puppet/file_serving/terminus_selector.rb +15 -13
  105. data/lib/puppet/forge.rb +29 -13
  106. data/lib/puppet/forge/cache.rb +1 -1
  107. data/lib/puppet/forge/errors.rb +69 -0
  108. data/lib/puppet/forge/repository.rb +84 -21
  109. data/lib/puppet/indirector/catalog/active_record.rb +2 -12
  110. data/lib/puppet/indirector/catalog/compiler.rb +8 -18
  111. data/lib/puppet/indirector/catalog/json.rb +6 -0
  112. data/lib/puppet/indirector/catalog/static_compiler.rb +3 -2
  113. data/lib/puppet/indirector/certificate/rest.rb +1 -0
  114. data/lib/puppet/indirector/certificate_status/file.rb +0 -5
  115. data/lib/puppet/indirector/data_binding/hiera.rb +6 -0
  116. data/lib/puppet/indirector/data_binding/none.rb +5 -0
  117. data/lib/puppet/indirector/exec.rb +8 -18
  118. data/lib/puppet/indirector/face.rb +5 -4
  119. data/lib/puppet/indirector/facts/facter.rb +6 -33
  120. data/lib/puppet/indirector/facts/network_device.rb +0 -1
  121. data/lib/puppet/indirector/file_bucket_file/file.rb +0 -4
  122. data/lib/puppet/indirector/file_bucket_file/selector.rb +0 -4
  123. data/lib/puppet/indirector/file_content/rest.rb +2 -0
  124. data/lib/puppet/indirector/hiera.rb +69 -0
  125. data/lib/puppet/indirector/indirection.rb +20 -26
  126. data/lib/puppet/indirector/json.rb +76 -0
  127. data/lib/puppet/indirector/ldap.rb +3 -2
  128. data/lib/puppet/indirector/node/active_record.rb +1 -0
  129. data/lib/puppet/indirector/node/exec.rb +9 -0
  130. data/lib/puppet/indirector/node/ldap.rb +6 -3
  131. data/lib/puppet/indirector/node/plain.rb +1 -0
  132. data/lib/puppet/indirector/none.rb +9 -0
  133. data/lib/puppet/indirector/queue.rb +1 -2
  134. data/lib/puppet/indirector/report/processor.rb +2 -3
  135. data/lib/puppet/indirector/report/rest.rb +1 -7
  136. data/lib/puppet/indirector/request.rb +80 -18
  137. data/lib/puppet/indirector/resource/active_record.rb +0 -3
  138. data/lib/puppet/indirector/resource/ral.rb +0 -4
  139. data/lib/puppet/indirector/resource/rest.rb +0 -9
  140. data/lib/puppet/indirector/resource/store_configs.rb +0 -3
  141. data/lib/puppet/indirector/resource_type/parser.rb +30 -1
  142. data/lib/puppet/indirector/rest.rb +103 -126
  143. data/lib/puppet/indirector/run/local.rb +0 -4
  144. data/lib/puppet/indirector/run/rest.rb +0 -6
  145. data/lib/puppet/indirector/terminus.rb +0 -20
  146. data/lib/puppet/indirector/yaml.rb +11 -5
  147. data/lib/puppet/interface.rb +6 -14
  148. data/lib/puppet/interface/action.rb +21 -3
  149. data/lib/puppet/interface/action_builder.rb +5 -0
  150. data/lib/puppet/interface/action_manager.rb +1 -1
  151. data/lib/puppet/interface/documentation.rb +12 -0
  152. data/lib/puppet/interface/face_collection.rb +1 -1
  153. data/lib/puppet/interface/option.rb +19 -3
  154. data/lib/puppet/interface/option_manager.rb +27 -9
  155. data/lib/puppet/metatype/manager.rb +1 -0
  156. data/lib/puppet/module.rb +40 -83
  157. data/lib/puppet/module_tool.rb +42 -5
  158. data/lib/puppet/module_tool/applications/builder.rb +1 -1
  159. data/lib/puppet/module_tool/applications/installer.rb +11 -11
  160. data/lib/puppet/module_tool/applications/searcher.rb +15 -2
  161. data/lib/puppet/module_tool/applications/unpacker.rb +4 -8
  162. data/lib/puppet/module_tool/applications/upgrader.rb +6 -5
  163. data/lib/puppet/module_tool/errors/base.rb +1 -1
  164. data/lib/puppet/module_tool/errors/installer.rb +24 -4
  165. data/lib/puppet/module_tool/install_directory.rb +41 -0
  166. data/lib/puppet/module_tool/metadata.rb +4 -4
  167. data/lib/puppet/module_tool/shared_behaviors.rb +6 -6
  168. data/lib/puppet/network/auth_config_parser.rb +81 -0
  169. data/lib/puppet/network/authconfig.rb +49 -147
  170. data/lib/puppet/network/authorization.rb +20 -62
  171. data/lib/puppet/network/authstore.rb +43 -27
  172. data/lib/puppet/network/formats.rb +10 -20
  173. data/lib/puppet/network/http/api/v1.rb +1 -1
  174. data/lib/puppet/network/http/connection.rb +184 -0
  175. data/lib/puppet/network/http/handler.rb +4 -14
  176. data/lib/puppet/network/http/mongrel.rb +5 -25
  177. data/lib/puppet/network/http/rack.rb +2 -34
  178. data/lib/puppet/network/http/rack/httphandler.rb +0 -3
  179. data/lib/puppet/network/http/rack/rest.rb +2 -7
  180. data/lib/puppet/network/http/webrick.rb +9 -32
  181. data/lib/puppet/network/http_pool.rb +10 -48
  182. data/lib/puppet/network/resolver.rb +85 -0
  183. data/lib/puppet/network/rights.rb +33 -89
  184. data/lib/puppet/network/server.rb +14 -43
  185. data/lib/puppet/node.rb +13 -11
  186. data/lib/puppet/node/environment.rb +29 -12
  187. data/lib/puppet/node/facts.rb +13 -38
  188. data/lib/puppet/parameter.rb +0 -21
  189. data/lib/puppet/parameter/package_options.rb +26 -0
  190. data/lib/puppet/parser/ast.rb +2 -13
  191. data/lib/puppet/parser/ast/function.rb +0 -2
  192. data/lib/puppet/parser/ast/leaf.rb +12 -22
  193. data/lib/puppet/parser/ast/resource.rb +3 -10
  194. data/lib/puppet/parser/ast/resource_defaults.rb +1 -1
  195. data/lib/puppet/parser/ast/resource_override.rb +1 -4
  196. data/lib/puppet/parser/ast/resourceparam.rb +4 -7
  197. data/lib/puppet/parser/ast/selector.rb +7 -1
  198. data/lib/puppet/parser/ast/vardef.rb +0 -2
  199. data/lib/puppet/parser/collector.rb +2 -1
  200. data/lib/puppet/parser/compiler.rb +43 -46
  201. data/lib/puppet/parser/files.rb +15 -20
  202. data/lib/puppet/parser/functions.rb +8 -39
  203. data/lib/puppet/parser/functions/extlookup.rb +8 -8
  204. data/lib/puppet/parser/functions/file.rb +18 -18
  205. data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
  206. data/lib/puppet/parser/functions/generate.rb +3 -3
  207. data/lib/puppet/parser/functions/include.rb +6 -1
  208. data/lib/puppet/parser/functions/require.rb +16 -21
  209. data/lib/puppet/parser/functions/shellquote.rb +29 -21
  210. data/lib/puppet/parser/functions/versioncmp.rb +2 -5
  211. data/lib/puppet/parser/grammar.ra +44 -14
  212. data/lib/puppet/parser/lexer.rb +101 -169
  213. data/lib/puppet/parser/parser.rb +1103 -1014
  214. data/lib/puppet/parser/parser_support.rb +10 -61
  215. data/lib/puppet/parser/relationship.rb +1 -3
  216. data/lib/puppet/parser/resource.rb +21 -56
  217. data/lib/puppet/parser/scope.rb +138 -165
  218. data/lib/puppet/parser/templatewrapper.rb +25 -20
  219. data/lib/puppet/parser/type_loader.rb +33 -67
  220. data/lib/puppet/parser/yaml_trimmer.rb +1 -1
  221. data/lib/puppet/property.rb +5 -4
  222. data/lib/puppet/provider.rb +133 -28
  223. data/lib/puppet/provider/augeas/augeas.rb +66 -6
  224. data/lib/puppet/provider/command.rb +25 -0
  225. data/lib/puppet/provider/cron/crontab.rb +1 -1
  226. data/lib/puppet/provider/exec.rb +14 -9
  227. data/lib/puppet/provider/exec/posix.rb +1 -1
  228. data/lib/puppet/provider/exec/windows.rb +2 -3
  229. data/lib/puppet/provider/file/windows.rb +29 -10
  230. data/lib/puppet/provider/group/groupadd.rb +3 -2
  231. data/lib/puppet/provider/group/ldap.rb +1 -1
  232. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  233. data/lib/puppet/provider/host/parsed.rb +1 -1
  234. data/lib/puppet/provider/ldap.rb +1 -5
  235. data/lib/puppet/provider/mount/parsed.rb +3 -3
  236. data/lib/puppet/provider/nameservice.rb +22 -22
  237. data/lib/puppet/provider/nameservice/directoryservice.rb +58 -121
  238. data/lib/puppet/provider/package/apt.rb +8 -11
  239. data/lib/puppet/provider/package/blastwave.rb +3 -3
  240. data/lib/puppet/provider/package/dpkg.rb +1 -1
  241. data/lib/puppet/provider/package/freebsd.rb +2 -2
  242. data/lib/puppet/provider/package/gem.rb +1 -1
  243. data/lib/puppet/provider/package/macports.rb +11 -9
  244. data/lib/puppet/provider/package/msi.rb +37 -32
  245. data/lib/puppet/provider/package/openbsd.rb +1 -1
  246. data/lib/puppet/provider/package/pacman.rb +69 -6
  247. data/lib/puppet/provider/package/pkg.rb +126 -75
  248. data/lib/puppet/provider/package/pkgin.rb +60 -0
  249. data/lib/puppet/provider/package/pkgutil.rb +32 -20
  250. data/lib/puppet/provider/package/portage.rb +2 -2
  251. data/lib/puppet/provider/package/sun.rb +83 -116
  252. data/lib/puppet/provider/package/sunfreeware.rb +1 -1
  253. data/lib/puppet/provider/package/up2date.rb +2 -3
  254. data/lib/puppet/provider/package/windows.rb +130 -0
  255. data/lib/puppet/provider/package/windows/exe_package.rb +70 -0
  256. data/lib/puppet/provider/package/windows/msi_package.rb +62 -0
  257. data/lib/puppet/provider/package/windows/package.rb +79 -0
  258. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  259. data/lib/puppet/provider/service/base.rb +1 -0
  260. data/lib/puppet/provider/service/bsd.rb +7 -5
  261. data/lib/puppet/provider/service/daemontools.rb +1 -1
  262. data/lib/puppet/provider/service/debian.rb +1 -1
  263. data/lib/puppet/provider/service/freebsd.rb +9 -9
  264. data/lib/puppet/provider/service/launchd.rb +7 -11
  265. data/lib/puppet/provider/service/redhat.rb +2 -2
  266. data/lib/puppet/provider/service/runit.rb +9 -2
  267. data/lib/puppet/provider/service/smf.rb +14 -2
  268. data/lib/puppet/provider/service/systemd.rb +3 -3
  269. data/lib/puppet/provider/service/upstart.rb +6 -6
  270. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -0
  271. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  272. data/lib/puppet/provider/user/useradd.rb +3 -8
  273. data/lib/puppet/provider/user/windows_adsi.rb +1 -12
  274. data/lib/puppet/provider/zfs/{solaris.rb → zfs.rb} +16 -5
  275. data/lib/puppet/provider/zone/solaris.rb +10 -13
  276. data/lib/puppet/provider/zpool/{solaris.rb → zpool.rb} +11 -4
  277. data/lib/puppet/rails.rb +6 -4
  278. data/lib/puppet/rails/database/schema.rb +9 -4
  279. data/lib/puppet/rails/inventory_node.rb +13 -26
  280. data/lib/puppet/reference/configuration.rb +1 -2
  281. data/lib/puppet/reference/metaparameter.rb +1 -2
  282. data/lib/puppet/reports/http.rb +9 -10
  283. data/lib/puppet/reports/rrdgraph.rb +2 -2
  284. data/lib/puppet/reports/store.rb +1 -2
  285. data/lib/puppet/reports/tagmail.rb +6 -6
  286. data/lib/puppet/resource.rb +69 -64
  287. data/lib/puppet/resource/catalog.rb +11 -60
  288. data/lib/puppet/resource/status.rb +6 -32
  289. data/lib/puppet/resource/type.rb +94 -34
  290. data/lib/puppet/resource/type_collection.rb +17 -8
  291. data/lib/puppet/run.rb +4 -26
  292. data/lib/puppet/settings.rb +1315 -0
  293. data/lib/puppet/settings/base_setting.rb +163 -0
  294. data/lib/puppet/{util/settings → settings}/boolean_setting.rb +7 -3
  295. data/lib/puppet/settings/directory_setting.rb +7 -0
  296. data/lib/puppet/settings/errors.rb +11 -0
  297. data/lib/puppet/{util/settings → settings}/file_setting.rb +4 -20
  298. data/lib/puppet/settings/path_setting.rb +10 -0
  299. data/lib/puppet/settings/string_setting.rb +12 -0
  300. data/lib/puppet/simple_graph.rb +2 -5
  301. data/lib/puppet/ssl/base.rb +2 -2
  302. data/lib/puppet/ssl/certificate_authority.rb +4 -5
  303. data/lib/puppet/ssl/certificate_authority/interface.rb +5 -7
  304. data/lib/puppet/ssl/certificate_factory.rb +1 -2
  305. data/lib/puppet/ssl/certificate_request.rb +2 -2
  306. data/lib/puppet/ssl/certificate_revocation_list.rb +53 -30
  307. data/lib/puppet/ssl/configuration.rb +32 -0
  308. data/lib/puppet/ssl/host.rb +9 -37
  309. data/lib/puppet/status.rb +2 -6
  310. data/lib/puppet/test/test_helper.rb +58 -25
  311. data/lib/puppet/transaction.rb +6 -9
  312. data/lib/puppet/transaction/event.rb +13 -24
  313. data/lib/puppet/transaction/event_manager.rb +1 -1
  314. data/lib/puppet/transaction/report.rb +2 -41
  315. data/lib/puppet/transaction/resource_harness.rb +2 -3
  316. data/lib/puppet/type.rb +18 -191
  317. data/lib/puppet/type/augeas.rb +1 -1
  318. data/lib/puppet/type/cron.rb +1 -1
  319. data/lib/puppet/type/exec.rb +6 -4
  320. data/lib/puppet/type/file.rb +33 -44
  321. data/lib/puppet/type/file/content.rb +13 -9
  322. data/lib/puppet/type/file/ensure.rb +1 -1
  323. data/lib/puppet/type/file/mode.rb +1 -1
  324. data/lib/puppet/type/file/selcontext.rb +2 -6
  325. data/lib/puppet/type/file/source.rb +8 -4
  326. data/lib/puppet/type/filebucket.rb +3 -2
  327. data/lib/puppet/type/mount.rb +1 -11
  328. data/lib/puppet/type/package.rb +40 -23
  329. data/lib/puppet/type/schedule.rb +127 -21
  330. data/lib/puppet/type/scheduled_task.rb +1 -1
  331. data/lib/puppet/type/service.rb +2 -3
  332. data/lib/puppet/type/tidy.rb +8 -17
  333. data/lib/puppet/type/yumrepo.rb +35 -7
  334. data/lib/puppet/type/zfs.rb +4 -0
  335. data/lib/puppet/type/zone.rb +48 -38
  336. data/lib/puppet/util.rb +178 -249
  337. data/lib/puppet/util/adsi.rb +23 -25
  338. data/lib/puppet/util/autoload.rb +184 -114
  339. data/lib/puppet/util/backups.rb +3 -2
  340. data/lib/puppet/util/colors.rb +0 -1
  341. data/lib/puppet/util/command_line.rb +42 -104
  342. data/lib/puppet/util/command_line/puppet_option_parser.rb +89 -0
  343. data/lib/puppet/util/command_line/trollop.rb +824 -0
  344. data/lib/puppet/util/config_timeout.rb +24 -0
  345. data/lib/puppet/util/constant_inflector.rb +15 -7
  346. data/lib/puppet/util/diff.rb +2 -2
  347. data/lib/puppet/util/docs.rb +1 -2
  348. data/lib/puppet/util/errors.rb +3 -4
  349. data/lib/puppet/util/execution.rb +239 -14
  350. data/lib/puppet/util/execution_stub.rb +2 -2
  351. data/lib/puppet/util/feature.rb +2 -4
  352. data/lib/puppet/util/fileparsing.rb +1 -1
  353. data/lib/puppet/util/filetype.rb +12 -10
  354. data/lib/puppet/util/json_lockfile.rb +41 -0
  355. data/lib/puppet/util/ldap/connection.rb +4 -7
  356. data/lib/puppet/util/lockfile.rb +62 -0
  357. data/lib/puppet/util/log.rb +16 -20
  358. data/lib/puppet/util/log/destinations.rb +12 -27
  359. data/lib/puppet/util/logging.rb +95 -3
  360. data/lib/puppet/util/metric.rb +0 -6
  361. data/lib/puppet/util/monkey_patches.rb +101 -82
  362. data/lib/puppet/util/monkey_patches/lines.rb +13 -0
  363. data/lib/puppet/util/network_device/cisco/device.rb +2 -2
  364. data/lib/puppet/util/network_device/config.rb +1 -0
  365. data/lib/puppet/util/network_device/transport.rb +2 -0
  366. data/lib/puppet/util/pidlock.rb +13 -77
  367. data/lib/puppet/util/platform.rb +0 -7
  368. data/lib/puppet/util/posix.rb +10 -0
  369. data/lib/puppet/util/rdoc.rb +12 -8
  370. data/lib/puppet/util/reference.rb +3 -3
  371. data/lib/puppet/util/rubygems.rb +55 -0
  372. data/lib/puppet/util/run_mode.rb +7 -16
  373. data/lib/puppet/util/selinux.rb +36 -31
  374. data/lib/puppet/util/storage.rb +14 -19
  375. data/lib/puppet/util/suidmanager.rb +27 -2
  376. data/lib/puppet/util/windows.rb +9 -6
  377. data/lib/puppet/util/windows/error.rb +1 -1
  378. data/lib/puppet/util/windows/process.rb +3 -3
  379. data/lib/puppet/util/windows/registry.rb +36 -0
  380. data/lib/puppet/util/windows/security.rb +46 -9
  381. data/lib/puppet/util/windows/user.rb +2 -65
  382. data/lib/puppet/util/zaml.rb +47 -91
  383. data/lib/puppet/version.rb +1 -1
  384. data/man/man5/puppet.conf.5 +97 -69
  385. data/man/man8/puppet-agent.8 +5 -6
  386. data/man/man8/puppet-apply.8 +7 -3
  387. data/man/man8/puppet-ca.8 +5 -17
  388. data/man/man8/puppet-catalog.8 +1 -1
  389. data/man/man8/puppet-cert.8 +1 -1
  390. data/man/man8/puppet-certificate.8 +3 -9
  391. data/man/man8/puppet-certificate_request.8 +1 -1
  392. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  393. data/man/man8/puppet-config.8 +1 -1
  394. data/man/man8/puppet-describe.8 +1 -1
  395. data/man/man8/puppet-device.8 +1 -1
  396. data/man/man8/puppet-doc.8 +7 -1
  397. data/man/man8/puppet-facts.8 +1 -1
  398. data/man/man8/puppet-file.8 +1 -1
  399. data/man/man8/puppet-filebucket.8 +1 -1
  400. data/man/man8/puppet-help.8 +2 -5
  401. data/man/man8/puppet-inspect.8 +1 -1
  402. data/man/man8/puppet-instrumentation_data.8 +1 -1
  403. data/man/man8/puppet-instrumentation_listener.8 +1 -1
  404. data/man/man8/puppet-instrumentation_probe.8 +1 -1
  405. data/man/man8/puppet-key.8 +1 -1
  406. data/man/man8/puppet-kick.8 +1 -1
  407. data/man/man8/puppet-man.8 +1 -1
  408. data/man/man8/puppet-master.8 +1 -1
  409. data/man/man8/puppet-module.8 +19 -50
  410. data/man/man8/puppet-node.8 +2 -5
  411. data/man/man8/puppet-parser.8 +7 -1
  412. data/man/man8/puppet-plugin.8 +1 -1
  413. data/man/man8/puppet-queue.8 +1 -1
  414. data/man/man8/puppet-report.8 +2 -3
  415. data/man/man8/puppet-resource.8 +1 -1
  416. data/man/man8/puppet-resource_type.8 +1 -1
  417. data/man/man8/puppet-secret_agent.8 +1 -1
  418. data/man/man8/puppet-status.8 +1 -1
  419. data/man/man8/puppet.8 +1 -1
  420. data/spec/fixtures/unit/indirector/hiera/global.yaml +10 -0
  421. data/{test/data/providers/cron/crontab_sample_records.yaml → spec/fixtures/unit/provider/cron/crontab/single_line.yaml} +0 -0
  422. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris10 +1 -1
  423. data/spec/fixtures/unit/provider/package/pkg/{dummy_solaris11 → dummy_solaris11.ifo.installed} +0 -0
  424. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.ifo.known +1 -0
  425. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.installed +1 -0
  426. data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.known +1 -0
  427. data/spec/fixtures/unit/provider/package/pkg/publisher +2 -2
  428. data/spec/fixtures/unit/provider/package/pkg/simple +2 -4
  429. data/spec/fixtures/unit/provider/package/pkg/solaris11 +2 -12
  430. data/spec/fixtures/unit/provider/package/sun/dummy.server +12 -0
  431. data/spec/fixtures/unit/provider/package/sun/simple +24 -0
  432. data/spec/fixtures/unit/provider/service/smf/svcs.out +3 -0
  433. data/{test/data/types/sshkey/1 → spec/fixtures/unit/provider/sshkey/parsed/sample} +0 -0
  434. data/spec/fixtures/unit/provider/zfs/zfs/zfs-list.out +2 -0
  435. data/spec/fixtures/unit/provider/zpool/zpool/zpool-list.out +2 -0
  436. data/spec/integration/application/apply_spec.rb +1 -1
  437. data/spec/integration/application/doc_spec.rb +3 -2
  438. data/spec/integration/configurer_spec.rb +1 -1
  439. data/spec/integration/defaults_spec.rb +21 -51
  440. data/spec/{unit/face → integration/faces}/ca_spec.rb +89 -130
  441. data/spec/integration/faces/documentation_spec.rb +36 -29
  442. data/spec/integration/file_serving/content_spec.rb +1 -2
  443. data/spec/integration/file_serving/fileset_spec.rb +1 -1
  444. data/spec/integration/file_serving/metadata_spec.rb +1 -2
  445. data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
  446. data/spec/integration/indirector/catalog/compiler_spec.rb +1 -2
  447. data/spec/integration/indirector/catalog/queue_spec.rb +3 -3
  448. data/spec/integration/indirector/direct_file_server_spec.rb +14 -10
  449. data/spec/integration/indirector/facts/facter_spec.rb +22 -0
  450. data/spec/integration/indirector/file_content/file_server_spec.rb +1 -1
  451. data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -1
  452. data/spec/integration/indirector/node/ldap_spec.rb +1 -1
  453. data/spec/integration/network/authconfig_spec.rb +238 -0
  454. data/spec/integration/network/formats_spec.rb +2 -4
  455. data/spec/integration/network/server/mongrel_spec.rb +2 -10
  456. data/spec/integration/network/server/webrick_spec.rb +1 -1
  457. data/spec/integration/node/environment_spec.rb +1 -1
  458. data/spec/integration/node/facts_spec.rb +2 -2
  459. data/spec/integration/node_spec.rb +2 -15
  460. data/spec/integration/parser/collector_spec.rb +2 -2
  461. data/spec/integration/parser/compiler_spec.rb +38 -10
  462. data/spec/integration/parser/functions/require_spec.rb +1 -1
  463. data/spec/integration/parser/functions_spec.rb +1 -1
  464. data/spec/integration/parser/parser_spec.rb +1 -1
  465. data/spec/integration/parser/ruby_manifest_spec.rb +1 -1
  466. data/spec/integration/parser/scope_spec.rb +608 -0
  467. data/spec/integration/provider/mailalias/aliases_spec.rb +1 -1
  468. data/spec/integration/provider/mount_spec.rb +1 -0
  469. data/spec/integration/provider/package_spec.rb +3 -3
  470. data/spec/integration/provider/service/init_spec.rb +2 -2
  471. data/spec/integration/provider/ssh_authorized_key_spec.rb +1 -1
  472. data/spec/integration/reference/providers_spec.rb +1 -1
  473. data/spec/integration/reports_spec.rb +1 -1
  474. data/spec/integration/resource/catalog_spec.rb +1 -2
  475. data/spec/integration/resource/type_collection_spec.rb +1 -1
  476. data/spec/integration/ssl/certificate_authority_spec.rb +1 -1
  477. data/spec/integration/ssl/certificate_request_spec.rb +1 -1
  478. data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -1
  479. data/spec/integration/ssl/host_spec.rb +1 -1
  480. data/spec/integration/transaction/report_spec.rb +1 -1
  481. data/spec/integration/transaction_spec.rb +2 -2
  482. data/spec/integration/type/exec_spec.rb +1 -1
  483. data/spec/integration/type/file_spec.rb +140 -158
  484. data/spec/integration/type/package_spec.rb +6 -2
  485. data/spec/integration/type/tidy_spec.rb +1 -1
  486. data/spec/integration/type_spec.rb +1 -1
  487. data/spec/integration/util/autoload_spec.rb +8 -14
  488. data/spec/integration/util/feature_spec.rb +1 -1
  489. data/spec/integration/util/rdoc/parser_spec.rb +11 -9
  490. data/spec/integration/util/settings_spec.rb +19 -6
  491. data/spec/integration/util/windows/security_spec.rb +23 -3
  492. data/spec/integration/util_spec.rb +3 -3
  493. data/spec/lib/puppet/indirector/indirector_testing/json.rb +6 -0
  494. data/spec/lib/puppet/indirector_testing.rb +27 -0
  495. data/spec/lib/puppet_spec/compiler.rb +2 -2
  496. data/spec/lib/puppet_spec/database.rb +1 -1
  497. data/spec/lib/puppet_spec/files.rb +4 -4
  498. data/spec/lib/puppet_spec/matchers.rb +26 -24
  499. data/spec/lib/puppet_spec/modules.rb +1 -1
  500. data/spec/lib/puppet_spec/settings.rb +16 -0
  501. data/spec/shared_behaviours/file_server_terminus.rb +2 -2
  502. data/spec/shared_behaviours/file_serving.rb +10 -15
  503. data/spec/shared_behaviours/file_serving_model.rb +2 -6
  504. data/spec/shared_contexts/platform.rb +0 -8
  505. data/spec/spec_helper.rb +14 -15
  506. data/spec/unit/agent/disabler_spec.rb +64 -0
  507. data/spec/unit/agent/locker_spec.rb +31 -36
  508. data/spec/unit/agent_spec.rb +79 -26
  509. data/spec/unit/application/agent_spec.rb +66 -39
  510. data/spec/unit/application/apply_spec.rb +46 -36
  511. data/spec/unit/application/cert_spec.rb +1 -5
  512. data/spec/unit/application/certificate_spec.rb +1 -1
  513. data/spec/unit/application/config_spec.rb +1 -1
  514. data/spec/unit/application/describe_spec.rb +1 -5
  515. data/spec/unit/application/device_spec.rb +22 -12
  516. data/spec/unit/application/doc_spec.rb +37 -69
  517. data/spec/unit/application/face_base_spec.rb +10 -6
  518. data/spec/unit/application/facts_spec.rb +3 -3
  519. data/spec/unit/application/filebucket_spec.rb +7 -18
  520. data/spec/unit/application/indirection_base_spec.rb +11 -5
  521. data/spec/unit/application/inspect_spec.rb +3 -2
  522. data/spec/unit/application/kick_spec.rb +6 -22
  523. data/spec/unit/application/master_spec.rb +15 -39
  524. data/spec/unit/application/queue_spec.rb +2 -6
  525. data/spec/unit/application/resource_spec.rb +15 -12
  526. data/spec/unit/application/secret_agent_spec.rb +1 -1
  527. data/spec/unit/application_spec.rb +110 -123
  528. data/spec/unit/configurer/downloader_spec.rb +5 -5
  529. data/spec/unit/configurer/fact_handler_spec.rb +1 -40
  530. data/spec/unit/configurer/plugin_handler_spec.rb +11 -96
  531. data/spec/unit/configurer_spec.rb +61 -59
  532. data/spec/unit/daemon_spec.rb +26 -19
  533. data/spec/unit/data_binding_spec.rb +11 -0
  534. data/spec/unit/dsl/resource_api_spec.rb +2 -2
  535. data/spec/unit/dsl/resource_type_api_spec.rb +1 -1
  536. data/spec/unit/face/catalog_spec.rb +1 -1
  537. data/spec/unit/face/certificate_request_spec.rb +1 -1
  538. data/spec/unit/face/certificate_revocation_list_spec.rb +1 -1
  539. data/spec/unit/face/certificate_spec.rb +18 -1
  540. data/spec/unit/face/config_spec.rb +8 -1
  541. data/spec/unit/face/facts_spec.rb +1 -1
  542. data/spec/unit/face/file_spec.rb +1 -1
  543. data/spec/unit/face/help_spec.rb +39 -22
  544. data/spec/unit/face/instrumentation_data_spec.rb +1 -1
  545. data/spec/unit/face/instrumentation_listener_spec.rb +1 -1
  546. data/spec/unit/face/instrumentation_probe_spec.rb +1 -1
  547. data/spec/unit/face/key_spec.rb +1 -1
  548. data/spec/unit/face/module/build_spec.rb +68 -0
  549. data/spec/unit/face/module/install_spec.rb +46 -31
  550. data/spec/unit/face/module/list_spec.rb +18 -21
  551. data/spec/unit/face/module/search_spec.rb +87 -49
  552. data/spec/unit/face/module/uninstall_spec.rb +4 -4
  553. data/spec/unit/face/node_spec.rb +3 -3
  554. data/spec/unit/face/plugin_spec.rb +1 -1
  555. data/spec/unit/face/report_spec.rb +1 -1
  556. data/spec/unit/face/resource_spec.rb +1 -1
  557. data/spec/unit/face/resource_type_spec.rb +1 -1
  558. data/spec/unit/face/secret_agent_spec.rb +1 -1
  559. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  560. data/spec/unit/file_bucket/file_spec.rb +1 -1
  561. data/spec/unit/file_serving/base_spec.rb +1 -1
  562. data/spec/unit/file_serving/configuration/parser_spec.rb +1 -1
  563. data/spec/unit/file_serving/configuration_spec.rb +7 -21
  564. data/spec/unit/file_serving/content_spec.rb +1 -1
  565. data/spec/unit/file_serving/fileset_spec.rb +13 -13
  566. data/spec/unit/file_serving/metadata_spec.rb +29 -47
  567. data/spec/unit/file_serving/mount/file_spec.rb +1 -1
  568. data/spec/unit/file_serving/mount/modules_spec.rb +1 -1
  569. data/spec/unit/file_serving/mount/plugins_spec.rb +17 -4
  570. data/spec/unit/file_serving/mount_spec.rb +1 -1
  571. data/spec/unit/file_serving/terminus_helper_spec.rb +1 -1
  572. data/spec/unit/file_serving/terminus_selector_spec.rb +5 -5
  573. data/spec/unit/forge/errors_spec.rb +42 -0
  574. data/spec/unit/forge/repository_spec.rb +108 -31
  575. data/spec/unit/forge_spec.rb +17 -23
  576. data/spec/unit/indirector/active_record_spec.rb +1 -1
  577. data/spec/unit/indirector/catalog/active_record_spec.rb +11 -49
  578. data/spec/unit/indirector/catalog/compiler_spec.rb +18 -45
  579. data/spec/unit/indirector/catalog/json_spec.rb +12 -0
  580. data/spec/unit/indirector/catalog/queue_spec.rb +1 -1
  581. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  582. data/spec/unit/indirector/catalog/store_configs_spec.rb +1 -1
  583. data/spec/unit/indirector/catalog/yaml_spec.rb +1 -1
  584. data/spec/unit/indirector/certificate/ca_spec.rb +5 -6
  585. data/spec/unit/indirector/certificate/file_spec.rb +5 -6
  586. data/spec/unit/indirector/certificate/rest_spec.rb +6 -2
  587. data/spec/unit/indirector/certificate_request/ca_spec.rb +3 -3
  588. data/spec/unit/indirector/certificate_request/file_spec.rb +3 -3
  589. data/spec/unit/indirector/certificate_request/rest_spec.rb +1 -1
  590. data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +3 -4
  591. data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +4 -3
  592. data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +1 -1
  593. data/spec/unit/indirector/certificate_status/file_spec.rb +41 -31
  594. data/spec/unit/indirector/certificate_status/rest_spec.rb +1 -1
  595. data/spec/unit/indirector/code_spec.rb +1 -1
  596. data/spec/unit/indirector/data_binding/hiera_spec.rb +21 -0
  597. data/spec/unit/indirector/data_binding/none_spec.rb +28 -0
  598. data/spec/unit/indirector/direct_file_server_spec.rb +2 -2
  599. data/spec/unit/indirector/envelope_spec.rb +1 -1
  600. data/spec/unit/indirector/exec_spec.rb +1 -1
  601. data/spec/unit/indirector/face_spec.rb +1 -1
  602. data/spec/unit/indirector/facts/active_record_spec.rb +1 -1
  603. data/spec/unit/indirector/facts/couch_spec.rb +3 -3
  604. data/spec/unit/indirector/facts/facter_spec.rb +13 -20
  605. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +2 -2
  606. data/spec/unit/indirector/facts/inventory_service_spec.rb +2 -3
  607. data/spec/unit/indirector/facts/network_device_spec.rb +2 -9
  608. data/spec/unit/indirector/facts/rest_spec.rb +1 -1
  609. data/spec/unit/indirector/facts/store_configs_spec.rb +1 -1
  610. data/spec/unit/indirector/facts/yaml_spec.rb +2 -2
  611. data/spec/unit/indirector/file_bucket_file/file_spec.rb +2 -2
  612. data/spec/unit/indirector/file_bucket_file/rest_spec.rb +1 -1
  613. data/spec/unit/indirector/file_content/file_server_spec.rb +1 -1
  614. data/spec/unit/indirector/file_content/file_spec.rb +1 -1
  615. data/spec/unit/indirector/file_content/rest_spec.rb +7 -3
  616. data/spec/unit/indirector/file_metadata/file_server_spec.rb +1 -1
  617. data/spec/unit/indirector/file_metadata/file_spec.rb +3 -3
  618. data/spec/unit/indirector/file_metadata/rest_spec.rb +1 -1
  619. data/spec/unit/indirector/file_server_spec.rb +1 -1
  620. data/spec/unit/indirector/hiera_spec.rb +149 -0
  621. data/spec/unit/indirector/indirection_spec.rb +10 -29
  622. data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
  623. data/spec/unit/indirector/instrumentation_data/rest_spec.rb +1 -1
  624. data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
  625. data/spec/unit/indirector/instrumentation_listener/rest_spec.rb +1 -1
  626. data/spec/unit/indirector/instrumentation_probe/local_spec.rb +1 -1
  627. data/spec/unit/indirector/instrumentation_probe/rest_spec.rb +1 -1
  628. data/spec/unit/indirector/json_spec.rb +193 -0
  629. data/spec/unit/indirector/key/ca_spec.rb +5 -6
  630. data/spec/unit/indirector/key/file_spec.rb +10 -12
  631. data/spec/unit/indirector/ldap_spec.rb +3 -3
  632. data/spec/unit/indirector/memory_spec.rb +1 -1
  633. data/spec/unit/indirector/node/active_record_spec.rb +11 -7
  634. data/spec/unit/indirector/node/exec_spec.rb +12 -5
  635. data/spec/unit/indirector/node/ldap_spec.rb +173 -194
  636. data/spec/unit/indirector/node/memory_spec.rb +1 -1
  637. data/spec/unit/indirector/node/plain_spec.rb +16 -8
  638. data/spec/unit/indirector/node/rest_spec.rb +1 -1
  639. data/spec/unit/indirector/node/store_configs_spec.rb +1 -1
  640. data/spec/unit/indirector/node/yaml_spec.rb +1 -1
  641. data/spec/unit/indirector/none_spec.rb +33 -0
  642. data/spec/unit/indirector/plain_spec.rb +1 -1
  643. data/spec/unit/indirector/queue_spec.rb +1 -1
  644. data/spec/unit/indirector/report/processor_spec.rb +4 -4
  645. data/spec/unit/indirector/report/rest_spec.rb +3 -46
  646. data/spec/unit/indirector/report/yaml_spec.rb +3 -12
  647. data/spec/unit/indirector/request_spec.rb +238 -61
  648. data/spec/unit/indirector/resource/active_record_spec.rb +2 -2
  649. data/spec/unit/indirector/resource/ral_spec.rb +2 -2
  650. data/spec/unit/indirector/resource/rest_spec.rb +1 -1
  651. data/spec/unit/indirector/resource/store_configs_spec.rb +1 -1
  652. data/spec/unit/indirector/resource_type/parser_spec.rb +153 -53
  653. data/spec/unit/indirector/resource_type/rest_spec.rb +1 -1
  654. data/spec/unit/indirector/rest_spec.rb +350 -361
  655. data/spec/unit/indirector/run/local_spec.rb +2 -2
  656. data/spec/unit/indirector/run/rest_spec.rb +1 -1
  657. data/spec/unit/indirector/ssl_file_spec.rb +12 -10
  658. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  659. data/spec/unit/indirector/store_configs_spec.rb +1 -1
  660. data/spec/unit/indirector/terminus_spec.rb +1 -46
  661. data/spec/unit/indirector/yaml_spec.rb +36 -36
  662. data/spec/unit/indirector_spec.rb +1 -1
  663. data/spec/unit/interface/action_builder_spec.rb +1 -1
  664. data/spec/unit/interface/action_manager_spec.rb +1 -1
  665. data/spec/unit/interface/action_spec.rb +1 -1
  666. data/spec/unit/interface/documentation_spec.rb +3 -2
  667. data/spec/unit/interface/face_collection_spec.rb +19 -9
  668. data/spec/unit/interface/option_builder_spec.rb +9 -1
  669. data/spec/unit/interface/option_spec.rb +8 -0
  670. data/spec/unit/interface_spec.rb +49 -11
  671. data/spec/unit/module_spec.rb +95 -303
  672. data/spec/unit/module_tool/application_spec.rb +6 -6
  673. data/spec/unit/module_tool/applications/installer_spec.rb +131 -69
  674. data/spec/unit/module_tool/applications/searcher_spec.rb +37 -0
  675. data/spec/unit/module_tool/applications/uninstaller_spec.rb +27 -19
  676. data/spec/unit/module_tool/applications/unpacker_spec.rb +4 -10
  677. data/spec/unit/module_tool/applications/upgrader_spec.rb +1 -4
  678. data/spec/unit/module_tool/install_directory_spec.rb +70 -0
  679. data/spec/unit/module_tool_spec.rb +132 -1
  680. data/spec/unit/network/auth_config_parser_spec.rb +101 -0
  681. data/spec/unit/network/authconfig_spec.rb +54 -272
  682. data/spec/unit/network/authorization_spec.rb +20 -0
  683. data/spec/unit/network/authstore_spec.rb +17 -15
  684. data/spec/unit/network/format_handler_spec.rb +3 -3
  685. data/spec/unit/network/format_spec.rb +1 -1
  686. data/spec/unit/network/formats_spec.rb +28 -37
  687. data/spec/unit/network/http/api/v1_spec.rb +3 -3
  688. data/spec/unit/network/http/compression_spec.rb +3 -3
  689. data/spec/unit/network/http/connection_spec.rb +244 -0
  690. data/spec/unit/network/http/handler_spec.rb +4 -20
  691. data/spec/unit/network/http/mongrel/rest_spec.rb +12 -31
  692. data/spec/unit/network/http/mongrel_spec.rb +7 -37
  693. data/spec/unit/network/http/rack/rest_spec.rb +10 -44
  694. data/spec/unit/network/http/rack_spec.rb +2 -59
  695. data/spec/unit/network/http/webrick/rest_spec.rb +14 -4
  696. data/spec/unit/network/http/webrick_spec.rb +129 -193
  697. data/spec/unit/network/http_pool_spec.rb +6 -115
  698. data/spec/unit/network/http_spec.rb +1 -1
  699. data/spec/unit/network/resolver_spec.rb +207 -0
  700. data/spec/unit/network/rights_spec.rb +15 -115
  701. data/spec/unit/network/server_spec.rb +58 -166
  702. data/spec/unit/node/environment_spec.rb +7 -7
  703. data/spec/unit/node/facts_spec.rb +15 -30
  704. data/spec/unit/node_spec.rb +14 -26
  705. data/spec/unit/other/selinux_spec.rb +1 -1
  706. data/spec/unit/parameter/package_options_spec.rb +44 -0
  707. data/spec/unit/parameter/path_spec.rb +1 -1
  708. data/spec/unit/parameter/value_collection_spec.rb +1 -1
  709. data/spec/unit/parameter/value_spec.rb +1 -1
  710. data/spec/unit/parameter_spec.rb +1 -1
  711. data/spec/unit/parser/ast/arithmetic_operator_spec.rb +4 -2
  712. data/spec/unit/parser/ast/astarray_spec.rb +4 -2
  713. data/spec/unit/parser/ast/asthash_spec.rb +4 -2
  714. data/spec/unit/parser/ast/boolean_operator_spec.rb +4 -2
  715. data/spec/unit/parser/ast/casestatement_spec.rb +9 -5
  716. data/spec/unit/parser/ast/collection_spec.rb +2 -2
  717. data/spec/unit/parser/ast/collexpr_spec.rb +4 -2
  718. data/spec/unit/parser/ast/comparison_operator_spec.rb +5 -2
  719. data/spec/unit/parser/ast/definition_spec.rb +1 -1
  720. data/spec/unit/parser/ast/function_spec.rb +3 -3
  721. data/spec/unit/parser/ast/hostclass_spec.rb +1 -1
  722. data/spec/unit/parser/ast/ifstatement_spec.rb +4 -2
  723. data/spec/unit/parser/ast/in_operator_spec.rb +4 -2
  724. data/spec/unit/parser/ast/leaf_spec.rb +66 -39
  725. data/spec/unit/parser/ast/match_operator_spec.rb +4 -2
  726. data/spec/unit/parser/ast/minus_spec.rb +4 -2
  727. data/spec/unit/parser/ast/node_spec.rb +1 -1
  728. data/spec/unit/parser/ast/nop_spec.rb +1 -1
  729. data/spec/unit/parser/ast/not_spec.rb +4 -2
  730. data/spec/unit/parser/ast/relationship_spec.rb +2 -2
  731. data/spec/unit/parser/ast/resource_defaults_spec.rb +2 -2
  732. data/spec/unit/parser/ast/resource_override_spec.rb +2 -2
  733. data/spec/unit/parser/ast/resource_reference_spec.rb +5 -3
  734. data/spec/unit/parser/ast/resource_spec.rb +5 -32
  735. data/spec/unit/parser/ast/selector_spec.rb +56 -106
  736. data/spec/unit/parser/ast/vardef_spec.rb +4 -2
  737. data/spec/unit/parser/ast_spec.rb +22 -51
  738. data/spec/unit/parser/collector_spec.rb +2 -2
  739. data/spec/unit/parser/compiler_spec.rb +89 -42
  740. data/spec/unit/parser/files_spec.rb +81 -10
  741. data/spec/unit/parser/functions/create_resources_spec.rb +5 -4
  742. data/spec/unit/parser/functions/defined_spec.rb +2 -2
  743. data/spec/unit/parser/functions/extlookup_spec.rb +9 -8
  744. data/spec/unit/parser/functions/fail_spec.rb +28 -0
  745. data/spec/unit/parser/functions/file_spec.rb +55 -0
  746. data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -12
  747. data/spec/unit/parser/functions/generate_spec.rb +54 -3
  748. data/spec/unit/parser/functions/include_spec.rb +19 -2
  749. data/spec/unit/parser/functions/inline_template_spec.rb +9 -20
  750. data/spec/unit/parser/functions/realize_spec.rb +4 -4
  751. data/spec/unit/parser/functions/regsubst_spec.rb +4 -2
  752. data/spec/unit/parser/functions/require_spec.rb +5 -14
  753. data/spec/unit/parser/functions/search_spec.rb +23 -0
  754. data/spec/unit/parser/functions/shellquote_spec.rb +31 -38
  755. data/spec/unit/parser/functions/split_spec.rb +4 -2
  756. data/spec/unit/parser/functions/sprintf_spec.rb +4 -2
  757. data/spec/unit/parser/functions/tag_spec.rb +4 -3
  758. data/spec/unit/parser/functions/template_spec.rb +45 -27
  759. data/spec/unit/parser/functions/versioncmp_spec.rb +4 -2
  760. data/spec/unit/parser/functions_spec.rb +14 -22
  761. data/spec/unit/parser/lexer_spec.rb +10 -134
  762. data/spec/unit/parser/parser_spec.rb +126 -35
  763. data/spec/unit/parser/relationship_spec.rb +1 -25
  764. data/spec/unit/parser/resource_spec.rb +15 -79
  765. data/spec/unit/parser/scope_spec.rb +175 -602
  766. data/spec/unit/parser/templatewrapper_spec.rb +8 -25
  767. data/spec/unit/parser/type_loader_spec.rb +37 -21
  768. data/spec/unit/property/ensure_spec.rb +1 -1
  769. data/spec/unit/property/keyvalue_spec.rb +1 -1
  770. data/spec/unit/property/list_spec.rb +1 -1
  771. data/spec/unit/property/ordered_list_spec.rb +1 -1
  772. data/spec/unit/property_spec.rb +1 -1
  773. data/spec/unit/{puppet/provider → provider}/README.markdown +0 -0
  774. data/spec/unit/provider/augeas/augeas_spec.rb +88 -1
  775. data/spec/unit/provider/cisco_spec.rb +1 -1
  776. data/spec/unit/provider/command_spec.rb +62 -0
  777. data/spec/unit/provider/confine/exists_spec.rb +8 -1
  778. data/spec/unit/provider/confine/false_spec.rb +1 -1
  779. data/spec/unit/provider/confine/feature_spec.rb +1 -1
  780. data/spec/unit/provider/confine/true_spec.rb +1 -1
  781. data/spec/unit/provider/confine/variable_spec.rb +1 -1
  782. data/spec/unit/provider/confine_collection_spec.rb +1 -1
  783. data/spec/unit/provider/confine_spec.rb +1 -1
  784. data/spec/unit/provider/confiner_spec.rb +1 -1
  785. data/spec/unit/provider/cron/crontab_spec.rb +116 -0
  786. data/spec/unit/provider/exec/posix_spec.rb +99 -12
  787. data/spec/unit/provider/exec/shell_spec.rb +1 -1
  788. data/spec/unit/provider/exec/windows_spec.rb +1 -1
  789. data/spec/unit/provider/exec_spec.rb +1 -1
  790. data/spec/unit/provider/file/posix_spec.rb +1 -1
  791. data/spec/unit/provider/file/windows_spec.rb +30 -30
  792. data/spec/unit/provider/group/groupadd_spec.rb +31 -37
  793. data/spec/unit/provider/group/ldap_spec.rb +1 -1
  794. data/spec/unit/provider/group/pw_spec.rb +1 -1
  795. data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
  796. data/spec/unit/provider/host/parsed_spec.rb +1 -1
  797. data/spec/unit/provider/interface/cisco_spec.rb +1 -1
  798. data/spec/unit/provider/ldap_spec.rb +1 -1
  799. data/spec/unit/provider/macauthorization_spec.rb +1 -1
  800. data/spec/unit/provider/mcx/mcxcontent_spec.rb +1 -1
  801. data/spec/unit/provider/mount/parsed_spec.rb +18 -12
  802. data/spec/unit/provider/mount_spec.rb +1 -1
  803. data/spec/unit/provider/naginator_spec.rb +1 -1
  804. data/spec/unit/provider/nameservice/directoryservice_spec.rb +9 -29
  805. data/spec/unit/provider/network_device_spec.rb +1 -1
  806. data/spec/unit/provider/package/aix_spec.rb +1 -1
  807. data/spec/unit/provider/package/appdmg_spec.rb +1 -1
  808. data/spec/unit/provider/package/apt_spec.rb +1 -1
  809. data/spec/unit/provider/package/aptitude_spec.rb +38 -0
  810. data/spec/unit/provider/package/aptrpm_spec.rb +39 -0
  811. data/spec/unit/provider/package/dpkg_spec.rb +4 -4
  812. data/spec/unit/provider/package/freebsd_spec.rb +3 -3
  813. data/spec/unit/provider/package/gem_spec.rb +1 -1
  814. data/spec/unit/provider/package/hpux_spec.rb +1 -1
  815. data/spec/unit/provider/package/macports_spec.rb +27 -10
  816. data/spec/unit/provider/package/msi_spec.rb +29 -14
  817. data/spec/unit/provider/package/nim_spec.rb +1 -1
  818. data/spec/unit/provider/package/openbsd_spec.rb +3 -3
  819. data/spec/unit/provider/package/pacman_spec.rb +109 -81
  820. data/spec/unit/provider/package/pip_spec.rb +1 -1
  821. data/spec/unit/provider/package/pkg_spec.rb +205 -97
  822. data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
  823. data/spec/unit/provider/package/pkgin_spec.rb +176 -0
  824. data/spec/unit/provider/package/pkgutil_spec.rb +64 -10
  825. data/spec/unit/provider/package/rpm_spec.rb +58 -0
  826. data/spec/unit/provider/package/sun_spec.rb +122 -0
  827. data/spec/unit/provider/package/up2date_spec.rb +24 -0
  828. data/spec/unit/provider/package/windows/exe_package_spec.rb +99 -0
  829. data/spec/unit/provider/package/windows/msi_package_spec.rb +115 -0
  830. data/spec/unit/provider/package/windows/package_spec.rb +126 -0
  831. data/spec/unit/provider/package/windows_spec.rb +255 -0
  832. data/spec/unit/provider/package/yum_spec.rb +1 -1
  833. data/spec/unit/provider/package/zypper_spec.rb +1 -1
  834. data/spec/unit/provider/parsedfile_spec.rb +1 -1
  835. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +12 -15
  836. data/spec/unit/provider/selboolean_spec.rb +1 -1
  837. data/spec/unit/provider/selmodule-example.pp +0 -0
  838. data/spec/unit/provider/selmodule_spec.rb +1 -1
  839. data/spec/unit/provider/service/base_spec.rb +77 -0
  840. data/spec/unit/provider/service/daemontools_spec.rb +1 -1
  841. data/spec/unit/provider/service/debian_spec.rb +1 -1
  842. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  843. data/spec/unit/provider/service/gentoo_spec.rb +1 -1
  844. data/spec/unit/provider/service/init_spec.rb +1 -1
  845. data/spec/unit/provider/service/launchd_spec.rb +0 -17
  846. data/spec/unit/provider/service/redhat_spec.rb +12 -3
  847. data/spec/unit/provider/service/runit_spec.rb +2 -1
  848. data/spec/unit/provider/service/smf_spec.rb +16 -1
  849. data/spec/unit/provider/service/src_spec.rb +6 -6
  850. data/spec/unit/provider/service/systemd_spec.rb +18 -1
  851. data/spec/unit/provider/service/upstart_spec.rb +12 -7
  852. data/spec/unit/provider/service/windows_spec.rb +1 -1
  853. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
  854. data/spec/unit/provider/sshkey/parsed_spec.rb +42 -12
  855. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  856. data/spec/unit/provider/user/ldap_spec.rb +9 -23
  857. data/spec/unit/provider/user/pw_spec.rb +1 -1
  858. data/spec/unit/provider/user/user_role_add_spec.rb +5 -2
  859. data/spec/unit/provider/user/useradd_spec.rb +118 -146
  860. data/spec/unit/provider/user/windows_adsi_spec.rb +2 -24
  861. data/spec/unit/provider/vlan/cisco_spec.rb +1 -1
  862. data/spec/unit/provider/zfs/zfs_spec.rb +106 -0
  863. data/spec/unit/provider/zone/solaris_spec.rb +56 -34
  864. data/spec/unit/provider/zpool/zpool_spec.rb +213 -0
  865. data/spec/unit/provider_spec.rb +621 -16
  866. data/spec/unit/puppet_spec.rb +21 -9
  867. data/spec/unit/rails/host_spec.rb +1 -1
  868. data/spec/unit/rails/param_value_spec.rb +1 -1
  869. data/spec/unit/rails/resource_spec.rb +1 -1
  870. data/spec/unit/rails_spec.rb +70 -70
  871. data/spec/unit/relationship_spec.rb +1 -1
  872. data/spec/unit/reports/http_spec.rb +48 -15
  873. data/spec/unit/reports/rrdgraph_spec.rb +1 -1
  874. data/spec/unit/reports/store_spec.rb +1 -1
  875. data/spec/unit/reports/tagmail_spec.rb +1 -1
  876. data/spec/unit/reports_spec.rb +1 -1
  877. data/spec/unit/resource/catalog_spec.rb +8 -175
  878. data/spec/unit/resource/status_spec.rb +2 -2
  879. data/spec/unit/resource/type_collection_helper_spec.rb +1 -1
  880. data/spec/unit/resource/type_collection_spec.rb +72 -45
  881. data/spec/unit/resource/type_spec.rb +31 -33
  882. data/spec/unit/resource_spec.rb +163 -98
  883. data/spec/unit/run_spec.rb +7 -23
  884. data/spec/unit/settings/directory_setting_spec.rb +32 -0
  885. data/spec/unit/{util/settings → settings}/file_setting_spec.rb +14 -23
  886. data/spec/unit/settings/path_setting_spec.rb +30 -0
  887. data/spec/unit/settings/string_setting_spec.rb +75 -0
  888. data/spec/unit/settings_spec.rb +1583 -0
  889. data/spec/unit/simple_graph_spec.rb +19 -5
  890. data/spec/unit/ssl/base_spec.rb +2 -2
  891. data/spec/unit/ssl/certificate_authority/interface_spec.rb +7 -7
  892. data/spec/unit/ssl/certificate_authority_spec.rb +27 -53
  893. data/spec/unit/ssl/certificate_factory_spec.rb +1 -1
  894. data/spec/unit/ssl/certificate_request_spec.rb +2 -4
  895. data/spec/unit/ssl/certificate_revocation_list_spec.rb +3 -3
  896. data/spec/unit/ssl/certificate_spec.rb +1 -1
  897. data/spec/unit/ssl/configuration_spec.rb +60 -0
  898. data/spec/unit/ssl/host_spec.rb +37 -89
  899. data/spec/unit/ssl/inventory_spec.rb +13 -20
  900. data/spec/unit/ssl/key_spec.rb +11 -9
  901. data/spec/unit/status_spec.rb +1 -7
  902. data/spec/unit/transaction/event_manager_spec.rb +1 -1
  903. data/spec/unit/transaction/event_spec.rb +6 -6
  904. data/spec/unit/transaction/report_spec.rb +1 -1
  905. data/spec/unit/transaction/resource_harness_spec.rb +2 -2
  906. data/spec/unit/transaction_spec.rb +8 -8
  907. data/spec/unit/{puppet/type → type}/README.markdown +0 -0
  908. data/spec/unit/type/augeas_spec.rb +2 -2
  909. data/spec/unit/type/component_spec.rb +1 -1
  910. data/spec/unit/type/computer_spec.rb +1 -1
  911. data/spec/unit/type/cron_spec.rb +1 -1
  912. data/spec/unit/type/exec_spec.rb +40 -12
  913. data/spec/unit/type/file/checksum_spec.rb +1 -1
  914. data/spec/unit/type/file/content_spec.rb +9 -6
  915. data/spec/unit/type/file/ctime_spec.rb +1 -1
  916. data/spec/unit/type/file/ensure_spec.rb +1 -1
  917. data/spec/unit/type/file/group_spec.rb +1 -1
  918. data/spec/unit/type/file/mode_spec.rb +1 -1
  919. data/spec/unit/type/file/mtime_spec.rb +1 -1
  920. data/spec/unit/type/file/owner_spec.rb +1 -1
  921. data/spec/unit/type/file/selinux_spec.rb +1 -1
  922. data/spec/unit/type/file/source_spec.rb +14 -13
  923. data/spec/unit/type/file/type_spec.rb +1 -1
  924. data/spec/unit/type/file_spec.rb +39 -87
  925. data/spec/unit/type/filebucket_spec.rb +1 -1
  926. data/spec/unit/type/group_spec.rb +5 -5
  927. data/spec/unit/type/host_spec.rb +1 -1
  928. data/spec/unit/type/interface_spec.rb +1 -1
  929. data/spec/unit/type/macauthorization_spec.rb +1 -1
  930. data/spec/unit/type/mailalias_spec.rb +21 -0
  931. data/spec/unit/type/maillist_spec.rb +1 -1
  932. data/spec/unit/type/mcx_spec.rb +1 -1
  933. data/spec/unit/type/mount_spec.rb +2 -2
  934. data/spec/unit/type/nagios_spec.rb +1 -1
  935. data/spec/unit/type/noop_metaparam_spec.rb +3 -3
  936. data/spec/unit/type/package_spec.rb +1 -1
  937. data/spec/unit/type/resources_spec.rb +2 -2
  938. data/spec/unit/type/schedule_spec.rb +297 -39
  939. data/spec/unit/type/scheduled_task_spec.rb +3 -3
  940. data/spec/unit/type/selboolean_spec.rb +1 -1
  941. data/spec/unit/type/selmodule_spec.rb +1 -1
  942. data/spec/unit/type/service_spec.rb +1 -1
  943. data/spec/unit/type/ssh_authorized_key_spec.rb +3 -3
  944. data/spec/unit/type/sshkey_spec.rb +1 -1
  945. data/spec/unit/type/stage_spec.rb +1 -1
  946. data/spec/unit/type/tidy_spec.rb +1 -1
  947. data/spec/unit/type/user_spec.rb +1 -1
  948. data/spec/unit/type/vlan_spec.rb +1 -1
  949. data/spec/unit/type/whit_spec.rb +1 -1
  950. data/spec/unit/type/yumrepo_spec.rb +243 -0
  951. data/spec/unit/type/zfs_spec.rb +8 -6
  952. data/spec/unit/type/zone_spec.rb +41 -36
  953. data/spec/unit/type/zpool_spec.rb +1 -1
  954. data/spec/unit/type_spec.rb +180 -31
  955. data/spec/unit/util/adsi_spec.rb +8 -23
  956. data/spec/unit/util/autoload_spec.rb +181 -45
  957. data/spec/unit/util/backups_spec.rb +1 -1
  958. data/spec/unit/util/cache_accumulator_spec.rb +1 -1
  959. data/spec/unit/util/cacher_spec.rb +1 -1
  960. data/spec/unit/util/checksums_spec.rb +1 -1
  961. data/spec/unit/util/command_line_spec.rb +114 -108
  962. data/spec/unit/util/command_line_utils/puppet_option_parser_spec.rb +129 -0
  963. data/spec/unit/util/config_timeout_spec.rb +57 -0
  964. data/spec/unit/util/constant_inflector_spec.rb +13 -23
  965. data/spec/unit/util/diff_spec.rb +5 -4
  966. data/spec/unit/util/errors_spec.rb +1 -1
  967. data/spec/unit/util/execution_spec.rb +532 -28
  968. data/spec/unit/util/execution_stub_spec.rb +4 -4
  969. data/spec/unit/util/feature_spec.rb +12 -13
  970. data/spec/unit/util/filetype_spec.rb +9 -9
  971. data/spec/unit/util/inline_docs_spec.rb +1 -1
  972. data/spec/unit/util/instrumentation/data_spec.rb +1 -1
  973. data/spec/unit/util/instrumentation/indirection_probe_spec.rb +1 -1
  974. data/spec/unit/util/instrumentation/instrumentable_spec.rb +1 -1
  975. data/spec/unit/util/instrumentation/listener_spec.rb +1 -1
  976. data/spec/unit/util/instrumentation_spec.rb +1 -1
  977. data/spec/unit/util/json_lockfile_spec.rb +29 -0
  978. data/spec/unit/util/ldap/connection_spec.rb +11 -15
  979. data/spec/unit/util/ldap/generator_spec.rb +1 -1
  980. data/spec/unit/util/ldap/manager_spec.rb +14 -23
  981. data/spec/unit/util/loadedfile_spec.rb +1 -1
  982. data/spec/unit/util/lockfile_spec.rb +76 -0
  983. data/spec/unit/util/log/destinations_spec.rb +11 -28
  984. data/spec/unit/util/log_spec.rb +6 -6
  985. data/spec/unit/util/logging_spec.rb +43 -11
  986. data/spec/unit/util/metric_spec.rb +4 -3
  987. data/spec/unit/util/monkey_patches/lines_spec.rb +83 -0
  988. data/spec/unit/util/monkey_patches_spec.rb +91 -28
  989. data/spec/unit/util/nagios_maker_spec.rb +1 -1
  990. data/spec/unit/util/network_device/cisco/device_spec.rb +3 -3
  991. data/spec/unit/util/network_device/cisco/facts_spec.rb +1 -1
  992. data/spec/unit/util/network_device/cisco/interface_spec.rb +1 -1
  993. data/spec/unit/util/network_device/config_spec.rb +1 -1
  994. data/spec/unit/util/network_device/ipcalc_spec.rb +1 -1
  995. data/spec/unit/util/network_device/transport/base_spec.rb +1 -1
  996. data/spec/unit/util/network_device/transport/ssh_spec.rb +2 -2
  997. data/spec/unit/util/network_device/transport/telnet_spec.rb +1 -1
  998. data/spec/unit/util/network_device_spec.rb +1 -1
  999. data/spec/unit/util/package_spec.rb +1 -1
  1000. data/spec/unit/util/pidlock_spec.rb +179 -0
  1001. data/spec/unit/util/posix_spec.rb +2 -2
  1002. data/spec/unit/util/pson_spec.rb +23 -9
  1003. data/spec/unit/util/queue/stomp_spec.rb +10 -13
  1004. data/spec/unit/util/queue_spec.rb +2 -2
  1005. data/spec/unit/util/rdoc/parser_spec.rb +11 -9
  1006. data/spec/unit/util/rdoc_spec.rb +9 -3
  1007. data/spec/unit/util/reference_serializer_spec.rb +1 -1
  1008. data/spec/unit/util/reference_spec.rb +1 -1
  1009. data/spec/unit/util/resource_template_spec.rb +1 -1
  1010. data/spec/unit/util/retryaction_spec.rb +1 -1
  1011. data/spec/unit/util/rubygems_spec.rb +66 -0
  1012. data/spec/unit/util/run_mode_spec.rb +4 -9
  1013. data/spec/unit/util/selinux_spec.rb +33 -25
  1014. data/spec/unit/util/storage_spec.rb +2 -18
  1015. data/spec/unit/util/suidmanager_spec.rb +11 -4
  1016. data/spec/unit/util/symbolic_file_mode_spec.rb +1 -1
  1017. data/spec/unit/util/tagging_spec.rb +1 -1
  1018. data/spec/unit/util/terminal_spec.rb +1 -1
  1019. data/spec/unit/util/user_attr_spec.rb +1 -1
  1020. data/spec/unit/util/warnings_spec.rb +1 -1
  1021. data/spec/unit/util/windows/registry_spec.rb +86 -0
  1022. data/spec/unit/util/zaml_spec.rb +30 -146
  1023. data/spec/unit/util_spec.rb +148 -440
  1024. data/spec/watchr.rb +6 -2
  1025. data/tasks/rake/apple.rake +176 -0
  1026. data/tasks/rake/gem.rake +6 -5
  1027. data/tasks/rake/manpages.rake +8 -1
  1028. data/tasks/rake/metrics.rake +11 -3
  1029. data/tasks/rake/parser.rake +5 -0
  1030. data/{ext/osx → tasks/rake/templates}/prototype.plist.erb +0 -0
  1031. metadata +293 -580
  1032. data/bin/filebucket +0 -7
  1033. data/bin/pi +0 -5
  1034. data/bin/puppetca +0 -4
  1035. data/bin/puppetd +0 -4
  1036. data/bin/puppetdoc +0 -4
  1037. data/bin/puppetmasterd +0 -4
  1038. data/bin/puppetqd +0 -4
  1039. data/bin/puppetrun +0 -5
  1040. data/bin/ralsh +0 -4
  1041. data/ext/build_defaults.yaml +0 -19
  1042. data/ext/debian/README.Debian +0 -8
  1043. data/ext/debian/README.source +0 -2
  1044. data/ext/debian/TODO.Debian +0 -1
  1045. data/ext/debian/changelog.erb +0 -1104
  1046. data/ext/debian/compat +0 -1
  1047. data/ext/debian/control +0 -142
  1048. data/ext/debian/copyright +0 -361
  1049. data/ext/debian/docs +0 -1
  1050. data/ext/debian/fileserver.conf +0 -17
  1051. data/ext/debian/puppet-common.dirs +0 -8
  1052. data/ext/debian/puppet-common.install +0 -3
  1053. data/ext/debian/puppet-common.lintian-overrides +0 -7
  1054. data/ext/debian/puppet-common.manpages +0 -2
  1055. data/ext/debian/puppet-common.postinst +0 -35
  1056. data/ext/debian/puppet-common.postrm +0 -32
  1057. data/ext/debian/puppet-el.dirs +0 -1
  1058. data/ext/debian/puppet-el.emacsen-install +0 -25
  1059. data/ext/debian/puppet-el.emacsen-remove +0 -11
  1060. data/ext/debian/puppet-el.emacsen-startup +0 -9
  1061. data/ext/debian/puppet-el.install +0 -1
  1062. data/ext/debian/puppet-testsuite.install +0 -3
  1063. data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
  1064. data/ext/debian/puppet.NEWS +0 -86
  1065. data/ext/debian/puppet.conf +0 -14
  1066. data/ext/debian/puppet.default +0 -7
  1067. data/ext/debian/puppet.dirs +0 -1
  1068. data/ext/debian/puppet.init +0 -118
  1069. data/ext/debian/puppet.install +0 -4
  1070. data/ext/debian/puppet.lintian-overrides +0 -3
  1071. data/ext/debian/puppet.logrotate +0 -11
  1072. data/ext/debian/puppet.manpages +0 -36
  1073. data/ext/debian/puppet.postinst +0 -20
  1074. data/ext/debian/puppet.postrm +0 -20
  1075. data/ext/debian/puppet.preinst +0 -20
  1076. data/ext/debian/puppetmaster-common.install +0 -5
  1077. data/ext/debian/puppetmaster-common.manpages +0 -5
  1078. data/ext/debian/puppetmaster-common.puppetqd.default +0 -27
  1079. data/ext/debian/puppetmaster-common.puppetqd.init +0 -84
  1080. data/ext/debian/puppetmaster-passenger.dirs +0 -4
  1081. data/ext/debian/puppetmaster-passenger.postinst +0 -66
  1082. data/ext/debian/puppetmaster-passenger.postrm +0 -33
  1083. data/ext/debian/puppetmaster.NEWS +0 -13
  1084. data/ext/debian/puppetmaster.README.debian +0 -16
  1085. data/ext/debian/puppetmaster.default +0 -38
  1086. data/ext/debian/puppetmaster.dirs +0 -1
  1087. data/ext/debian/puppetmaster.init +0 -158
  1088. data/ext/debian/puppetmaster.install +0 -1
  1089. data/ext/debian/puppetmaster.lintian-overrides +0 -3
  1090. data/ext/debian/puppetmaster.manpages +0 -1
  1091. data/ext/debian/puppetmaster.postinst +0 -20
  1092. data/ext/debian/puppetmaster.postrm +0 -5
  1093. data/ext/debian/puppetmaster.preinst +0 -22
  1094. data/ext/debian/rules +0 -127
  1095. data/ext/debian/source/format +0 -1
  1096. data/ext/debian/source/options +0 -1
  1097. data/ext/debian/vim-puppet.README.Debian +0 -13
  1098. data/ext/debian/vim-puppet.dirs +0 -3
  1099. data/ext/debian/vim-puppet.yaml +0 -5
  1100. data/ext/debian/watch +0 -2
  1101. data/ext/osx/file_mapping.yaml +0 -38
  1102. data/ext/osx/preflight.erb +0 -37
  1103. data/ext/packaging/Gemfile +0 -8
  1104. data/ext/packaging/Gemfile.lock +0 -28
  1105. data/ext/packaging/LICENSE +0 -17
  1106. data/ext/packaging/README-Solaris.md +0 -117
  1107. data/ext/packaging/README.md +0 -1074
  1108. data/ext/packaging/lib/packaging.rb +0 -21
  1109. data/ext/packaging/lib/packaging/config.rb +0 -277
  1110. data/ext/packaging/lib/packaging/config/params.rb +0 -175
  1111. data/ext/packaging/lib/packaging/tar.rb +0 -186
  1112. data/ext/packaging/lib/packaging/util.rb +0 -44
  1113. data/ext/packaging/lib/packaging/util/date.rb +0 -15
  1114. data/ext/packaging/lib/packaging/util/file.rb +0 -60
  1115. data/ext/packaging/lib/packaging/util/jira.rb +0 -83
  1116. data/ext/packaging/lib/packaging/util/net.rb +0 -16
  1117. data/ext/packaging/lib/packaging/util/rake_utils.rb +0 -57
  1118. data/ext/packaging/lib/packaging/util/serialization.rb +0 -19
  1119. data/ext/packaging/lib/packaging/util/tool.rb +0 -30
  1120. data/ext/packaging/lib/packaging/util/version.rb +0 -300
  1121. data/ext/packaging/packaging.rake +0 -50
  1122. data/ext/packaging/spec/fixtures/config/ext/build_defaults.yaml +0 -2
  1123. data/ext/packaging/spec/fixtures/config/ext/project_data.yaml +0 -2
  1124. data/ext/packaging/spec/fixtures/config/params.yaml +0 -2
  1125. data/ext/packaging/spec/fixtures/util/pre_tasks.yaml +0 -4
  1126. data/ext/packaging/spec/lib/packaging/config_spec.rb +0 -330
  1127. data/ext/packaging/spec/lib/packaging/tar_spec.rb +0 -122
  1128. data/ext/packaging/spec/lib/packaging/util/file_spec.rb +0 -48
  1129. data/ext/packaging/spec/lib/packaging/util/jira_spec.rb +0 -50
  1130. data/ext/packaging/spec/lib/packaging/util/net_spec.rb +0 -23
  1131. data/ext/packaging/spec/lib/packaging/util/rake_utils_spec.rb +0 -70
  1132. data/ext/packaging/spec/lib/packaging/util/version_spec.rb +0 -67
  1133. data/ext/packaging/spec/lib/packaging_spec.rb +0 -19
  1134. data/ext/packaging/spec/spec_helper.rb +0 -22
  1135. data/ext/packaging/spec/tasks/00_utils_spec.rb +0 -248
  1136. data/ext/packaging/static_artifacts/PackageInfo.plist +0 -3
  1137. data/ext/packaging/tasks/00_utils.rake +0 -402
  1138. data/ext/packaging/tasks/30_metrics.rake +0 -33
  1139. data/ext/packaging/tasks/apple.rake +0 -267
  1140. data/ext/packaging/tasks/build.rake +0 -12
  1141. data/ext/packaging/tasks/clean.rake +0 -5
  1142. data/ext/packaging/tasks/deb.rake +0 -127
  1143. data/ext/packaging/tasks/deb_repos.rake +0 -128
  1144. data/ext/packaging/tasks/doc.rake +0 -20
  1145. data/ext/packaging/tasks/fetch.rake +0 -58
  1146. data/ext/packaging/tasks/gem.rake +0 -158
  1147. data/ext/packaging/tasks/ips.rake +0 -122
  1148. data/ext/packaging/tasks/jenkins.rake +0 -360
  1149. data/ext/packaging/tasks/jenkins_dynamic.rake +0 -123
  1150. data/ext/packaging/tasks/load_extras.rake +0 -21
  1151. data/ext/packaging/tasks/mock.rake +0 -290
  1152. data/ext/packaging/tasks/pe_deb.rake +0 -12
  1153. data/ext/packaging/tasks/pe_remote.rake +0 -41
  1154. data/ext/packaging/tasks/pe_rpm.rake +0 -13
  1155. data/ext/packaging/tasks/pe_ship.rake +0 -179
  1156. data/ext/packaging/tasks/pe_sign.rake +0 -47
  1157. data/ext/packaging/tasks/pe_tar.rake +0 -5
  1158. data/ext/packaging/tasks/release.rake +0 -91
  1159. data/ext/packaging/tasks/remote_build.rake +0 -158
  1160. data/ext/packaging/tasks/retrieve.rake +0 -45
  1161. data/ext/packaging/tasks/rpm.rake +0 -71
  1162. data/ext/packaging/tasks/rpm_repos.rake +0 -139
  1163. data/ext/packaging/tasks/ship.rake +0 -192
  1164. data/ext/packaging/tasks/sign.rake +0 -164
  1165. data/ext/packaging/tasks/tag.rake +0 -8
  1166. data/ext/packaging/tasks/tar.rake +0 -34
  1167. data/ext/packaging/tasks/tickets.rake +0 -449
  1168. data/ext/packaging/tasks/update.rake +0 -16
  1169. data/ext/packaging/tasks/vendor_gems.rake +0 -110
  1170. data/ext/packaging/tasks/version.rake +0 -33
  1171. data/ext/packaging/tasks/z_data_dump.rake +0 -65
  1172. data/ext/packaging/templates/README +0 -1
  1173. data/ext/packaging/templates/downstream.xml.erb +0 -45
  1174. data/ext/packaging/templates/packaging.xml.erb +0 -330
  1175. data/ext/packaging/templates/repo.xml.erb +0 -106
  1176. data/ext/project_data.yaml +0 -24
  1177. data/lib/puppet/file_system.rb +0 -3
  1178. data/lib/puppet/file_system/path_pattern.rb +0 -97
  1179. data/lib/puppet/indirector/certificate/disabled_ca.rb +0 -22
  1180. data/lib/puppet/indirector/certificate_request/disabled_ca.rb +0 -22
  1181. data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +0 -22
  1182. data/lib/puppet/indirector/errors.rb +0 -5
  1183. data/lib/puppet/indirector/inventory/yaml.rb +0 -81
  1184. data/lib/puppet/indirector/key/disabled_ca.rb +0 -22
  1185. data/lib/puppet/indirector/resource/validator.rb +0 -8
  1186. data/lib/puppet/network/handler.rb +0 -50
  1187. data/lib/puppet/network/handler/ca.rb +0 -61
  1188. data/lib/puppet/network/handler/filebucket.rb +0 -53
  1189. data/lib/puppet/network/handler/fileserver.rb +0 -732
  1190. data/lib/puppet/network/handler/master.rb +0 -87
  1191. data/lib/puppet/network/handler/report.rb +0 -82
  1192. data/lib/puppet/network/handler/runner.rb +0 -33
  1193. data/lib/puppet/network/handler/status.rb +0 -18
  1194. data/lib/puppet/network/http/rack/xmlrpc.rb +0 -65
  1195. data/lib/puppet/network/http_server.rb +0 -3
  1196. data/lib/puppet/network/http_server/mongrel.rb +0 -129
  1197. data/lib/puppet/network/rest_authconfig.rb +0 -102
  1198. data/lib/puppet/network/rest_authorization.rb +0 -23
  1199. data/lib/puppet/network/xmlrpc/processor.rb +0 -86
  1200. data/lib/puppet/network/xmlrpc/server.rb +0 -19
  1201. data/lib/puppet/network/xmlrpc/webrick_servlet.rb +0 -114
  1202. data/lib/puppet/node/inventory.rb +0 -7
  1203. data/lib/puppet/reference/network.rb +0 -39
  1204. data/lib/puppet/transportable.rb +0 -248
  1205. data/lib/puppet/util/autoload/file_cache.rb +0 -92
  1206. data/lib/puppet/util/file_locking.rb +0 -47
  1207. data/lib/puppet/util/settings.rb +0 -926
  1208. data/lib/puppet/util/settings/setting.rb +0 -94
  1209. data/lib/puppet/util/windows/sid.rb +0 -96
  1210. data/lib/puppet/vendor.rb +0 -55
  1211. data/lib/puppet/vendor/load_safe_yaml.rb +0 -1
  1212. data/lib/puppet/vendor/require_vendored.rb +0 -4
  1213. data/lib/puppet/vendor/safe_yaml/CHANGES.md +0 -104
  1214. data/lib/puppet/vendor/safe_yaml/Gemfile +0 -11
  1215. data/lib/puppet/vendor/safe_yaml/LICENSE.txt +0 -22
  1216. data/lib/puppet/vendor/safe_yaml/README.md +0 -179
  1217. data/lib/puppet/vendor/safe_yaml/Rakefile +0 -6
  1218. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml.rb +0 -253
  1219. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/deep.rb +0 -34
  1220. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/date.rb +0 -27
  1221. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/hexadecimal.rb +0 -12
  1222. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/sexagesimal.rb +0 -26
  1223. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_handler.rb +0 -92
  1224. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_resolver.rb +0 -52
  1225. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/resolver.rb +0 -94
  1226. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -17
  1227. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_hack.rb +0 -36
  1228. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_node_monkeypatch.rb +0 -43
  1229. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_resolver.rb +0 -38
  1230. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform.rb +0 -41
  1231. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_boolean.rb +0 -21
  1232. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_date.rb +0 -11
  1233. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_float.rb +0 -33
  1234. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_integer.rb +0 -25
  1235. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_nil.rb +0 -18
  1236. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_symbol.rb +0 -13
  1237. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/transformation_map.rb +0 -47
  1238. data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/version.rb +0 -3
  1239. data/lib/puppet/vendor/safe_yaml/run_specs_all_ruby_versions.sh +0 -21
  1240. data/lib/puppet/vendor/safe_yaml/safe_yaml.gemspec +0 -18
  1241. data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.2.yaml +0 -2
  1242. data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.3.yaml +0 -2
  1243. data/lib/puppet/vendor/safe_yaml/spec/psych_resolver_spec.rb +0 -10
  1244. data/lib/puppet/vendor/safe_yaml/spec/resolver_specs.rb +0 -250
  1245. data/lib/puppet/vendor/safe_yaml/spec/safe_yaml_spec.rb +0 -702
  1246. data/lib/puppet/vendor/safe_yaml/spec/spec_helper.rb +0 -18
  1247. data/lib/puppet/vendor/safe_yaml/spec/support/exploitable_back_door.rb +0 -29
  1248. data/lib/puppet/vendor/safe_yaml/spec/syck_resolver_spec.rb +0 -10
  1249. data/lib/puppet/vendor/safe_yaml/spec/transform/base64_spec.rb +0 -11
  1250. data/lib/puppet/vendor/safe_yaml/spec/transform/to_date_spec.rb +0 -34
  1251. data/lib/puppet/vendor/safe_yaml/spec/transform/to_float_spec.rb +0 -42
  1252. data/lib/puppet/vendor/safe_yaml/spec/transform/to_integer_spec.rb +0 -59
  1253. data/lib/puppet/vendor/safe_yaml/spec/transform/to_symbol_spec.rb +0 -49
  1254. data/man/man8/filebucket.8 +0 -81
  1255. data/man/man8/pi.8 +0 -51
  1256. data/man/man8/puppetca.8 +0 -97
  1257. data/man/man8/puppetd.8 +0 -154
  1258. data/man/man8/puppetdoc.8 +0 -113
  1259. data/man/man8/puppetmasterd.8 +0 -78
  1260. data/man/man8/puppetqd.8 +0 -55
  1261. data/man/man8/puppetrun.8 +0 -127
  1262. data/man/man8/ralsh.8 +0 -84
  1263. data/spec/integration/network/handler_spec.rb +0 -24
  1264. data/spec/integration/network/rest_authconfig_spec.rb +0 -164
  1265. data/spec/integration/util/file_locking_spec.rb +0 -56
  1266. data/spec/unit/agent_backward_compatibility_spec.rb +0 -152
  1267. data/spec/unit/file_system/path_pattern_spec.rb +0 -139
  1268. data/spec/unit/indirector/catalog/static_compiler_spec.rb +0 -194
  1269. data/spec/unit/indirector/certificate/disabled_ca_spec.rb +0 -33
  1270. data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +0 -33
  1271. data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +0 -33
  1272. data/spec/unit/indirector/inventory/yaml_spec.rb +0 -220
  1273. data/spec/unit/indirector/key/disabled_ca_spec.rb +0 -33
  1274. data/spec/unit/network/handler/ca_spec.rb +0 -87
  1275. data/spec/unit/network/handler/fileserver_spec.rb +0 -201
  1276. data/spec/unit/network/http/mongrel/xmlrpc_spec.rb +0 -0
  1277. data/spec/unit/network/http/rack/xmlrpc_spec.rb +0 -155
  1278. data/spec/unit/network/http/webrick/xmlrpc_spec.rb +0 -0
  1279. data/spec/unit/network/rest_authconfig_spec.rb +0 -142
  1280. data/spec/unit/other/transbucket_spec.rb +0 -184
  1281. data/spec/unit/other/transobject_spec.rb +0 -111
  1282. data/spec/unit/provider/zfs/solaris_spec.rb +0 -99
  1283. data/spec/unit/provider/zpool/solaris_spec.rb +0 -208
  1284. data/spec/unit/transportable_spec.rb +0 -0
  1285. data/spec/unit/util/autoload/file_cache_spec.rb +0 -158
  1286. data/spec/unit/util/file_locking_spec.rb +0 -159
  1287. data/spec/unit/util/settings_spec.rb +0 -1088
  1288. data/spec/unit/util/windows/sid_spec.rb +0 -100
  1289. data/test/README +0 -24
  1290. data/test/Rakefile +0 -96
  1291. data/test/data/failers/badclassnoparam +0 -10
  1292. data/test/data/failers/badclassparam +0 -10
  1293. data/test/data/failers/badcompnoparam +0 -9
  1294. data/test/data/failers/badcompparam +0 -9
  1295. data/test/data/failers/badtypeparam +0 -3
  1296. data/test/data/failers/noobjectrvalue +0 -1
  1297. data/test/data/providers/cron/crontab.allthree +0 -17
  1298. data/test/data/providers/cron/crontab.envNcomment +0 -12
  1299. data/test/data/providers/cron/crontab.envNname +0 -11
  1300. data/test/data/providers/cron/crontab.multirecords +0 -12
  1301. data/test/data/providers/cron/crontab_collections.yaml +0 -44
  1302. data/test/data/providers/cron/crontab_multiple_with_env.yaml +0 -54
  1303. data/test/data/providers/cron/examples/freebsd +0 -2
  1304. data/test/data/providers/cron/examples/one +0 -14
  1305. data/test/data/providers/cron/examples/openbsd +0 -20
  1306. data/test/data/providers/host/parsed/valid_hosts +0 -19
  1307. data/test/data/providers/mailalias/aliases/test1 +0 -28
  1308. data/test/data/providers/mount/parsed/aix.mount +0 -7
  1309. data/test/data/providers/mount/parsed/darwin.mount +0 -6
  1310. data/test/data/providers/mount/parsed/hpux.mount +0 -17
  1311. data/test/data/providers/mount/parsed/linux.mount +0 -5
  1312. data/test/data/providers/mount/parsed/solaris.mount +0 -6
  1313. data/test/data/providers/package/testpackages.yaml +0 -65
  1314. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +0 -7
  1315. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +0 -3
  1316. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys2 +0 -1
  1317. data/test/data/reports/1.yaml +0 -108
  1318. data/test/data/reports/2.yaml +0 -108
  1319. data/test/data/reports/tagmail_failers.conf +0 -3
  1320. data/test/data/reports/tagmail_passers.conf +0 -30
  1321. data/test/data/snippets/aliastest.pp +0 -16
  1322. data/test/data/snippets/append.pp +0 -11
  1323. data/test/data/snippets/argumentdefaults +0 -14
  1324. data/test/data/snippets/arithmetic_expression.pp +0 -8
  1325. data/test/data/snippets/arraytrailingcomma.pp +0 -3
  1326. data/test/data/snippets/casestatement.pp +0 -65
  1327. data/test/data/snippets/classheirarchy.pp +0 -15
  1328. data/test/data/snippets/classincludes.pp +0 -17
  1329. data/test/data/snippets/classpathtest +0 -11
  1330. data/test/data/snippets/collection.pp +0 -10
  1331. data/test/data/snippets/collection_override.pp +0 -8
  1332. data/test/data/snippets/collection_within_virtual_definitions.pp +0 -20
  1333. data/test/data/snippets/componentmetaparams.pp +0 -11
  1334. data/test/data/snippets/componentrequire.pp +0 -8
  1335. data/test/data/snippets/deepclassheirarchy.pp +0 -23
  1336. data/test/data/snippets/defineoverrides.pp +0 -17
  1337. data/test/data/snippets/emptyclass.pp +0 -9
  1338. data/test/data/snippets/emptyexec.pp +0 -3
  1339. data/test/data/snippets/emptyifelse.pp +0 -9
  1340. data/test/data/snippets/falsevalues.pp +0 -3
  1341. data/test/data/snippets/filecreate +0 -11
  1342. data/test/data/snippets/fqdefinition.pp +0 -5
  1343. data/test/data/snippets/fqparents.pp +0 -11
  1344. data/test/data/snippets/funccomma.pp +0 -5
  1345. data/test/data/snippets/hash.pp +0 -33
  1346. data/test/data/snippets/ifexpression.pp +0 -12
  1347. data/test/data/snippets/implicititeration +0 -15
  1348. data/test/data/snippets/multilinecomments.pp +0 -10
  1349. data/test/data/snippets/multipleclass.pp +0 -9
  1350. data/test/data/snippets/multipleinstances +0 -7
  1351. data/test/data/snippets/multisubs.pp +0 -13
  1352. data/test/data/snippets/namevartest +0 -9
  1353. data/test/data/snippets/scopetest +0 -13
  1354. data/test/data/snippets/selectorvalues.pp +0 -49
  1355. data/test/data/snippets/simpledefaults +0 -5
  1356. data/test/data/snippets/simpleselector +0 -38
  1357. data/test/data/snippets/singleary.pp +0 -19
  1358. data/test/data/snippets/singlequote.pp +0 -11
  1359. data/test/data/snippets/singleselector.pp +0 -22
  1360. data/test/data/snippets/subclass_name_duplication.pp +0 -11
  1361. data/test/data/snippets/tag.pp +0 -9
  1362. data/test/data/snippets/tagged.pp +0 -35
  1363. data/test/data/snippets/virtualresources.pp +0 -14
  1364. data/test/data/types/hosts/1 +0 -3
  1365. data/test/data/types/hosts/2 +0 -13
  1366. data/test/data/types/hosts/solaris +0 -5
  1367. data/test/data/types/mailalias/file1 +0 -183
  1368. data/test/data/types/mount/freebsd.fstab +0 -7
  1369. data/test/data/types/mount/linux.fstab +0 -12
  1370. data/test/data/types/mount/solaris.fstab +0 -12
  1371. data/test/data/types/port/1 +0 -533
  1372. data/test/data/types/port/darwin +0 -11866
  1373. data/test/data/types/ssh_authorized_key/1 +0 -2
  1374. data/test/data/types/yumrepos/fedora-devel.repo +0 -26
  1375. data/test/data/types/yumrepos/fedora.repo +0 -9
  1376. data/test/language/ast.rb +0 -90
  1377. data/test/language/ast/variable.rb +0 -25
  1378. data/test/language/functions.rb +0 -540
  1379. data/test/language/parser.rb +0 -739
  1380. data/test/language/scope.rb +0 -261
  1381. data/test/language/snippets.rb +0 -512
  1382. data/test/language/transportable.rb +0 -87
  1383. data/test/lib/puppettest.rb +0 -307
  1384. data/test/lib/puppettest/certificates.rb +0 -74
  1385. data/test/lib/puppettest/exetest.rb +0 -125
  1386. data/test/lib/puppettest/fakes.rb +0 -199
  1387. data/test/lib/puppettest/fileparsing.rb +0 -28
  1388. data/test/lib/puppettest/filetesting.rb +0 -221
  1389. data/test/lib/puppettest/parsertesting.rb +0 -424
  1390. data/test/lib/puppettest/railstesting.rb +0 -18
  1391. data/test/lib/puppettest/reporttesting.rb +0 -16
  1392. data/test/lib/puppettest/resourcetesting.rb +0 -54
  1393. data/test/lib/puppettest/runnable_test.rb +0 -43
  1394. data/test/lib/puppettest/servertest.rb +0 -77
  1395. data/test/lib/puppettest/support.rb +0 -8
  1396. data/test/lib/puppettest/support/assertions.rb +0 -69
  1397. data/test/lib/puppettest/support/helpers.rb +0 -18
  1398. data/test/lib/puppettest/support/resources.rb +0 -31
  1399. data/test/lib/puppettest/support/utils.rb +0 -141
  1400. data/test/lib/puppettest/testcase.rb +0 -24
  1401. data/test/lib/rake/puppet_test_loader.rb +0 -14
  1402. data/test/lib/rake/puppet_testtask.rb +0 -19
  1403. data/test/lib/stubba.rb +0 -2
  1404. data/test/network/authconfig.rb +0 -69
  1405. data/test/network/authorization.rb +0 -138
  1406. data/test/network/authstore.rb +0 -538
  1407. data/test/network/client_request.rb +0 -38
  1408. data/test/network/handler/fileserver.rb +0 -1266
  1409. data/test/network/handler/master.rb +0 -93
  1410. data/test/network/handler/report.rb +0 -47
  1411. data/test/network/handler/runner.rb +0 -20
  1412. data/test/network/rights.rb +0 -40
  1413. data/test/network/xmlrpc/processor.rb +0 -79
  1414. data/test/network/xmlrpc/server.rb +0 -26
  1415. data/test/network/xmlrpc/webrick_servlet.rb +0 -35
  1416. data/test/other/provider.rb +0 -90
  1417. data/test/other/puppet.rb +0 -85
  1418. data/test/other/relationships.rb +0 -91
  1419. data/test/other/report.rb +0 -135
  1420. data/test/other/transactions.rb +0 -395
  1421. data/test/puppet/defaults.rb +0 -65
  1422. data/test/rails/rails.rb +0 -24
  1423. data/test/rails/railsparameter.rb +0 -80
  1424. data/test/ral/manager/attributes.rb +0 -296
  1425. data/test/ral/manager/instances.rb +0 -88
  1426. data/test/ral/manager/manager.rb +0 -50
  1427. data/test/ral/manager/provider.rb +0 -84
  1428. data/test/ral/manager/type.rb +0 -361
  1429. data/test/ral/providers/cron/crontab.rb +0 -652
  1430. data/test/ral/providers/group.rb +0 -242
  1431. data/test/ral/providers/host/parsed.rb +0 -32
  1432. data/test/ral/providers/mailalias/aliases.rb +0 -55
  1433. data/test/ral/providers/nameservice.rb +0 -32
  1434. data/test/ral/providers/package.rb +0 -245
  1435. data/test/ral/providers/package/aptitude.rb +0 -83
  1436. data/test/ral/providers/package/aptrpm.rb +0 -100
  1437. data/test/ral/providers/parsedfile.rb +0 -695
  1438. data/test/ral/providers/port/parsed.rb +0 -232
  1439. data/test/ral/providers/provider.rb +0 -529
  1440. data/test/ral/providers/service/base.rb +0 -76
  1441. data/test/ral/providers/sshkey/parsed.rb +0 -112
  1442. data/test/ral/providers/user.rb +0 -586
  1443. data/test/ral/providers/user/useradd.rb +0 -233
  1444. data/test/ral/type/cron.rb +0 -505
  1445. data/test/ral/type/exec.rb +0 -717
  1446. data/test/ral/type/file.rb +0 -912
  1447. data/test/ral/type/file/target.rb +0 -346
  1448. data/test/ral/type/fileignoresource.rb +0 -265
  1449. data/test/ral/type/filesources.rb +0 -446
  1450. data/test/ral/type/host.rb +0 -180
  1451. data/test/ral/type/mailalias.rb +0 -45
  1452. data/test/ral/type/port.rb +0 -147
  1453. data/test/ral/type/resources.rb +0 -104
  1454. data/test/ral/type/service.rb +0 -38
  1455. data/test/ral/type/sshkey.rb +0 -148
  1456. data/test/ral/type/user.rb +0 -167
  1457. data/test/ral/type/yumrepo.rb +0 -116
  1458. data/test/ral/type/zone.rb +0 -447
  1459. data/test/test +0 -241
  1460. data/test/util/classgen.rb +0 -241
  1461. data/test/util/execution.rb +0 -33
  1462. data/test/util/fileparsing.rb +0 -721
  1463. data/test/util/inifile.rb +0 -138
  1464. data/test/util/instance_loader.rb +0 -52
  1465. data/test/util/log.rb +0 -219
  1466. data/test/util/metrics.rb +0 -72
  1467. data/test/util/package.rb +0 -25
  1468. data/test/util/pidlock.rb +0 -125
  1469. data/test/util/settings.rb +0 -773
  1470. data/test/util/storage.rb +0 -81
  1471. data/test/util/subclass_loader.rb +0 -89
  1472. data/test/util/utiltest.rb +0 -223
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env rspec
1
+ #! /usr/bin/env ruby -S rspec
2
2
  require 'spec_helper'
3
3
  require 'puppet/agent'
4
4
  require 'puppet/run'
@@ -116,35 +116,19 @@ describe Puppet::Run do
116
116
  end
117
117
 
118
118
  describe ".from_pson" do
119
- it "should read from a hash that represents the 'options' to initialize" do
119
+ it "should accept a hash of options, and pass them with symbolified keys to new" do
120
120
  options = {
121
121
  "tags" => "whatever",
122
122
  "background" => true,
123
- "ignoreschedules" => false,
124
123
  }
125
- run = Puppet::Run.from_pson(options)
126
124
 
127
- run.options.should == {
125
+ Puppet::Run.expects(:new).with({
128
126
  :tags => "whatever",
129
- :ignoreschedules => false,
130
- }
131
- run.background.should be_true
132
- end
127
+ :background => true,
128
+ :pluginsync => Puppet[:pluginsync]
129
+ })
133
130
 
134
- it "should read from a hash that follows the actual object structure" do
135
- hash = {"background" => true,
136
- "options" => {
137
- "tags" => [],
138
- "ignoreschedules" => false},
139
- "status" => "success"}
140
- run = Puppet::Run.from_pson(hash)
141
-
142
- run.options.should == {
143
- :tags => [],
144
- :ignoreschedules => false
145
- }
146
- run.background.should be_true
147
- run.status.should == 'success'
131
+ Puppet::Run.from_pson(options)
148
132
  end
149
133
  end
150
134
  end
@@ -0,0 +1,32 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+ require 'spec_helper'
3
+
4
+ require 'puppet/settings'
5
+ require 'puppet/settings/directory_setting'
6
+
7
+ describe Puppet::Settings::DirectorySetting do
8
+ DirectorySetting = Puppet::Settings::DirectorySetting
9
+
10
+ include PuppetSpec::Files
11
+
12
+ before do
13
+ @basepath = make_absolute("/somepath")
14
+ end
15
+
16
+ describe "when being converted to a resource" do
17
+ before do
18
+ @settings = mock 'settings'
19
+ @dir = Puppet::Settings::DirectorySetting.new(
20
+ :settings => @settings, :desc => "eh", :name => :mydir, :section => "mysect")
21
+ @settings.stubs(:value).with(:mydir).returns @basepath
22
+ end
23
+
24
+ it "should return :directory as its type" do
25
+ @dir.type.should == :directory
26
+ end
27
+
28
+
29
+
30
+ end
31
+ end
32
+
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env rspec
1
+ #! /usr/bin/env ruby -S rspec
2
2
  require 'spec_helper'
3
3
 
4
- require 'puppet/util/settings'
5
- require 'puppet/util/settings/file_setting'
4
+ require 'puppet/settings'
5
+ require 'puppet/settings/file_setting'
6
6
 
7
- describe Puppet::Util::Settings::FileSetting do
8
- FileSetting = Puppet::Util::Settings::FileSetting
7
+ describe Puppet::Settings::FileSetting do
8
+ FileSetting = Puppet::Settings::FileSetting
9
9
 
10
10
  include PuppetSpec::Files
11
11
 
@@ -124,13 +124,13 @@ describe Puppet::Util::Settings::FileSetting do
124
124
  describe "when being converted to a resource" do
125
125
  before do
126
126
  @settings = mock 'settings'
127
- @file = Puppet::Util::Settings::FileSetting.new(:settings => @settings, :desc => "eh", :name => :mydir, :section => "mysect")
128
- @settings.stubs(:value).with(:mydir).returns @basepath
127
+ @file = Puppet::Settings::FileSetting.new(:settings => @settings, :desc => "eh", :name => :myfile, :section => "mysect")
128
+ @file.stubs(:create_files?).returns true
129
+ @settings.stubs(:value).with(:myfile).returns @basepath
129
130
  end
130
131
 
131
- it "should skip files that cannot determine their types" do
132
- @file.expects(:type).returns nil
133
- @file.to_resource.should be_nil
132
+ it "should return :file as its type" do
133
+ @file.type.should == :file
134
134
  end
135
135
 
136
136
  it "should skip non-existent files if 'create_files' is not enabled" do
@@ -149,13 +149,13 @@ describe Puppet::Util::Settings::FileSetting do
149
149
 
150
150
  describe "on POSIX systems", :if => Puppet.features.posix? do
151
151
  it "should skip files in /dev" do
152
- @settings.stubs(:value).with(:mydir).returns "/dev/file"
152
+ @settings.stubs(:value).with(:myfile).returns "/dev/file"
153
153
  @file.to_resource.should be_nil
154
154
  end
155
155
  end
156
156
 
157
157
  it "should skip files whose paths are not strings" do
158
- @settings.stubs(:value).with(:mydir).returns :foo
158
+ @settings.stubs(:value).with(:myfile).returns :foo
159
159
  @file.to_resource.should be_nil
160
160
  end
161
161
 
@@ -166,7 +166,7 @@ describe Puppet::Util::Settings::FileSetting do
166
166
  end
167
167
 
168
168
  it "should fully qualified returned files if necessary (#795)" do
169
- @settings.stubs(:value).with(:mydir).returns "myfile"
169
+ @settings.stubs(:value).with(:myfile).returns "myfile"
170
170
  path = File.join(Dir.getwd, "myfile")
171
171
  # Dir.getwd can return windows paths with backslashes, so we normalize them using expand_path
172
172
  path = File.expand_path(path) if Puppet.features.microsoft_windows?
@@ -275,7 +275,7 @@ describe Puppet::Util::Settings::FileSetting do
275
275
  end
276
276
 
277
277
  it "should tag the resource with the setting name" do
278
- @file.to_resource.should be_tagged("mydir")
278
+ @file.to_resource.should be_tagged("myfile")
279
279
  end
280
280
 
281
281
  it "should tag the resource with 'settings'" do
@@ -286,14 +286,5 @@ describe Puppet::Util::Settings::FileSetting do
286
286
  @file.to_resource[:links].should == :follow
287
287
  end
288
288
  end
289
-
290
- describe "when munging a filename" do
291
- it "should preserve trailing slashes" do
292
- settings = mock 'settings'
293
- file = Puppet::Util::Settings::FileSetting.new(:settings => settings, :desc => "eh", :name => :mydir, :section => "mysect")
294
- path = @basepath + '/'
295
- file.munge(path).should == path
296
- end
297
- end
298
289
  end
299
290
 
@@ -0,0 +1,30 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+ require 'spec_helper'
3
+
4
+ describe Puppet::Settings::PathSetting do
5
+ subject { described_class.new(:settings => mock('settings'), :desc => "test") }
6
+
7
+ context "#munge" do
8
+ it "should expand all path elements" do
9
+ munged = subject.munge("hello#{File::PATH_SEPARATOR}good/morning#{File::PATH_SEPARATOR}goodbye")
10
+ munged.split(File::PATH_SEPARATOR).each do |p|
11
+ Puppet::Util.should be_absolute_path(p)
12
+ end
13
+ end
14
+
15
+ it "should leave nil as nil" do
16
+ subject.munge(nil).should be_nil
17
+ end
18
+
19
+ context "on Windows", :if => Puppet.features.microsoft_windows? do
20
+ it "should convert \\ to /" do
21
+ subject.munge('C:\test\directory').should == 'C:/test/directory'
22
+ end
23
+
24
+ it "should work with UNC paths" do
25
+ subject.munge('//server/some/path').should == '//server/some/path'
26
+ subject.munge('\\\\server\some\path').should == '//server/some/path'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,75 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+ require 'spec_helper'
3
+
4
+ require 'puppet/settings'
5
+ require 'puppet/settings/string_setting'
6
+
7
+ describe Puppet::Settings::StringSetting do
8
+ StringSetting = Puppet::Settings::StringSetting
9
+
10
+ before(:each) do
11
+ @test_setting_name = :test_setting
12
+ @test_setting_default = "my_crazy_default/$var"
13
+ @application_setting = "application/$var"
14
+ @application_defaults = { }
15
+ Puppet::Settings::REQUIRED_APP_SETTINGS.each do |key|
16
+ @application_defaults[key] = "foo"
17
+ end
18
+ @application_defaults[:run_mode] = :user
19
+ @settings = Puppet::Settings.new
20
+ @application_defaults.each { |k,v| @settings.define_settings :main, k => {:default=>"", :desc => "blah"} }
21
+ @settings.define_settings :main, :var => { :default => "interpolate!",
22
+ :type => :string,
23
+ :desc => "my var desc" },
24
+ @test_setting_name => { :default => @test_setting_default,
25
+ :type => :string,
26
+ :desc => "my test desc" }
27
+ @test_setting = @settings.setting(@test_setting_name)
28
+ end
29
+
30
+ describe "#default" do
31
+ describe "with no arguments" do
32
+ it "should return the setting default" do
33
+ @test_setting.default.should == @test_setting_default
34
+ end
35
+
36
+ it "should be uninterpolated" do
37
+ @test_setting.default.should_not =~ /interpolate/
38
+ end
39
+ end
40
+
41
+ describe "checking application defaults first" do
42
+ describe "if application defaults set" do
43
+ before(:each) do
44
+ @settings.initialize_app_defaults @application_defaults.merge @test_setting_name => @application_setting
45
+ end
46
+
47
+ it "should return the application-set default" do
48
+ @test_setting.default(true).should == @application_setting
49
+ end
50
+
51
+ it "should be uninterpolated" do
52
+ @test_setting.default(true).should_not =~ /interpolate/
53
+ end
54
+
55
+ end
56
+
57
+ describe "if application defaults not set" do
58
+ it "should return the regular default" do
59
+ @test_setting.default(true).should == @test_setting_default
60
+ end
61
+
62
+ it "should be uninterpolated" do
63
+ @test_setting.default(true).should_not =~ /interpolate/
64
+ end
65
+ end
66
+ end
67
+ end
68
+
69
+ describe "#value" do
70
+ it "should be interpolated" do
71
+ @test_setting.value.should =~ /interpolate/
72
+ end
73
+ end
74
+ end
75
+
@@ -0,0 +1,1583 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+ require 'spec_helper'
3
+ require 'ostruct'
4
+ require 'puppet/settings/errors'
5
+
6
+ describe Puppet::Settings do
7
+ include PuppetSpec::Files
8
+
9
+ MAIN_CONFIG_FILE_DEFAULT_LOCATION = File.join(Puppet::Settings.default_global_config_dir, "puppet.conf")
10
+ USER_CONFIG_FILE_DEFAULT_LOCATION = File.join(Puppet::Settings.default_user_config_dir, "puppet.conf")
11
+
12
+ describe "when dealing with user default directories" do
13
+ context "user config dir" do
14
+ it "should expand the value to an absolute path" do
15
+ Pathname.new(Puppet::Settings.default_user_config_dir).absolute?.should be_true
16
+ end
17
+ end
18
+ context "user var dir" do
19
+ it "should expand the value to an absolute path" do
20
+ Pathname.new(Puppet::Settings.default_user_var_dir).absolute?.should be_true
21
+ end
22
+ end
23
+ end
24
+
25
+ describe "when specifying defaults" do
26
+ before do
27
+ @settings = Puppet::Settings.new
28
+ end
29
+
30
+ it "should start with no defined parameters" do
31
+ @settings.params.length.should == 0
32
+ end
33
+
34
+ it "should not allow specification of default values associated with a section as an array" do
35
+ expect {
36
+ @settings.define_settings(:section, :myvalue => ["defaultval", "my description"])
37
+ }.to raise_error
38
+ end
39
+
40
+ it "should not allow duplicate parameter specifications" do
41
+ @settings.define_settings(:section, :myvalue => { :default => "a", :desc => "b" })
42
+ lambda { @settings.define_settings(:section, :myvalue => { :default => "c", :desc => "d" }) }.should raise_error(ArgumentError)
43
+ end
44
+
45
+ it "should allow specification of default values associated with a section as a hash" do
46
+ @settings.define_settings(:section, :myvalue => {:default => "defaultval", :desc => "my description"})
47
+ end
48
+
49
+ it "should consider defined parameters to be valid" do
50
+ @settings.define_settings(:section, :myvalue => { :default => "defaultval", :desc => "my description" })
51
+ @settings.valid?(:myvalue).should be_true
52
+ end
53
+
54
+ it "should require a description when defaults are specified with a hash" do
55
+ lambda { @settings.define_settings(:section, :myvalue => {:default => "a value"}) }.should raise_error(ArgumentError)
56
+ end
57
+
58
+ it "should support specifying owner, group, and mode when specifying files" do
59
+ @settings.define_settings(:section, :myvalue => {:type => :file, :default => "/some/file", :owner => "service", :mode => "boo", :group => "service", :desc => "whatever"})
60
+ end
61
+
62
+ it "should support specifying a short name" do
63
+ @settings.define_settings(:section, :myvalue => {:default => "w", :desc => "b", :short => "m"})
64
+ end
65
+
66
+ it "should support specifying the setting type" do
67
+ @settings.define_settings(:section, :myvalue => {:default => "/w", :desc => "b", :type => :string})
68
+ @settings.setting(:myvalue).should be_instance_of(Puppet::Settings::StringSetting)
69
+ end
70
+
71
+ it "should fail if an invalid setting type is specified" do
72
+ lambda { @settings.define_settings(:section, :myvalue => {:default => "w", :desc => "b", :type => :foo}) }.should raise_error(ArgumentError)
73
+ end
74
+
75
+ it "should fail when short names conflict" do
76
+ @settings.define_settings(:section, :myvalue => {:default => "w", :desc => "b", :short => "m"})
77
+ lambda { @settings.define_settings(:section, :myvalue => {:default => "w", :desc => "b", :short => "m"}) }.should raise_error(ArgumentError)
78
+ end
79
+ end
80
+
81
+
82
+ describe "when initializing application defaults do" do
83
+ before do
84
+ @settings = Puppet::Settings.new
85
+ end
86
+
87
+ it "should fail if someone attempts to initialize app defaults more than once" do
88
+ @settings.expects(:app_defaults_initialized?).returns(true)
89
+ expect {
90
+ @settings.initialize_app_defaults({})
91
+ }.to raise_error(Puppet::DevError)
92
+ end
93
+
94
+ it "should fail if the app defaults hash is missing any required values" do
95
+ expect {
96
+ @settings.initialize_app_defaults({})
97
+ }.to raise_error(Puppet::Settings::SettingsError)
98
+ end
99
+
100
+ # ultimately I'd like to stop treating "run_mode" as a normal setting, because it has so many special
101
+ # case behaviors / uses. However, until that time... we need to make sure that our private run_mode=
102
+ # setter method gets properly called during app initialization.
103
+ it "should call the hacky run mode setter method until we do a better job of separating run_mode" do
104
+ app_defaults = {}
105
+ Puppet::Settings::REQUIRED_APP_SETTINGS.each do |key|
106
+ app_defaults[key] = "foo"
107
+ end
108
+
109
+ @settings.define_settings(:main, PuppetSpec::Settings::TEST_APP_DEFAULT_DEFINITIONS)
110
+ @settings.expects(:run_mode=).with("foo")
111
+ @settings.initialize_app_defaults(app_defaults)
112
+ end
113
+ end
114
+
115
+ describe "#call_hooks_deferred_to_application_initialization" do
116
+ let (:good_default) { "yay" }
117
+ let (:bad_default) { "$doesntexist" }
118
+ before(:each) do
119
+ @settings = Puppet::Settings.new
120
+ end
121
+
122
+ describe "when ignoring dependency interpolation errors" do
123
+ let(:options) { {:ignore_interpolation_dependency_errors => true} }
124
+
125
+ describe "if interpolation error" do
126
+ it "should not raise an error" do
127
+ hook_values = []
128
+ @settings.define_settings(:section, :badhook => {:default => bad_default, :desc => "boo", :call_hook => :on_initialize_and_write, :hook => lambda { |v| hook_values << v }})
129
+ expect do
130
+ @settings.send(:call_hooks_deferred_to_application_initialization, options)
131
+ end.to_not raise_error
132
+ end
133
+ end
134
+ describe "if no interpolation error" do
135
+ it "should not raise an error" do
136
+ hook_values = []
137
+ @settings.define_settings(:section, :goodhook => {:default => good_default, :desc => "boo", :call_hook => :on_initialize_and_write, :hook => lambda { |v| hook_values << v }})
138
+ expect do
139
+ @settings.send(:call_hooks_deferred_to_application_initialization, options)
140
+ end.to_not raise_error
141
+ end
142
+ end
143
+ end
144
+
145
+ describe "when not ignoring dependency interpolation errors" do
146
+ [ {}, {:ignore_interpolation_dependency_errors => false}].each do |options|
147
+ describe "if interpolation error" do
148
+ it "should raise an error" do
149
+ hook_values = []
150
+ @settings.define_settings(
151
+ :section,
152
+ :badhook => {
153
+ :default => bad_default,
154
+ :desc => "boo",
155
+ :call_hook => :on_initialize_and_write,
156
+ :hook => lambda { |v| hook_values << v }
157
+ }
158
+ )
159
+ expect do
160
+ @settings.send(:call_hooks_deferred_to_application_initialization, options)
161
+ end.to raise_error Puppet::Settings::InterpolationError
162
+ end
163
+ it "should contain the setting name in error message" do
164
+ hook_values = []
165
+ @settings.define_settings(
166
+ :section,
167
+ :badhook => {
168
+ :default => bad_default,
169
+ :desc => "boo",
170
+ :call_hook => :on_initialize_and_write,
171
+ :hook => lambda { |v| hook_values << v }
172
+ }
173
+ )
174
+ expect do
175
+ @settings.send(:call_hooks_deferred_to_application_initialization, options)
176
+ end.to raise_error Puppet::Settings::InterpolationError, /badhook/
177
+ end
178
+ end
179
+ describe "if no interpolation error" do
180
+ it "should not raise an error" do
181
+ hook_values = []
182
+ @settings.define_settings(
183
+ :section,
184
+ :goodhook => {
185
+ :default => good_default,
186
+ :desc => "boo",
187
+ :call_hook => :on_initialize_and_write,
188
+ :hook => lambda { |v| hook_values << v }
189
+ }
190
+ )
191
+ expect do
192
+ @settings.send(:call_hooks_deferred_to_application_initialization, options)
193
+ end.to_not raise_error
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
199
+
200
+ describe "when setting values" do
201
+ before do
202
+ @settings = Puppet::Settings.new
203
+ @settings.define_settings :main, :myval => { :default => "val", :desc => "desc" }
204
+ @settings.define_settings :main, :bool => { :type => :boolean, :default => true, :desc => "desc" }
205
+ end
206
+
207
+ it "should provide a method for setting values from other objects" do
208
+ @settings[:myval] = "something else"
209
+ @settings[:myval].should == "something else"
210
+ end
211
+
212
+ it "should support a getopt-specific mechanism for setting values" do
213
+ @settings.handlearg("--myval", "newval")
214
+ @settings[:myval].should == "newval"
215
+ end
216
+
217
+ it "should support a getopt-specific mechanism for turning booleans off" do
218
+ @settings[:bool] = true
219
+ @settings.handlearg("--no-bool", "")
220
+ @settings[:bool].should == false
221
+ end
222
+
223
+ it "should support a getopt-specific mechanism for turning booleans on" do
224
+ # Turn it off first
225
+ @settings[:bool] = false
226
+ @settings.handlearg("--bool", "")
227
+ @settings[:bool].should == true
228
+ end
229
+
230
+ it "should consider a cli setting with no argument to be a boolean" do
231
+ # Turn it off first
232
+ @settings[:bool] = false
233
+ @settings.handlearg("--bool")
234
+ @settings[:bool].should == true
235
+ end
236
+
237
+ it "should consider a cli setting with an empty string as an argument to be a boolean, if the setting itself is a boolean" do
238
+ # Turn it off first
239
+ @settings[:bool] = false
240
+ @settings.handlearg("--bool", "")
241
+ @settings[:bool].should == true
242
+ end
243
+
244
+ it "should consider a cli setting with an empty string as an argument to be an empty argument, if the setting itself is not a boolean" do
245
+ @settings[:myval] = "bob"
246
+ @settings.handlearg("--myval", "")
247
+ @settings[:myval].should == ""
248
+ end
249
+
250
+ it "should consider a cli setting with a boolean as an argument to be a boolean" do
251
+ # Turn it off first
252
+ @settings[:bool] = false
253
+ @settings.handlearg("--bool", "true")
254
+ @settings[:bool].should == true
255
+ end
256
+
257
+ it "should not consider a cli setting of a non boolean with a boolean as an argument to be a boolean" do
258
+ # Turn it off first
259
+ @settings[:myval] = "bob"
260
+ @settings.handlearg("--no-myval", "")
261
+ @settings[:myval].should == ""
262
+ end
263
+
264
+ it "should flag string settings from the CLI" do
265
+ @settings.handlearg("--myval", "12")
266
+ @settings.set_by_cli?(:myval).should be_true
267
+ end
268
+
269
+ it "should flag bool settings from the CLI" do
270
+ @settings[:bool] = false
271
+ @settings.handlearg("--bool")
272
+ @settings.set_by_cli?(:bool).should be_true
273
+ end
274
+
275
+ it "should not flag settings memory as from CLI" do
276
+ @settings[:myval] = "12"
277
+ @settings.set_by_cli?(:myval).should be_false
278
+ end
279
+
280
+ describe "setbycli" do
281
+ it "should generate a deprecation warning" do
282
+ Puppet.expects(:deprecation_warning)
283
+ @settings.setting(:myval).setbycli = true
284
+ end
285
+ it "should set the value" do
286
+ @settings[:myval] = "blah"
287
+ @settings.setting(:myval).setbycli = true
288
+ @settings.set_by_cli?(:myval).should be_true
289
+ end
290
+ it "should raise error if trying to unset value" do
291
+ @settings.handlearg("--myval", "blah")
292
+ expect do
293
+ @settings.setting(:myval).setbycli = nil
294
+ end.to raise_error ArgumentError, /unset/
295
+ end
296
+ end
297
+
298
+ it "should clear the cache when setting getopt-specific values" do
299
+ @settings.define_settings :mysection,
300
+ :one => { :default => "whah", :desc => "yay" },
301
+ :two => { :default => "$one yay", :desc => "bah" }
302
+ @settings[:two].should == "whah yay"
303
+ @settings.handlearg("--one", "else")
304
+ @settings[:two].should == "else yay"
305
+ end
306
+
307
+ it "should not clear other values when setting getopt-specific values" do
308
+ @settings[:myval] = "yay"
309
+ @settings.handlearg("--no-bool", "")
310
+ @settings[:myval].should == "yay"
311
+ end
312
+
313
+ it "should clear the list of used sections" do
314
+ @settings.expects(:clearused)
315
+ @settings[:myval] = "yay"
316
+ end
317
+
318
+ describe "call_hook" do
319
+ Puppet::Settings::StringSetting.available_call_hook_values.each do |val|
320
+ describe "when :#{val}" do
321
+ describe "and definition invalid" do
322
+ it "should raise error if no hook defined" do
323
+ expect do
324
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => val})
325
+ end.to raise_error ArgumentError, /no :hook/
326
+ end
327
+ it "should include the setting name in the error message" do
328
+ expect do
329
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => val})
330
+ end.to raise_error ArgumentError, /for :hooker/
331
+ end
332
+ end
333
+ describe "and definition valid" do
334
+ before(:each) do
335
+ hook_values = []
336
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => val, :hook => lambda { |v| hook_values << v }})
337
+ end
338
+
339
+ it "should call the hook when value written" do
340
+ @settings.setting(:hooker).expects(:handle).with("something").once
341
+ @settings[:hooker] = "something"
342
+ end
343
+ end
344
+ end
345
+ end
346
+
347
+ it "should have a default value of :on_write_only" do
348
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :hook => lambda { |v| hook_values << v }})
349
+ @settings.setting(:hooker).call_hook.should == :on_write_only
350
+ end
351
+
352
+ describe "when nil" do
353
+ it "should generate a warning" do
354
+ Puppet.expects(:warning)
355
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => nil, :hook => lambda { |v| hook_values << v }})
356
+ end
357
+ it "should use default" do
358
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => nil, :hook => lambda { |v| hook_values << v }})
359
+ @settings.setting(:hooker).call_hook.should == :on_write_only
360
+ end
361
+ end
362
+
363
+ describe "when invalid" do
364
+ it "should raise an error" do
365
+ expect do
366
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => :foo, :hook => lambda { |v| hook_values << v }})
367
+ end.to raise_error ArgumentError, /invalid.*call_hook/i
368
+ end
369
+ end
370
+
371
+ describe "when :on_define_and_write" do
372
+ it "should call the hook at definition" do
373
+ hook_values = []
374
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => :on_define_and_write, :hook => lambda { |v| hook_values << v }})
375
+ @settings.setting(:hooker).call_hook.should == :on_define_and_write
376
+ hook_values.should == %w{yay}
377
+ end
378
+ end
379
+
380
+ describe "when :on_initialize_and_write" do
381
+ before(:each) do
382
+ @hook_values = []
383
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => :on_initialize_and_write, :hook => lambda { |v| @hook_values << v }})
384
+ end
385
+
386
+ it "should not call the hook at definition" do
387
+ @hook_values.should == []
388
+ @hook_values.should_not == %w{yay}
389
+ end
390
+
391
+ it "should call the hook at initialization" do
392
+ app_defaults = {}
393
+ Puppet::Settings::REQUIRED_APP_SETTINGS.each do |key|
394
+ app_defaults[key] = "foo"
395
+ end
396
+ app_defaults[:run_mode] = :user
397
+ @settings.define_settings(:main, PuppetSpec::Settings::TEST_APP_DEFAULT_DEFINITIONS)
398
+
399
+ @settings.setting(:hooker).expects(:handle).with("yay").once
400
+
401
+ @settings.initialize_app_defaults app_defaults
402
+ end
403
+ end
404
+ end
405
+
406
+ describe "call_on_define" do
407
+ [true, false].each do |val|
408
+ describe "to #{val}" do
409
+ it "should generate a deprecation warning" do
410
+ Puppet.expects(:deprecation_warning)
411
+ values = []
412
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_on_define => val, :hook => lambda { |v| values << v }})
413
+ end
414
+
415
+ it "should should set call_hook" do
416
+ values = []
417
+ name = "hooker_#{val}".to_sym
418
+ @settings.define_settings(:section, name => {:default => "yay", :desc => "boo", :call_on_define => val, :hook => lambda { |v| values << v }})
419
+
420
+ @settings.setting(name).call_hook.should == :on_define_and_write if val
421
+ @settings.setting(name).call_hook.should == :on_write_only unless val
422
+ end
423
+ end
424
+ end
425
+ end
426
+
427
+ it "should call passed blocks when values are set" do
428
+ values = []
429
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :hook => lambda { |v| values << v }})
430
+ values.should == []
431
+
432
+ @settings[:hooker] = "something"
433
+ values.should == %w{something}
434
+ end
435
+
436
+ it "should call passed blocks when values are set via the command line" do
437
+ values = []
438
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :hook => lambda { |v| values << v }})
439
+ values.should == []
440
+
441
+ @settings.handlearg("--hooker", "yay")
442
+
443
+ values.should == %w{yay}
444
+ end
445
+
446
+ it "should provide an option to call passed blocks during definition" do
447
+ values = []
448
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => :on_define_and_write, :hook => lambda { |v| values << v }})
449
+ values.should == %w{yay}
450
+ end
451
+
452
+ it "should pass the fully interpolated value to the hook when called on definition" do
453
+ values = []
454
+ @settings.define_settings(:section, :one => { :default => "test", :desc => "a" })
455
+ @settings.define_settings(:section, :hooker => {:default => "$one/yay", :desc => "boo", :call_hook => :on_define_and_write, :hook => lambda { |v| values << v }})
456
+ values.should == %w{test/yay}
457
+ end
458
+
459
+ it "should munge values using the setting-specific methods" do
460
+ @settings[:bool] = "false"
461
+ @settings[:bool].should == false
462
+ end
463
+
464
+ it "should prefer cli values to values set in Ruby code" do
465
+ @settings.handlearg("--myval", "cliarg")
466
+ @settings[:myval] = "memarg"
467
+ @settings[:myval].should == "cliarg"
468
+ end
469
+
470
+ it "should clear the list of environments" do
471
+ Puppet::Node::Environment.expects(:clear).at_least(1)
472
+ @settings[:myval] = "memarg"
473
+ end
474
+
475
+ it "should raise an error if we try to set a setting that hasn't been defined'" do
476
+ lambda{
477
+ @settings[:why_so_serious] = "foo"
478
+ }.should raise_error(ArgumentError, /unknown configuration parameter/)
479
+ end
480
+
481
+ it "should raise an error if we try to set a setting that is read-only (which, really, all of our settings probably should be)" do
482
+ @settings.define_settings(:section, :one => { :default => "test", :desc => "a" })
483
+ @settings.expects(:read_only_settings).returns([:one])
484
+
485
+ lambda{
486
+ @settings[:one] = "foo"
487
+ }.should raise_error(ArgumentError, /read-only/)
488
+ end
489
+ end
490
+
491
+ describe "when returning values" do
492
+ before do
493
+ @settings = Puppet::Settings.new
494
+ @settings.define_settings :section,
495
+ :config => { :type => :file, :default => "/my/file", :desc => "eh" },
496
+ :one => { :default => "ONE", :desc => "a" },
497
+ :two => { :default => "$one TWO", :desc => "b"},
498
+ :three => { :default => "$one $two THREE", :desc => "c"},
499
+ :four => { :default => "$two $three FOUR", :desc => "d"}
500
+ FileTest.stubs(:exist?).returns true
501
+ end
502
+
503
+ describe "call_on_define" do
504
+ it "should generate a deprecation warning" do
505
+ Puppet.expects(:deprecation_warning)
506
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :hook => lambda { |v| hook_values << v }})
507
+ @settings.setting(:hooker).call_on_define
508
+ end
509
+
510
+ Puppet::Settings::StringSetting.available_call_hook_values.each do |val|
511
+ it "should match value for call_hook => :#{val}" do
512
+ hook_values = []
513
+ @settings.define_settings(:section, :hooker => {:default => "yay", :desc => "boo", :call_hook => val, :hook => lambda { |v| hook_values << v }})
514
+ @settings.setting(:hooker).call_on_define.should == @settings.setting(:hooker).call_hook_on_define?
515
+ end
516
+ end
517
+ end
518
+
519
+ it "should provide a mechanism for returning set values" do
520
+ @settings[:one] = "other"
521
+ @settings[:one].should == "other"
522
+ end
523
+
524
+ it "should interpolate default values for other parameters into returned parameter values" do
525
+ @settings[:one].should == "ONE"
526
+ @settings[:two].should == "ONE TWO"
527
+ @settings[:three].should == "ONE ONE TWO THREE"
528
+ end
529
+
530
+ it "should interpolate default values that themselves need to be interpolated" do
531
+ @settings[:four].should == "ONE TWO ONE ONE TWO THREE FOUR"
532
+ end
533
+
534
+ it "should provide a method for returning uninterpolated values" do
535
+ @settings[:two] = "$one tw0"
536
+ @settings.uninterpolated_value(:two).should == "$one tw0"
537
+ @settings.uninterpolated_value(:four).should == "$two $three FOUR"
538
+ end
539
+
540
+ it "should interpolate set values for other parameters into returned parameter values" do
541
+ @settings[:one] = "on3"
542
+ @settings[:two] = "$one tw0"
543
+ @settings[:three] = "$one $two thr33"
544
+ @settings[:four] = "$one $two $three f0ur"
545
+ @settings[:one].should == "on3"
546
+ @settings[:two].should == "on3 tw0"
547
+ @settings[:three].should == "on3 on3 tw0 thr33"
548
+ @settings[:four].should == "on3 on3 tw0 on3 on3 tw0 thr33 f0ur"
549
+ end
550
+
551
+ it "should not cache interpolated values such that stale information is returned" do
552
+ @settings[:two].should == "ONE TWO"
553
+ @settings[:one] = "one"
554
+ @settings[:two].should == "one TWO"
555
+ end
556
+
557
+ it "should not cache values such that information from one environment is returned for another environment" do
558
+ text = "[env1]\none = oneval\n[env2]\none = twoval\n"
559
+ @settings.stubs(:read_file).returns(text)
560
+ @settings.send(:parse_config_files)
561
+
562
+ @settings.value(:one, "env1").should == "oneval"
563
+ @settings.value(:one, "env2").should == "twoval"
564
+ end
565
+
566
+ it "should have a run_mode that defaults to user" do
567
+ @settings.run_mode.should == :user
568
+ end
569
+ describe "setbycli" do
570
+ it "should generate a deprecation warning" do
571
+ @settings.handlearg("--one", "blah")
572
+ Puppet.expects(:deprecation_warning)
573
+ @settings.setting(:one).setbycli
574
+ end
575
+ it "should be true" do
576
+ @settings.handlearg("--one", "blah")
577
+ @settings.setting(:one).setbycli.should be_true
578
+ end
579
+ end
580
+ end
581
+
582
+ describe "when choosing which value to return" do
583
+ before do
584
+ @settings = Puppet::Settings.new
585
+ @settings.define_settings :section,
586
+ :config => { :type => :file, :default => "/my/file", :desc => "a" },
587
+ :one => { :default => "ONE", :desc => "a" },
588
+ :two => { :default => "TWO", :desc => "b" }
589
+ FileTest.stubs(:exist?).returns true
590
+ @settings.stubs(:run_mode).returns :mymode
591
+ end
592
+
593
+ it "should return default values if no values have been set" do
594
+ @settings[:one].should == "ONE"
595
+ end
596
+
597
+ it "should return values set on the cli before values set in the configuration file" do
598
+ text = "[main]\none = fileval\n"
599
+ @settings.stubs(:read_file).returns(text)
600
+ @settings.handlearg("--one", "clival")
601
+ @settings.send(:parse_config_files)
602
+
603
+ @settings[:one].should == "clival"
604
+ end
605
+
606
+ it "should return values set on the cli before values set in Ruby" do
607
+ @settings[:one] = "rubyval"
608
+ @settings.handlearg("--one", "clival")
609
+ @settings[:one].should == "clival"
610
+ end
611
+
612
+ it "should return values set in the mode-specific section before values set in the main section" do
613
+ text = "[main]\none = mainval\n[mymode]\none = modeval\n"
614
+ @settings.stubs(:read_file).returns(text)
615
+ @settings.send(:parse_config_files)
616
+
617
+ @settings[:one].should == "modeval"
618
+ end
619
+
620
+ it "should not return values outside of its search path" do
621
+ text = "[other]\none = oval\n"
622
+ file = "/some/file"
623
+ @settings.stubs(:read_file).returns(text)
624
+ @settings.send(:parse_config_files)
625
+ @settings[:one].should == "ONE"
626
+ end
627
+
628
+ it "should return values in a specified environment" do
629
+ text = "[env]\none = envval\n"
630
+ @settings.stubs(:read_file).returns(text)
631
+ @settings.send(:parse_config_files)
632
+ @settings.value(:one, "env").should == "envval"
633
+ end
634
+
635
+ it 'should use the current environment for $environment' do
636
+ @settings.define_settings :main, :myval => { :default => "$environment/foo", :desc => "mydocs" }
637
+
638
+ @settings.value(:myval, "myenv").should == "myenv/foo"
639
+ end
640
+
641
+ it "should interpolate found values using the current environment" do
642
+ text = "[main]\none = mainval\n[myname]\none = nameval\ntwo = $one/two\n"
643
+ @settings.stubs(:read_file).returns(text)
644
+ @settings.send(:parse_config_files)
645
+
646
+ @settings.value(:two, "myname").should == "nameval/two"
647
+ end
648
+
649
+ it "should return values in a specified environment before values in the main or name sections" do
650
+ text = "[env]\none = envval\n[main]\none = mainval\n[myname]\none = nameval\n"
651
+ @settings.stubs(:read_file).returns(text)
652
+ @settings.send(:parse_config_files)
653
+ @settings.value(:one, "env").should == "envval"
654
+ end
655
+ end
656
+
657
+
658
+ describe "when locating config files" do
659
+ before do
660
+ @settings = Puppet::Settings.new
661
+ end
662
+
663
+ describe "when root" do
664
+ it "should look for #{MAIN_CONFIG_FILE_DEFAULT_LOCATION} if config settings haven't been overridden'" do
665
+ Puppet.features.stubs(:root?).returns(true)
666
+ FileTest.expects(:exist?).with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).returns(false)
667
+ FileTest.expects(:exist?).with(USER_CONFIG_FILE_DEFAULT_LOCATION).never
668
+
669
+ @settings.send(:parse_config_files)
670
+ end
671
+ end
672
+
673
+ describe "when not root" do
674
+ it "should look for #{USER_CONFIG_FILE_DEFAULT_LOCATION} if config settings haven't been overridden'" do
675
+ Puppet.features.stubs(:root?).returns(false)
676
+
677
+ seq = sequence "load config files"
678
+ FileTest.expects(:exist?).with(USER_CONFIG_FILE_DEFAULT_LOCATION).returns(false).in_sequence(seq)
679
+
680
+ @settings.send(:parse_config_files)
681
+ end
682
+ end
683
+ end
684
+
685
+ describe "when parsing its configuration" do
686
+ before do
687
+ @settings = Puppet::Settings.new
688
+ @settings.stubs(:service_user_available?).returns true
689
+ @file = make_absolute("/some/file")
690
+ @userconfig = make_absolute("/test/userconfigfile")
691
+ @settings.define_settings :section, :user => { :default => "suser", :desc => "doc" }, :group => { :default => "sgroup", :desc => "doc" }
692
+ @settings.define_settings :section,
693
+ :config => { :type => :file, :default => @file, :desc => "eh" },
694
+ :one => { :default => "ONE", :desc => "a" },
695
+ :two => { :default => "$one TWO", :desc => "b" },
696
+ :three => { :default => "$one $two THREE", :desc => "c" }
697
+ @settings.stubs(:user_config_file).returns(@userconfig)
698
+ FileTest.stubs(:exist?).with(@file).returns true
699
+ FileTest.stubs(:exist?).with(@userconfig).returns false
700
+ end
701
+
702
+ it "should not ignore the report setting" do
703
+ @settings.define_settings :section, :report => { :default => "false", :desc => "a" }
704
+ # This is needed in order to make sure we pass on windows
705
+ myfile = File.expand_path(@file)
706
+ @settings[:config] = myfile
707
+ text = <<-CONF
708
+ [puppetd]
709
+ report=true
710
+ CONF
711
+ FileTest.expects(:exist?).with(myfile).returns(true)
712
+ @settings.expects(:read_file).returns(text)
713
+ @settings.send(:parse_config_files)
714
+ @settings[:report].should be_true
715
+ end
716
+
717
+ it "should use its current ':config' value for the file to parse" do
718
+ myfile = make_absolute("/my/file") # do not stub expand_path here, as this leads to a stack overflow, when mocha tries to use it
719
+ @settings[:config] = myfile
720
+
721
+ FileTest.expects(:exist?).with(myfile).returns(true)
722
+
723
+ File.expects(:read).with(myfile).returns "[main]"
724
+
725
+ @settings.send(:parse_config_files)
726
+ end
727
+
728
+ it "should not try to parse non-existent files" do
729
+ FileTest.expects(:exist?).with(@file).returns false
730
+
731
+ File.expects(:read).with(@file).never
732
+
733
+ @settings.send(:parse_config_files)
734
+ end
735
+
736
+ it "should return values set in the configuration file" do
737
+ text = "[main]
738
+ one = fileval
739
+ "
740
+ @settings.expects(:read_file).returns(text)
741
+ @settings.send(:parse_config_files)
742
+ @settings[:one].should == "fileval"
743
+ end
744
+
745
+ #484 - this should probably be in the regression area
746
+ it "should not throw an exception on unknown parameters" do
747
+ text = "[main]\nnosuchparam = mval\n"
748
+ @settings.expects(:read_file).returns(text)
749
+ lambda { @settings.send(:parse_config_files) }.should_not raise_error
750
+ end
751
+
752
+ it "should convert booleans in the configuration file into Ruby booleans" do
753
+ text = "[main]
754
+ one = true
755
+ two = false
756
+ "
757
+ @settings.expects(:read_file).returns(text)
758
+ @settings.send(:parse_config_files)
759
+ @settings[:one].should == true
760
+ @settings[:two].should == false
761
+ end
762
+
763
+ it "should convert integers in the configuration file into Ruby Integers" do
764
+ text = "[main]
765
+ one = 65
766
+ "
767
+ @settings.expects(:read_file).returns(text)
768
+ @settings.send(:parse_config_files)
769
+ @settings[:one].should == 65
770
+ end
771
+
772
+ it "should support specifying all metadata (owner, group, mode) in the configuration file" do
773
+ @settings.define_settings :section, :myfile => { :type => :file, :default => make_absolute("/myfile"), :desc => "a" }
774
+
775
+ otherfile = make_absolute("/other/file")
776
+ text = "[main]
777
+ myfile = #{otherfile} {owner = service, group = service, mode = 644}
778
+ "
779
+ @settings.expects(:read_file).returns(text)
780
+ @settings.send(:parse_config_files)
781
+ @settings[:myfile].should == otherfile
782
+ @settings.metadata(:myfile).should == {:owner => "suser", :group => "sgroup", :mode => "644"}
783
+ end
784
+
785
+ it "should support specifying a single piece of metadata (owner, group, or mode) in the configuration file" do
786
+ @settings.define_settings :section, :myfile => { :type => :file, :default => make_absolute("/myfile"), :desc => "a" }
787
+
788
+ otherfile = make_absolute("/other/file")
789
+ text = "[main]
790
+ myfile = #{otherfile} {owner = service}
791
+ "
792
+ @settings.expects(:read_file).returns(text)
793
+ @settings.send(:parse_config_files)
794
+ @settings[:myfile].should == otherfile
795
+ @settings.metadata(:myfile).should == {:owner => "suser"}
796
+ end
797
+
798
+ it "should call hooks associated with values set in the configuration file" do
799
+ values = []
800
+ @settings.define_settings :section, :mysetting => {:default => "defval", :desc => "a", :hook => proc { |v| values << v }}
801
+
802
+ text = "[main]
803
+ mysetting = setval
804
+ "
805
+ @settings.expects(:read_file).returns(text)
806
+ @settings.send(:parse_config_files)
807
+ values.should == ["setval"]
808
+ end
809
+
810
+ it "should not call the same hook for values set multiple times in the configuration file" do
811
+ values = []
812
+ @settings.define_settings :section, :mysetting => {:default => "defval", :desc => "a", :hook => proc { |v| values << v }}
813
+
814
+ text = "[user]
815
+ mysetting = setval
816
+ [main]
817
+ mysetting = other
818
+ "
819
+ @settings.expects(:read_file).returns(text)
820
+ @settings.send(:parse_config_files)
821
+ values.should == ["setval"]
822
+ end
823
+
824
+ it "should pass the environment-specific value to the hook when one is available" do
825
+ values = []
826
+ @settings.define_settings :section, :mysetting => {:default => "defval", :desc => "a", :hook => proc { |v| values << v }}
827
+ @settings.define_settings :section, :environment => { :default => "yay", :desc => "a" }
828
+ @settings.define_settings :section, :environments => { :default => "yay,foo", :desc => "a" }
829
+
830
+ text = "[main]
831
+ mysetting = setval
832
+ [yay]
833
+ mysetting = other
834
+ "
835
+ @settings.expects(:read_file).returns(text)
836
+ @settings.send(:parse_config_files)
837
+ values.should == ["other"]
838
+ end
839
+
840
+ it "should pass the interpolated value to the hook when one is available" do
841
+ values = []
842
+ @settings.define_settings :section, :base => {:default => "yay", :desc => "a", :hook => proc { |v| values << v }}
843
+ @settings.define_settings :section, :mysetting => {:default => "defval", :desc => "a", :hook => proc { |v| values << v }}
844
+
845
+ text = "[main]
846
+ mysetting = $base/setval
847
+ "
848
+ @settings.expects(:read_file).returns(text)
849
+ @settings.send(:parse_config_files)
850
+ values.should == ["yay/setval"]
851
+ end
852
+
853
+ it "should allow empty values" do
854
+ @settings.define_settings :section, :myarg => { :default => "myfile", :desc => "a" }
855
+
856
+ text = "[main]
857
+ myarg =
858
+ "
859
+ @settings.stubs(:read_file).returns(text)
860
+ @settings.send(:parse_config_files)
861
+ @settings[:myarg].should == ""
862
+ end
863
+
864
+ describe "and when reading a non-positive filetimeout value from the config file" do
865
+ before do
866
+ @settings.define_settings :foo, :filetimeout => { :default => 5, :desc => "eh" }
867
+
868
+ somefile = "/some/file"
869
+ text = "[main]
870
+ filetimeout = -1
871
+ "
872
+ File.expects(:read).with(somefile).returns(text)
873
+ File.expects(:expand_path).with(somefile).returns somefile
874
+ @settings[:config] = somefile
875
+ end
876
+ end
877
+ end
878
+
879
+
880
+ describe "when there are multiple config files" do
881
+ let(:main_config_text) { "[main]\none = main\ntwo = main2" }
882
+ let(:user_config_text) { "[main]\none = user\n" }
883
+ let(:seq) { sequence "config_file_sequence" }
884
+
885
+ before :each do
886
+ @settings = Puppet::Settings.new
887
+ @settings.define_settings(:section,
888
+ { :confdir => { :default => nil, :desc => "Conf dir" },
889
+ :config => { :default => "$confdir/puppet.conf", :desc => "Config" },
890
+ :one => { :default => "ONE", :desc => "a" },
891
+ :two => { :default => "TWO", :desc => "b" }, })
892
+ end
893
+
894
+ context "running non-root without explicit config file" do
895
+ before :each do
896
+ Puppet.features.stubs(:root?).returns(false)
897
+ FileTest.expects(:exist?).
898
+ with(USER_CONFIG_FILE_DEFAULT_LOCATION).
899
+ returns(true).in_sequence(seq)
900
+ @settings.expects(:read_file).
901
+ with(USER_CONFIG_FILE_DEFAULT_LOCATION).
902
+ returns(user_config_text).in_sequence(seq)
903
+ end
904
+
905
+ it "should return values from the user config file" do
906
+ @settings.send(:parse_config_files)
907
+ @settings[:one].should == "user"
908
+ end
909
+
910
+ it "should not return values from the main config file" do
911
+ @settings.send(:parse_config_files)
912
+ @settings[:two].should == "TWO"
913
+ end
914
+ end
915
+
916
+ context "running as root without explicit config file" do
917
+ before :each do
918
+ Puppet.features.stubs(:root?).returns(true)
919
+ FileTest.expects(:exist?).
920
+ with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
921
+ returns(true).in_sequence(seq)
922
+ @settings.expects(:read_file).
923
+ with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
924
+ returns(main_config_text).in_sequence(seq)
925
+ end
926
+
927
+ it "should return values from the main config file" do
928
+ @settings.send(:parse_config_files)
929
+ @settings[:one].should == "main"
930
+ end
931
+
932
+ it "should not return values from the user config file" do
933
+ @settings.send(:parse_config_files)
934
+ @settings[:two].should == "main2"
935
+ end
936
+ end
937
+
938
+ context "running with an explicit config file as a user (e.g. Apache + Passenger)" do
939
+ before :each do
940
+ Puppet.features.stubs(:root?).returns(false)
941
+ @settings[:confdir] = File.dirname(MAIN_CONFIG_FILE_DEFAULT_LOCATION)
942
+ FileTest.expects(:exist?).
943
+ with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
944
+ returns(true).in_sequence(seq)
945
+ @settings.expects(:read_file).
946
+ with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
947
+ returns(main_config_text).in_sequence(seq)
948
+ end
949
+
950
+ it "should return values from the main config file" do
951
+ @settings.send(:parse_config_files)
952
+ @settings[:one].should == "main"
953
+ end
954
+
955
+ it "should not return values from the user config file" do
956
+ @settings.send(:parse_config_files)
957
+ @settings[:two].should == "main2"
958
+ end
959
+ end
960
+ end
961
+
962
+ describe "when reparsing its configuration" do
963
+ before do
964
+ @file = make_absolute("/test/file")
965
+ @userconfig = make_absolute("/test/userconfigfile")
966
+ @settings = Puppet::Settings.new
967
+ @settings.define_settings :section,
968
+ :config => { :type => :file, :default => @file, :desc => "a" },
969
+ :one => { :default => "ONE", :desc => "a" },
970
+ :two => { :default => "$one TWO", :desc => "b" },
971
+ :three => { :default => "$one $two THREE", :desc => "c" }
972
+ FileTest.stubs(:exist?).with(@file).returns true
973
+ FileTest.stubs(:exist?).with(@userconfig).returns false
974
+ @settings.stubs(:user_config_file).returns(@userconfig)
975
+ end
976
+
977
+ it "should use a LoadedFile instance to determine if the file has changed" do
978
+ file = mock 'file'
979
+ Puppet::Util::LoadedFile.expects(:new).with(@file).returns file
980
+
981
+ file.expects(:changed?)
982
+
983
+ @settings.stubs(:parse)
984
+ @settings.reparse_config_files
985
+ end
986
+
987
+ it "should not create the LoadedFile instance and should not parse if the file does not exist" do
988
+ FileTest.expects(:exist?).with(@file).returns false
989
+ Puppet::Util::LoadedFile.expects(:new).never
990
+
991
+ @settings.expects(:parse_config_files).never
992
+
993
+ @settings.reparse_config_files
994
+ end
995
+
996
+ it "should not reparse if the file has not changed" do
997
+ file = mock 'file'
998
+ Puppet::Util::LoadedFile.expects(:new).with(@file).returns file
999
+
1000
+ file.expects(:changed?).returns false
1001
+
1002
+ @settings.expects(:parse_config_files).never
1003
+
1004
+ @settings.reparse_config_files
1005
+ end
1006
+
1007
+ it "should reparse if the file has changed" do
1008
+ file = stub 'file', :file => @file
1009
+ Puppet::Util::LoadedFile.expects(:new).with(@file).returns file
1010
+
1011
+ file.expects(:changed?).returns true
1012
+
1013
+ @settings.expects(:parse_config_files)
1014
+
1015
+ @settings.reparse_config_files
1016
+ end
1017
+
1018
+ it "should replace in-memory values with on-file values" do
1019
+ # Init the value
1020
+ text = "[main]\none = disk-init\n"
1021
+ file = mock 'file'
1022
+ file.stubs(:changed?).returns(true)
1023
+ file.stubs(:file).returns(@file)
1024
+ @settings[:one] = "init"
1025
+ @settings.files = [file]
1026
+
1027
+ # Now replace the value
1028
+ text = "[main]\none = disk-replace\n"
1029
+
1030
+ # This is kinda ridiculous - the reason it parses twice is that
1031
+ # it goes to parse again when we ask for the value, because the
1032
+ # mock always says it should get reparsed.
1033
+ @settings.stubs(:read_file).returns(text)
1034
+ @settings.reparse_config_files
1035
+ @settings[:one].should == "disk-replace"
1036
+ end
1037
+
1038
+ it "should retain parameters set by cli when configuration files are reparsed" do
1039
+ @settings.handlearg("--one", "clival")
1040
+
1041
+ text = "[main]\none = on-disk\n"
1042
+ @settings.stubs(:read_file).returns(text)
1043
+ @settings.send(:parse_config_files)
1044
+
1045
+ @settings[:one].should == "clival"
1046
+ end
1047
+
1048
+ it "should remove in-memory values that are no longer set in the file" do
1049
+ # Init the value
1050
+ text = "[main]\none = disk-init\n"
1051
+ @settings.expects(:read_file).returns(text)
1052
+ @settings.send(:parse_config_files)
1053
+ @settings[:one].should == "disk-init"
1054
+
1055
+ # Now replace the value
1056
+ text = "[main]\ntwo = disk-replace\n"
1057
+ @settings.expects(:read_file).returns(text)
1058
+ @settings.send(:parse_config_files)
1059
+
1060
+ # The originally-overridden value should be replaced with the default
1061
+ @settings[:one].should == "ONE"
1062
+
1063
+ # and we should now have the new value in memory
1064
+ @settings[:two].should == "disk-replace"
1065
+ end
1066
+
1067
+ it "should retain in-memory values if the file has a syntax error" do
1068
+ # Init the value
1069
+ text = "[main]\none = initial-value\n"
1070
+ @settings.expects(:read_file).with(@file).returns(text)
1071
+ @settings.send(:parse_config_files)
1072
+ @settings[:one].should == "initial-value"
1073
+
1074
+ # Now replace the value with something bogus
1075
+ text = "[main]\nkenny = killed-by-what-follows\n1 is 2, blah blah florp\n"
1076
+ @settings.expects(:read_file).with(@file).returns(text)
1077
+ @settings.send(:parse_config_files)
1078
+
1079
+ # The originally-overridden value should not be replaced with the default
1080
+ @settings[:one].should == "initial-value"
1081
+
1082
+ # and we should not have the new value in memory
1083
+ @settings[:kenny].should be_nil
1084
+ end
1085
+ end
1086
+
1087
+ it "should provide a method for creating a catalog of resources from its configuration" do
1088
+ Puppet::Settings.new.should respond_to(:to_catalog)
1089
+ end
1090
+
1091
+ describe "when creating a catalog" do
1092
+ before do
1093
+ @settings = Puppet::Settings.new
1094
+ @settings.stubs(:service_user_available?).returns true
1095
+ @prefix = Puppet.features.posix? ? "" : "C:"
1096
+ end
1097
+
1098
+ it "should add all file resources to the catalog if no sections have been specified" do
1099
+ @settings.define_settings :main,
1100
+ :maindir => { :type => :directory, :default => @prefix+"/maindir", :desc => "a"},
1101
+ :seconddir => { :type => :directory, :default => @prefix+"/seconddir", :desc => "a"}
1102
+ @settings.define_settings :other,
1103
+ :otherdir => { :type => :directory, :default => @prefix+"/otherdir", :desc => "a" }
1104
+
1105
+ catalog = @settings.to_catalog
1106
+
1107
+ [@prefix+"/maindir", @prefix+"/seconddir", @prefix+"/otherdir"].each do |path|
1108
+ catalog.resource(:file, path).should be_instance_of(Puppet::Resource)
1109
+ end
1110
+ end
1111
+
1112
+ it "should add only files in the specified sections if section names are provided" do
1113
+ @settings.define_settings :main, :maindir => { :type => :directory, :default => @prefix+"/maindir", :desc => "a" }
1114
+ @settings.define_settings :other, :otherdir => { :type => :directory, :default => @prefix+"/otherdir", :desc => "a" }
1115
+ catalog = @settings.to_catalog(:main)
1116
+ catalog.resource(:file, @prefix+"/otherdir").should be_nil
1117
+ catalog.resource(:file, @prefix+"/maindir").should be_instance_of(Puppet::Resource)
1118
+ end
1119
+
1120
+ it "should not try to add the same file twice" do
1121
+ @settings.define_settings :main, :maindir => { :type => :directory, :default => @prefix+"/maindir", :desc => "a" }
1122
+ @settings.define_settings :other, :otherdir => { :type => :directory, :default => @prefix+"/maindir", :desc => "a" }
1123
+ lambda { @settings.to_catalog }.should_not raise_error
1124
+ end
1125
+
1126
+ it "should ignore files whose :to_resource method returns nil" do
1127
+ @settings.define_settings :main, :maindir => { :type => :directory, :default => @prefix+"/maindir", :desc => "a" }
1128
+ @settings.setting(:maindir).expects(:to_resource).returns nil
1129
+
1130
+ Puppet::Resource::Catalog.any_instance.expects(:add_resource).never
1131
+ @settings.to_catalog
1132
+ end
1133
+
1134
+ describe "on Microsoft Windows" do
1135
+ before :each do
1136
+ Puppet.features.stubs(:root?).returns true
1137
+ Puppet.features.stubs(:microsoft_windows?).returns true
1138
+
1139
+ @settings.define_settings :foo,
1140
+ :mkusers => { :type => :boolean, :default => true, :desc => "e" },
1141
+ :user => { :default => "suser", :desc => "doc" },
1142
+ :group => { :default => "sgroup", :desc => "doc" }
1143
+ @settings.define_settings :other,
1144
+ :otherdir => { :type => :directory, :default => "/otherdir", :desc => "a", :owner => "service", :group => "service"}
1145
+
1146
+ @catalog = @settings.to_catalog
1147
+ end
1148
+
1149
+ it "it should not add users and groups to the catalog" do
1150
+ @catalog.resource(:user, "suser").should be_nil
1151
+ @catalog.resource(:group, "sgroup").should be_nil
1152
+ end
1153
+ end
1154
+
1155
+ describe "when adding users and groups to the catalog" do
1156
+ before do
1157
+ Puppet.features.stubs(:root?).returns true
1158
+ Puppet.features.stubs(:microsoft_windows?).returns false
1159
+
1160
+ @settings.define_settings :foo,
1161
+ :mkusers => { :type => :boolean, :default => true, :desc => "e" },
1162
+ :user => { :default => "suser", :desc => "doc" },
1163
+ :group => { :default => "sgroup", :desc => "doc" }
1164
+ @settings.define_settings :other, :otherdir => {:type => :directory, :default => "/otherdir", :desc => "a", :owner => "service", :group => "service"}
1165
+
1166
+ @catalog = @settings.to_catalog
1167
+ end
1168
+
1169
+ it "should add each specified user and group to the catalog if :mkusers is a valid setting, is enabled, and we're running as root" do
1170
+ @catalog.resource(:user, "suser").should be_instance_of(Puppet::Resource)
1171
+ @catalog.resource(:group, "sgroup").should be_instance_of(Puppet::Resource)
1172
+ end
1173
+
1174
+ it "should only add users and groups to the catalog from specified sections" do
1175
+ @settings.define_settings :yay, :yaydir => { :type => :directory, :default => "/yaydir", :desc => "a", :owner => "service", :group => "service"}
1176
+ catalog = @settings.to_catalog(:other)
1177
+ catalog.resource(:user, "jane").should be_nil
1178
+ catalog.resource(:group, "billy").should be_nil
1179
+ end
1180
+
1181
+ it "should not add users or groups to the catalog if :mkusers not running as root" do
1182
+ Puppet.features.stubs(:root?).returns false
1183
+
1184
+ catalog = @settings.to_catalog
1185
+ catalog.resource(:user, "suser").should be_nil
1186
+ catalog.resource(:group, "sgroup").should be_nil
1187
+ end
1188
+
1189
+ it "should not add users or groups to the catalog if :mkusers is not a valid setting" do
1190
+ Puppet.features.stubs(:root?).returns true
1191
+ settings = Puppet::Settings.new
1192
+ settings.define_settings :other, :otherdir => {:type => :directory, :default => "/otherdir", :desc => "a", :owner => "service", :group => "service"}
1193
+
1194
+ catalog = settings.to_catalog
1195
+ catalog.resource(:user, "suser").should be_nil
1196
+ catalog.resource(:group, "sgroup").should be_nil
1197
+ end
1198
+
1199
+ it "should not add users or groups to the catalog if :mkusers is a valid setting but is disabled" do
1200
+ @settings[:mkusers] = false
1201
+
1202
+ catalog = @settings.to_catalog
1203
+ catalog.resource(:user, "suser").should be_nil
1204
+ catalog.resource(:group, "sgroup").should be_nil
1205
+ end
1206
+
1207
+ it "should not try to add users or groups to the catalog twice" do
1208
+ @settings.define_settings :yay, :yaydir => {:type => :directory, :default => "/yaydir", :desc => "a", :owner => "service", :group => "service"}
1209
+
1210
+ # This would fail if users/groups were added twice
1211
+ lambda { @settings.to_catalog }.should_not raise_error
1212
+ end
1213
+
1214
+ it "should set :ensure to :present on each created user and group" do
1215
+ @catalog.resource(:user, "suser")[:ensure].should == :present
1216
+ @catalog.resource(:group, "sgroup")[:ensure].should == :present
1217
+ end
1218
+
1219
+ it "should set each created user's :gid to the service group" do
1220
+ @settings.to_catalog.resource(:user, "suser")[:gid].should == "sgroup"
1221
+ end
1222
+
1223
+ it "should not attempt to manage the root user" do
1224
+ Puppet.features.stubs(:root?).returns true
1225
+ @settings.define_settings :foo, :foodir => {:type => :directory, :default => "/foodir", :desc => "a", :owner => "root", :group => "service"}
1226
+
1227
+ @settings.to_catalog.resource(:user, "root").should be_nil
1228
+ end
1229
+ end
1230
+ end
1231
+
1232
+ it "should be able to be converted to a manifest" do
1233
+ Puppet::Settings.new.should respond_to(:to_manifest)
1234
+ end
1235
+
1236
+ describe "when being converted to a manifest" do
1237
+ it "should produce a string with the code for each resource joined by two carriage returns" do
1238
+ @settings = Puppet::Settings.new
1239
+ @settings.define_settings :main,
1240
+ :maindir => { :type => :directory, :default => "/maindir", :desc => "a"},
1241
+ :seconddir => { :type => :directory, :default => "/seconddir", :desc => "a"}
1242
+
1243
+ main = stub 'main_resource', :ref => "File[/maindir]"
1244
+ main.expects(:to_manifest).returns "maindir"
1245
+ second = stub 'second_resource', :ref => "File[/seconddir]"
1246
+ second.expects(:to_manifest).returns "seconddir"
1247
+ @settings.setting(:maindir).expects(:to_resource).returns main
1248
+ @settings.setting(:seconddir).expects(:to_resource).returns second
1249
+
1250
+ @settings.to_manifest.split("\n\n").sort.should == %w{maindir seconddir}
1251
+ end
1252
+ end
1253
+
1254
+ describe "when using sections of the configuration to manage the local host" do
1255
+ before do
1256
+ @settings = Puppet::Settings.new
1257
+ @settings.stubs(:service_user_available?).returns true
1258
+ @settings.define_settings :main, :noop => { :default => false, :desc => "", :type => :boolean }
1259
+ @settings.define_settings :main,
1260
+ :maindir => { :type => :directory, :default => make_absolute("/maindir"), :desc => "a" },
1261
+ :seconddir => { :type => :directory, :default => make_absolute("/seconddir"), :desc => "a"}
1262
+ @settings.define_settings :main, :user => { :default => "suser", :desc => "doc" }, :group => { :default => "sgroup", :desc => "doc" }
1263
+ @settings.define_settings :other, :otherdir => {:type => :directory, :default => make_absolute("/otherdir"), :desc => "a", :owner => "service", :group => "service", :mode => 0755}
1264
+ @settings.define_settings :third, :thirddir => { :type => :directory, :default => make_absolute("/thirddir"), :desc => "b"}
1265
+ @settings.define_settings :files, :myfile => {:type => :file, :default => make_absolute("/myfile"), :desc => "a", :mode => 0755}
1266
+ end
1267
+
1268
+ it "should provide a method that writes files with the correct modes" do
1269
+ @settings.should respond_to(:write)
1270
+ end
1271
+
1272
+ it "should provide a method that creates directories with the correct modes" do
1273
+ Puppet::Util::SUIDManager.expects(:asuser).with("suser", "sgroup").yields
1274
+ Dir.expects(:mkdir).with(make_absolute("/otherdir"), 0755)
1275
+ @settings.mkdir(:otherdir)
1276
+ end
1277
+
1278
+ it "should create a catalog with the specified sections" do
1279
+ @settings.expects(:to_catalog).with(:main, :other).returns Puppet::Resource::Catalog.new("foo")
1280
+ @settings.use(:main, :other)
1281
+ end
1282
+
1283
+ it "should canonicalize the sections" do
1284
+ @settings.expects(:to_catalog).with(:main, :other).returns Puppet::Resource::Catalog.new("foo")
1285
+ @settings.use("main", "other")
1286
+ end
1287
+
1288
+ it "should ignore sections that have already been used" do
1289
+ @settings.expects(:to_catalog).with(:main).returns Puppet::Resource::Catalog.new("foo")
1290
+ @settings.use(:main)
1291
+ @settings.expects(:to_catalog).with(:other).returns Puppet::Resource::Catalog.new("foo")
1292
+ @settings.use(:main, :other)
1293
+ end
1294
+
1295
+ it "should ignore tags and schedules when creating files and directories"
1296
+
1297
+ it "should be able to provide all of its parameters in a format compatible with GetOpt::Long" do
1298
+ pending "Not converted from test/unit yet"
1299
+ end
1300
+
1301
+ it "should convert the created catalog to a RAL catalog" do
1302
+ @catalog = Puppet::Resource::Catalog.new("foo")
1303
+ @settings.expects(:to_catalog).with(:main).returns @catalog
1304
+
1305
+ @catalog.expects(:to_ral).returns @catalog
1306
+ @settings.use(:main)
1307
+ end
1308
+
1309
+ it "should specify that it is not managing a host catalog" do
1310
+ catalog = Puppet::Resource::Catalog.new("foo")
1311
+ catalog.expects(:apply)
1312
+ @settings.expects(:to_catalog).returns catalog
1313
+
1314
+ catalog.stubs(:to_ral).returns catalog
1315
+
1316
+ catalog.expects(:host_config=).with false
1317
+
1318
+ @settings.use(:main)
1319
+ end
1320
+
1321
+ it "should support a method for re-using all currently used sections" do
1322
+ @settings.expects(:to_catalog).with(:main, :third).times(2).returns Puppet::Resource::Catalog.new("foo")
1323
+
1324
+ @settings.use(:main, :third)
1325
+ @settings.reuse
1326
+ end
1327
+
1328
+ it "should fail with an appropriate message if any resources fail" do
1329
+ @catalog = Puppet::Resource::Catalog.new("foo")
1330
+ @catalog.stubs(:to_ral).returns @catalog
1331
+ @settings.expects(:to_catalog).returns @catalog
1332
+
1333
+ @trans = mock("transaction")
1334
+ @catalog.expects(:apply).yields(@trans)
1335
+
1336
+ @trans.expects(:any_failed?).returns(true)
1337
+
1338
+ report = mock 'report'
1339
+ @trans.expects(:report).returns report
1340
+
1341
+ log = mock 'log', :to_s => "My failure", :level => :err
1342
+ report.expects(:logs).returns [log]
1343
+
1344
+ @settings.expects(:raise).with { |msg| msg.include?("My failure") }
1345
+ @settings.use(:whatever)
1346
+ end
1347
+ end
1348
+
1349
+ describe "when dealing with printing configs" do
1350
+ before do
1351
+ @settings = Puppet::Settings.new
1352
+ #these are the magic default values
1353
+ @settings.stubs(:value).with(:configprint).returns("")
1354
+ @settings.stubs(:value).with(:genconfig).returns(false)
1355
+ @settings.stubs(:value).with(:genmanifest).returns(false)
1356
+ @settings.stubs(:value).with(:environment).returns(nil)
1357
+ end
1358
+
1359
+ describe "when checking print_config?" do
1360
+ it "should return false when the :configprint, :genconfig and :genmanifest are not set" do
1361
+ @settings.print_configs?.should be_false
1362
+ end
1363
+
1364
+ it "should return true when :configprint has a value" do
1365
+ @settings.stubs(:value).with(:configprint).returns("something")
1366
+ @settings.print_configs?.should be_true
1367
+ end
1368
+
1369
+ it "should return true when :genconfig has a value" do
1370
+ @settings.stubs(:value).with(:genconfig).returns(true)
1371
+ @settings.print_configs?.should be_true
1372
+ end
1373
+
1374
+ it "should return true when :genmanifest has a value" do
1375
+ @settings.stubs(:value).with(:genmanifest).returns(true)
1376
+ @settings.print_configs?.should be_true
1377
+ end
1378
+ end
1379
+
1380
+ describe "when printing configs" do
1381
+ describe "when :configprint has a value" do
1382
+ it "should call print_config_options" do
1383
+ @settings.stubs(:value).with(:configprint).returns("something")
1384
+ @settings.expects(:print_config_options)
1385
+ @settings.print_configs
1386
+ end
1387
+
1388
+ it "should get the value of the option using the environment" do
1389
+ @settings.stubs(:value).with(:configprint).returns("something")
1390
+ @settings.stubs(:include?).with("something").returns(true)
1391
+ @settings.expects(:value).with(:environment).returns("env")
1392
+ @settings.expects(:value).with("something", "env").returns("foo")
1393
+ @settings.stubs(:puts).with("foo")
1394
+ @settings.print_configs
1395
+ end
1396
+
1397
+ it "should print the value of the option" do
1398
+ @settings.stubs(:value).with(:configprint).returns("something")
1399
+ @settings.stubs(:include?).with("something").returns(true)
1400
+ @settings.stubs(:value).with("something", nil).returns("foo")
1401
+ @settings.expects(:puts).with("foo")
1402
+ @settings.print_configs
1403
+ end
1404
+
1405
+ it "should print the value pairs if there are multiple options" do
1406
+ @settings.stubs(:value).with(:configprint).returns("bar,baz")
1407
+ @settings.stubs(:include?).with("bar").returns(true)
1408
+ @settings.stubs(:include?).with("baz").returns(true)
1409
+ @settings.stubs(:value).with("bar", nil).returns("foo")
1410
+ @settings.stubs(:value).with("baz", nil).returns("fud")
1411
+ @settings.expects(:puts).with("bar = foo")
1412
+ @settings.expects(:puts).with("baz = fud")
1413
+ @settings.print_configs
1414
+ end
1415
+
1416
+ it "should print a whole bunch of stuff if :configprint = all"
1417
+
1418
+ it "should return true after printing" do
1419
+ @settings.stubs(:value).with(:configprint).returns("something")
1420
+ @settings.stubs(:include?).with("something").returns(true)
1421
+ @settings.stubs(:value).with("something", nil).returns("foo")
1422
+ @settings.stubs(:puts).with("foo")
1423
+ @settings.print_configs.should be_true
1424
+ end
1425
+
1426
+ it "should return false if a config param is not found" do
1427
+ @settings.stubs :puts
1428
+ @settings.stubs(:value).with(:configprint).returns("something")
1429
+ @settings.stubs(:include?).with("something").returns(false)
1430
+ @settings.print_configs.should be_false
1431
+ end
1432
+ end
1433
+
1434
+ describe "when genconfig is true" do
1435
+ before do
1436
+ @settings.stubs :puts
1437
+ end
1438
+
1439
+ it "should call to_config" do
1440
+ @settings.stubs(:value).with(:genconfig).returns(true)
1441
+ @settings.expects(:to_config)
1442
+ @settings.print_configs
1443
+ end
1444
+
1445
+ it "should return true from print_configs" do
1446
+ @settings.stubs(:value).with(:genconfig).returns(true)
1447
+ @settings.stubs(:to_config)
1448
+ @settings.print_configs.should be_true
1449
+ end
1450
+ end
1451
+
1452
+ describe "when genmanifest is true" do
1453
+ before do
1454
+ @settings.stubs :puts
1455
+ end
1456
+
1457
+ it "should call to_config" do
1458
+ @settings.stubs(:value).with(:genmanifest).returns(true)
1459
+ @settings.expects(:to_manifest)
1460
+ @settings.print_configs
1461
+ end
1462
+
1463
+ it "should return true from print_configs" do
1464
+ @settings.stubs(:value).with(:genmanifest).returns(true)
1465
+ @settings.stubs(:to_manifest)
1466
+ @settings.print_configs.should be_true
1467
+ end
1468
+ end
1469
+ end
1470
+ end
1471
+
1472
+ describe "when determining if the service user is available" do
1473
+ it "should return false if there is no user setting" do
1474
+ Puppet::Settings.new.should_not be_service_user_available
1475
+ end
1476
+
1477
+ it "should return false if the user provider says the user is missing" do
1478
+ settings = Puppet::Settings.new
1479
+ settings.define_settings :main, :user => { :default => "foo", :desc => "doc" }
1480
+
1481
+ user = mock 'user'
1482
+ user.expects(:exists?).returns false
1483
+
1484
+ Puppet::Type.type(:user).expects(:new).with { |args| args[:name] == "foo" }.returns user
1485
+
1486
+ settings.should_not be_service_user_available
1487
+ end
1488
+
1489
+ it "should return true if the user provider says the user is present" do
1490
+ settings = Puppet::Settings.new
1491
+ settings.define_settings :main, :user => { :default => "foo", :desc => "doc" }
1492
+
1493
+ user = mock 'user'
1494
+ user.expects(:exists?).returns true
1495
+
1496
+ Puppet::Type.type(:user).expects(:new).with { |args| args[:name] == "foo" }.returns user
1497
+
1498
+ settings.should be_service_user_available
1499
+ end
1500
+
1501
+ it "should cache the result"
1502
+ end
1503
+
1504
+ describe "#writesub" do
1505
+ it "should only pass valid arguments to File.open" do
1506
+ settings = Puppet::Settings.new
1507
+ settings.stubs(:get_config_file_default).with(:privatekeydir).returns(OpenStruct.new(:mode => "750"))
1508
+
1509
+ File.expects(:open).with("/path/to/keydir", "w", 750).returns true
1510
+ settings.writesub(:privatekeydir, "/path/to/keydir")
1511
+ end
1512
+ end
1513
+
1514
+
1515
+ describe "when dealing with command-line options" do
1516
+ let(:settings) { Puppet::Settings.new }
1517
+
1518
+ it "should get options from Puppet.settings.optparse_addargs" do
1519
+ settings.expects(:optparse_addargs).returns([])
1520
+
1521
+ settings.send(:parse_global_options, [])
1522
+ end
1523
+
1524
+ it "should add options to OptionParser" do
1525
+ settings.stubs(:optparse_addargs).returns( [["--option","-o", "Funny Option", :NONE]])
1526
+ settings.expects(:handlearg).with("--option", true)
1527
+ settings.send(:parse_global_options, ["--option"])
1528
+ end
1529
+
1530
+ it "should not die if it sees an unrecognized option, because the app/face may handle it later" do
1531
+ expect { settings.send(:parse_global_options, ["--topuppet", "value"]) } .to_not raise_error
1532
+ end
1533
+
1534
+ it "should not pass an unrecognized option to handleargs" do
1535
+ settings.expects(:handlearg).with("--topuppet", "value").never
1536
+ expect { settings.send(:parse_global_options, ["--topuppet", "value"]) } .to_not raise_error
1537
+ end
1538
+
1539
+ it "should pass valid puppet settings options to handlearg even if they appear after an unrecognized option" do
1540
+ settings.stubs(:optparse_addargs).returns( [["--option","-o", "Funny Option", :NONE]])
1541
+ settings.expects(:handlearg).with("--option", true)
1542
+ settings.send(:parse_global_options, ["--invalidoption", "--option"])
1543
+ end
1544
+
1545
+ it "should transform boolean option to normal form" do
1546
+ Puppet::Settings.clean_opt("--[no-]option", true).should == ["--option", true]
1547
+ end
1548
+
1549
+ it "should transform boolean option to no- form" do
1550
+ Puppet::Settings.clean_opt("--[no-]option", false).should == ["--no-option", false]
1551
+ end
1552
+ end
1553
+
1554
+ describe "default_certname" do
1555
+ describe "using hostname and domainname" do
1556
+ before :each do
1557
+ Puppet::Settings.stubs(:hostname_fact).returns("testhostname")
1558
+ Puppet::Settings.stubs(:domain_fact).returns("domain.test.")
1559
+ end
1560
+
1561
+ it "should use both to generate fqdn" do
1562
+ Puppet::Settings.default_certname.should =~ /testhostname\.domain\.test/
1563
+ end
1564
+ it "should remove trailing dots from fqdn" do
1565
+ Puppet::Settings.default_certname.should == 'testhostname.domain.test'
1566
+ end
1567
+ end
1568
+
1569
+ describe "using just hostname" do
1570
+ before :each do
1571
+ Puppet::Settings.stubs(:hostname_fact).returns("testhostname")
1572
+ Puppet::Settings.stubs(:domain_fact).returns("")
1573
+ end
1574
+
1575
+ it "should use only hostname to generate fqdn" do
1576
+ Puppet::Settings.default_certname.should == "testhostname"
1577
+ end
1578
+ it "should removing trailing dots from fqdn" do
1579
+ Puppet::Settings.default_certname.should == "testhostname"
1580
+ end
1581
+ end
1582
+ end
1583
+ end