puppet 3.2.4 → 3.3.0.rc2

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 (562) hide show
  1. data/COMMITTERS.md +101 -42
  2. data/Gemfile +15 -4
  3. data/README.md +5 -1
  4. data/README_DEVELOPER.md +117 -54
  5. data/Rakefile +4 -0
  6. data/ext/build_defaults.yaml +3 -2
  7. data/ext/debian/puppet-common.manpages +33 -1
  8. data/ext/gentoo/init.d/puppet +1 -1
  9. data/ext/gentoo/init.d/puppetmaster +1 -1
  10. data/ext/redhat/puppet.spec.erb +0 -1
  11. data/install.rb +2 -1
  12. data/lib/hiera/backend/puppet_backend.rb +1 -1
  13. data/lib/puppet/application.rb +10 -9
  14. data/lib/puppet/application/agent.rb +87 -93
  15. data/lib/puppet/application/apply.rb +0 -2
  16. data/lib/puppet/application/device.rb +3 -3
  17. data/lib/puppet/application/kick.rb +2 -2
  18. data/lib/puppet/application/master.rb +41 -19
  19. data/lib/puppet/application/queue.rb +5 -3
  20. data/lib/puppet/bindings.rb +147 -0
  21. data/lib/puppet/configurer.rb +25 -15
  22. data/lib/puppet/configurer/fact_handler.rb +2 -9
  23. data/lib/puppet/daemon.rb +44 -33
  24. data/lib/puppet/defaults.rb +57 -26
  25. data/lib/puppet/error.rb +1 -1
  26. data/lib/puppet/external/dot.rb +2 -2
  27. data/lib/puppet/external/nagios/base.rb +1 -6
  28. data/lib/puppet/external/pson/common.rb +2 -2
  29. data/lib/puppet/external/pson/pure/generator.rb +2 -2
  30. data/lib/puppet/external/pson/pure/parser.rb +1 -1
  31. data/lib/puppet/face/ca.rb +1 -1
  32. data/lib/puppet/face/config.rb +1 -1
  33. data/lib/puppet/face/help.rb +2 -2
  34. data/lib/puppet/face/module/list.rb +2 -2
  35. data/lib/puppet/feature/rails.rb +1 -1
  36. data/lib/puppet/file_bucket/dipper.rb +0 -1
  37. data/lib/puppet/file_serving/base.rb +1 -1
  38. data/lib/puppet/file_serving/configuration/parser.rb +20 -14
  39. data/lib/puppet/forge.rb +0 -32
  40. data/lib/puppet/forge/cache.rb +1 -1
  41. data/lib/puppet/forge/errors.rb +3 -3
  42. data/lib/puppet/forge/repository.rb +7 -42
  43. data/lib/puppet/graph.rb +11 -0
  44. data/lib/puppet/graph/key.rb +26 -0
  45. data/lib/puppet/graph/prioritizer.rb +29 -0
  46. data/lib/puppet/graph/random_prioritizer.rb +16 -0
  47. data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
  48. data/lib/puppet/graph/relationship_graph.rb +246 -0
  49. data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
  50. data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
  51. data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
  52. data/lib/puppet/indirector.rb +2 -2
  53. data/lib/puppet/indirector/catalog/compiler.rb +10 -7
  54. data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
  55. data/lib/puppet/indirector/certificate/rest.rb +1 -1
  56. data/lib/puppet/indirector/exec.rb +1 -1
  57. data/lib/puppet/indirector/facts/facter.rb +2 -2
  58. data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
  59. data/lib/puppet/indirector/facts/network_device.rb +1 -1
  60. data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
  61. data/lib/puppet/indirector/indirection.rb +2 -2
  62. data/lib/puppet/indirector/memory.rb +9 -0
  63. data/lib/puppet/indirector/node/ldap.rb +2 -4
  64. data/lib/puppet/indirector/report/processor.rb +1 -2
  65. data/lib/puppet/indirector/report/rest.rb +1 -1
  66. data/lib/puppet/indirector/request.rb +32 -10
  67. data/lib/puppet/indirector/resource/rest.rb +1 -1
  68. data/lib/puppet/indirector/resource_type/parser.rb +31 -12
  69. data/lib/puppet/interface.rb +1 -1
  70. data/lib/puppet/interface/documentation.rb +7 -11
  71. data/lib/puppet/interface/option.rb +1 -1
  72. data/lib/puppet/interface/option_builder.rb +1 -1
  73. data/lib/puppet/metatype/manager.rb +2 -2
  74. data/lib/puppet/module.rb +7 -1
  75. data/lib/puppet/module_tool.rb +1 -1
  76. data/lib/puppet/module_tool/applications/application.rb +10 -0
  77. data/lib/puppet/module_tool/applications/installer.rb +6 -3
  78. data/lib/puppet/module_tool/dependency.rb +2 -0
  79. data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
  80. data/lib/puppet/module_tool/metadata.rb +25 -13
  81. data/lib/puppet/module_tool/modulefile.rb +7 -7
  82. data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
  83. data/lib/puppet/module_tool/skeleton.rb +1 -1
  84. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
  85. data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
  86. data/lib/puppet/network/auth_config_parser.rb +3 -0
  87. data/lib/puppet/network/authconfig.rb +0 -1
  88. data/lib/puppet/network/authorization.rb +1 -1
  89. data/lib/puppet/network/authstore.rb +2 -2
  90. data/lib/puppet/network/format_handler.rb +25 -114
  91. data/lib/puppet/network/format_support.rb +106 -0
  92. data/lib/puppet/network/formats.rb +10 -4
  93. data/lib/puppet/network/http/compression.rb +1 -1
  94. data/lib/puppet/network/http/connection.rb +76 -32
  95. data/lib/puppet/network/http/handler.rb +122 -61
  96. data/lib/puppet/network/http/rack/rest.rb +1 -1
  97. data/lib/puppet/network/http/webrick/rest.rb +9 -3
  98. data/lib/puppet/network/http_pool.rb +2 -2
  99. data/lib/puppet/network/resolver.rb +1 -0
  100. data/lib/puppet/network/server.rb +5 -81
  101. data/lib/puppet/node/environment.rb +256 -13
  102. data/lib/puppet/node/facts.rb +28 -2
  103. data/lib/puppet/parameter.rb +27 -18
  104. data/lib/puppet/parameter/boolean.rb +20 -0
  105. data/lib/puppet/parameter/path.rb +1 -1
  106. data/lib/puppet/parameter/value.rb +1 -1
  107. data/lib/puppet/parameter/value_collection.rb +1 -1
  108. data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
  109. data/lib/puppet/parser/ast/casestatement.rb +0 -3
  110. data/lib/puppet/parser/ast/lambda.rb +25 -6
  111. data/lib/puppet/parser/ast/leaf.rb +10 -3
  112. data/lib/puppet/parser/ast/nop.rb +1 -1
  113. data/lib/puppet/parser/ast/resource_override.rb +0 -2
  114. data/lib/puppet/parser/compiler.rb +92 -34
  115. data/lib/puppet/parser/files.rb +0 -5
  116. data/lib/puppet/parser/functions/create_resources.rb +23 -46
  117. data/lib/puppet/parser/functions/each.rb +0 -2
  118. data/lib/puppet/parser/functions/extlookup.rb +2 -2
  119. data/lib/puppet/parser/functions/foreach.rb +0 -2
  120. data/lib/puppet/parser/functions/hiera_include.rb +1 -1
  121. data/lib/puppet/parser/functions/lookup.rb +44 -0
  122. data/lib/puppet/parser/functions/slice.rb +1 -1
  123. data/lib/puppet/parser/grammar.ra +0 -1
  124. data/lib/puppet/parser/lexer.rb +0 -1
  125. data/lib/puppet/parser/parser.rb +0 -1
  126. data/lib/puppet/parser/parser_factory.rb +3 -2
  127. data/lib/puppet/parser/parser_support.rb +1 -1
  128. data/lib/puppet/parser/relationship.rb +1 -1
  129. data/lib/puppet/parser/scope.rb +49 -24
  130. data/lib/puppet/parser/type_loader.rb +13 -18
  131. data/lib/puppet/pops.rb +45 -0
  132. data/lib/puppet/pops/adaptable.rb +2 -2
  133. data/lib/puppet/pops/adapters.rb +4 -0
  134. data/lib/puppet/pops/binder/binder.rb +421 -0
  135. data/lib/puppet/pops/binder/binder_issues.rb +142 -0
  136. data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
  137. data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
  138. data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
  139. data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
  140. data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
  141. data/lib/puppet/pops/binder/bindings_model.rb +215 -0
  142. data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
  143. data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
  144. data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
  145. data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
  146. data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
  147. data/lib/puppet/pops/binder/config/issues.rb +106 -0
  148. data/lib/puppet/pops/binder/hiera2.rb +10 -0
  149. data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
  150. data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
  151. data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
  152. data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
  153. data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
  154. data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
  155. data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
  156. data/lib/puppet/pops/binder/injector.rb +688 -0
  157. data/lib/puppet/pops/binder/injector_entry.rb +53 -0
  158. data/lib/puppet/pops/binder/key_factory.rb +61 -0
  159. data/lib/puppet/pops/binder/producers.rb +829 -0
  160. data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
  161. data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
  162. data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
  163. data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
  164. data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
  165. data/lib/puppet/pops/binder/system_bindings.rb +72 -0
  166. data/lib/puppet/pops/issue_reporter.rb +75 -0
  167. data/lib/puppet/pops/issues.rb +9 -5
  168. data/lib/puppet/pops/model/ast_transformer.rb +4 -4
  169. data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
  170. data/lib/puppet/pops/model/factory.rb +25 -13
  171. data/lib/puppet/pops/model/model.rb +1 -1
  172. data/lib/puppet/pops/model/tree_dumper.rb +2 -2
  173. data/lib/puppet/pops/parser/egrammar.ra +0 -1
  174. data/lib/puppet/pops/parser/eparser.rb +1 -2
  175. data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
  176. data/lib/puppet/pops/parser/lexer.rb +8 -6
  177. data/lib/puppet/pops/types/class_loader.rb +118 -0
  178. data/lib/puppet/pops/types/type_calculator.rb +557 -0
  179. data/lib/puppet/pops/types/type_factory.rb +147 -0
  180. data/lib/puppet/pops/types/type_parser.rb +117 -0
  181. data/lib/puppet/pops/types/types.rb +132 -0
  182. data/lib/puppet/pops/validation.rb +146 -17
  183. data/lib/puppet/pops/validation/checker3_1.rb +1 -1
  184. data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
  185. data/lib/puppet/property.rb +3 -3
  186. data/lib/puppet/property/keyvalue.rb +1 -1
  187. data/lib/puppet/provider.rb +2 -2
  188. data/lib/puppet/provider/aixobject.rb +19 -21
  189. data/lib/puppet/provider/augeas/augeas.rb +3 -1
  190. data/lib/puppet/provider/command.rb +2 -2
  191. data/lib/puppet/provider/group/aix.rb +1 -1
  192. data/lib/puppet/provider/group/ldap.rb +1 -1
  193. data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
  194. data/lib/puppet/provider/mailalias/aliases.rb +3 -8
  195. data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
  196. data/lib/puppet/provider/mount.rb +8 -3
  197. data/lib/puppet/provider/nameservice.rb +1 -1
  198. data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
  199. data/lib/puppet/provider/package/appdmg.rb +1 -1
  200. data/lib/puppet/provider/package/apt.rb +0 -1
  201. data/lib/puppet/provider/package/dpkg.rb +86 -32
  202. data/lib/puppet/provider/package/fink.rb +0 -2
  203. data/lib/puppet/provider/package/freebsd.rb +0 -2
  204. data/lib/puppet/provider/package/openbsd.rb +57 -10
  205. data/lib/puppet/provider/package/opkg.rb +0 -1
  206. data/lib/puppet/provider/package/pacman.rb +0 -1
  207. data/lib/puppet/provider/package/pip.rb +1 -1
  208. data/lib/puppet/provider/package/pkgdmg.rb +17 -6
  209. data/lib/puppet/provider/package/pkgutil.rb +1 -1
  210. data/lib/puppet/provider/package/portage.rb +9 -1
  211. data/lib/puppet/provider/package/ports.rb +2 -2
  212. data/lib/puppet/provider/package/rpm.rb +29 -12
  213. data/lib/puppet/provider/package/rug.rb +1 -1
  214. data/lib/puppet/provider/package/urpmi.rb +11 -15
  215. data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
  216. data/lib/puppet/provider/package/windows/package.rb +1 -26
  217. data/lib/puppet/provider/package/yum.rb +1 -1
  218. data/lib/puppet/provider/package/zypper.rb +22 -3
  219. data/lib/puppet/provider/parsedfile.rb +1 -12
  220. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
  221. data/lib/puppet/provider/service/base.rb +1 -1
  222. data/lib/puppet/provider/service/daemontools.rb +3 -3
  223. data/lib/puppet/provider/service/debian.rb +1 -1
  224. data/lib/puppet/provider/service/init.rb +14 -20
  225. data/lib/puppet/provider/service/openrc.rb +3 -1
  226. data/lib/puppet/provider/service/redhat.rb +5 -8
  227. data/lib/puppet/provider/service/runit.rb +3 -2
  228. data/lib/puppet/provider/service/systemd.rb +1 -1
  229. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
  230. data/lib/puppet/provider/sshkey/parsed.rb +0 -2
  231. data/lib/puppet/provider/user/aix.rb +25 -12
  232. data/lib/puppet/provider/user/directoryservice.rb +4 -7
  233. data/lib/puppet/provider/user/ldap.rb +0 -1
  234. data/lib/puppet/provider/user/user_role_add.rb +2 -0
  235. data/lib/puppet/provider/user/useradd.rb +1 -1
  236. data/lib/puppet/provider/zone/solaris.rb +1 -2
  237. data/lib/puppet/reference/metaparameter.rb +1 -1
  238. data/lib/puppet/reference/type.rb +1 -1
  239. data/lib/puppet/reports/rrdgraph.rb +1 -1
  240. data/lib/puppet/reports/tagmail.rb +1 -1
  241. data/lib/puppet/resource.rb +16 -4
  242. data/lib/puppet/resource/catalog.rb +111 -173
  243. data/lib/puppet/resource/status.rb +42 -3
  244. data/lib/puppet/resource/type.rb +33 -46
  245. data/lib/puppet/resource/type_collection.rb +19 -15
  246. data/lib/puppet/run.rb +5 -1
  247. data/lib/puppet/scheduler/scheduler.rb +14 -15
  248. data/lib/puppet/settings.rb +78 -41
  249. data/lib/puppet/settings/boolean_setting.rb +0 -2
  250. data/lib/puppet/settings/config_file.rb +0 -2
  251. data/lib/puppet/settings/directory_setting.rb +0 -2
  252. data/lib/puppet/settings/duration_setting.rb +0 -2
  253. data/lib/puppet/settings/enum_setting.rb +16 -0
  254. data/lib/puppet/settings/file_setting.rb +0 -2
  255. data/lib/puppet/settings/path_setting.rb +0 -2
  256. data/lib/puppet/settings/string_setting.rb +0 -3
  257. data/lib/puppet/settings/terminus_setting.rb +0 -2
  258. data/lib/puppet/ssl/certificate_authority.rb +102 -9
  259. data/lib/puppet/test/test_helper.rb +1 -0
  260. data/lib/puppet/transaction.rb +130 -292
  261. data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
  262. data/lib/puppet/transaction/event.rb +16 -1
  263. data/lib/puppet/transaction/report.rb +34 -14
  264. data/lib/puppet/transaction/resource_harness.rb +16 -19
  265. data/lib/puppet/type.rb +59 -53
  266. data/lib/puppet/type/component.rb +0 -2
  267. data/lib/puppet/type/cron.rb +13 -2
  268. data/lib/puppet/type/exec.rb +5 -7
  269. data/lib/puppet/type/file.rb +9 -32
  270. data/lib/puppet/type/file/content.rb +4 -1
  271. data/lib/puppet/type/file/ctime.rb +3 -1
  272. data/lib/puppet/type/file/ensure.rb +1 -1
  273. data/lib/puppet/type/file/mode.rb +0 -1
  274. data/lib/puppet/type/file/mtime.rb +2 -1
  275. data/lib/puppet/type/group.rb +7 -9
  276. data/lib/puppet/type/host.rb +1 -2
  277. data/lib/puppet/type/mcx.rb +0 -1
  278. data/lib/puppet/type/mount.rb +38 -6
  279. data/lib/puppet/type/package.rb +2 -2
  280. data/lib/puppet/type/resources.rb +5 -4
  281. data/lib/puppet/type/schedule.rb +1 -4
  282. data/lib/puppet/type/selmodule.rb +1 -1
  283. data/lib/puppet/type/service.rb +1 -3
  284. data/lib/puppet/type/tidy.rb +3 -3
  285. data/lib/puppet/type/user.rb +9 -13
  286. data/lib/puppet/type/yumrepo.rb +11 -7
  287. data/lib/puppet/util.rb +14 -7
  288. data/lib/puppet/util/autoload.rb +0 -1
  289. data/lib/puppet/util/backups.rb +1 -3
  290. data/lib/puppet/util/classgen.rb +1 -1
  291. data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
  292. data/lib/puppet/util/command_line/trollop.rb +1 -1
  293. data/lib/puppet/util/constant_inflector.rb +1 -2
  294. data/lib/puppet/util/errors.rb +1 -0
  295. data/lib/puppet/util/file_watcher.rb +28 -0
  296. data/lib/puppet/util/fileparsing.rb +1 -3
  297. data/lib/puppet/util/filetype.rb +0 -1
  298. data/lib/puppet/util/http_proxy.rb +38 -0
  299. data/lib/puppet/util/ldap/manager.rb +1 -2
  300. data/lib/puppet/util/log.rb +31 -10
  301. data/lib/puppet/util/log/destinations.rb +0 -50
  302. data/lib/puppet/util/metric.rb +8 -1
  303. data/lib/puppet/util/monkey_patches.rb +14 -148
  304. data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
  305. data/lib/puppet/util/network_device/config.rb +6 -9
  306. data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
  307. data/lib/puppet/util/pidlock.rb +3 -0
  308. data/lib/puppet/util/posix.rb +1 -1
  309. data/lib/puppet/util/profiler.rb +1 -1
  310. data/lib/puppet/util/rdoc.rb +1 -1
  311. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
  312. data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
  313. data/lib/puppet/util/retryaction.rb +0 -1
  314. data/lib/puppet/util/symbolic_file_mode.rb +5 -1
  315. data/lib/puppet/util/tagging.rb +0 -2
  316. data/lib/puppet/util/warnings.rb +3 -0
  317. data/lib/puppet/util/watched_file.rb +37 -0
  318. data/lib/puppet/util/watcher.rb +17 -0
  319. data/lib/puppet/util/watcher/change_watcher.rb +33 -0
  320. data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
  321. data/lib/puppet/util/watcher/timer.rb +19 -0
  322. data/lib/puppet/util/windows/user.rb +1 -1
  323. data/lib/puppet/version.rb +1 -1
  324. data/lib/puppetx.rb +109 -0
  325. data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
  326. data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
  327. data/lib/puppetx/puppet/syntax_checker.rb +91 -0
  328. data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
  329. data/lib/semver.rb +1 -1
  330. data/man/man8/puppet-kick.8 +1 -1
  331. data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
  332. data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
  333. data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
  334. data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
  335. data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
  336. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
  337. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
  338. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
  339. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
  340. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
  341. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
  342. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
  343. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
  344. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
  345. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
  346. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
  347. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
  348. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
  349. data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
  350. data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
  351. data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
  352. data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
  353. data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
  354. data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
  355. data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
  356. data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
  357. data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
  358. data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
  359. data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
  360. data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
  361. data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
  362. data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
  363. data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
  364. data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
  365. data/spec/integration/agent/logging_spec.rb +178 -0
  366. data/spec/integration/configurer_spec.rb +1 -1
  367. data/spec/integration/defaults_spec.rb +0 -6
  368. data/spec/integration/network/authconfig_spec.rb +19 -0
  369. data/spec/integration/network/server/webrick_spec.rb +10 -11
  370. data/spec/integration/parser/catalog_spec.rb +85 -0
  371. data/spec/integration/provider/cron/crontab_spec.rb +11 -0
  372. data/spec/integration/provider/mount_spec.rb +1 -0
  373. data/spec/integration/transaction_spec.rb +8 -8
  374. data/spec/integration/type/file_spec.rb +1 -1
  375. data/spec/integration/util/settings_spec.rb +58 -11
  376. data/spec/lib/matchers/include_in_order.rb +21 -0
  377. data/spec/lib/matchers/include_in_order_spec.rb +30 -0
  378. data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
  379. data/spec/lib/puppet_spec/compiler.rb +24 -0
  380. data/spec/lib/puppet_spec/pops.rb +16 -0
  381. data/spec/spec_helper.rb +0 -1
  382. data/spec/unit/application/agent_spec.rb +145 -145
  383. data/spec/unit/application/apply_spec.rb +1 -1
  384. data/spec/unit/application/doc_spec.rb +1 -1
  385. data/spec/unit/application/face_base_spec.rb +3 -3
  386. data/spec/unit/application/facts_spec.rb +1 -0
  387. data/spec/unit/application/master_spec.rb +0 -15
  388. data/spec/unit/application/queue_spec.rb +6 -12
  389. data/spec/unit/application/resource_spec.rb +1 -1
  390. data/spec/unit/configurer/fact_handler_spec.rb +19 -50
  391. data/spec/unit/configurer_spec.rb +23 -7
  392. data/spec/unit/daemon_spec.rb +97 -121
  393. data/spec/unit/defaults_spec.rb +44 -0
  394. data/spec/unit/face/node_spec.rb +2 -2
  395. data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
  396. data/spec/unit/file_serving/configuration_spec.rb +2 -2
  397. data/spec/unit/file_serving/mount/file_spec.rb +4 -4
  398. data/spec/unit/forge/repository_spec.rb +9 -29
  399. data/spec/unit/graph/key_spec.rb +41 -0
  400. data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
  401. data/spec/unit/graph/relationship_graph_spec.rb +393 -0
  402. data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
  403. data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
  404. data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
  405. data/spec/unit/hiera_puppet_spec.rb +1 -1
  406. data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
  407. data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
  408. data/spec/unit/indirector/face_spec.rb +1 -1
  409. data/spec/unit/indirector/facts/facter_spec.rb +11 -1
  410. data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
  411. data/spec/unit/indirector/hiera_spec.rb +1 -1
  412. data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
  413. data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
  414. data/spec/unit/indirector/request_spec.rb +92 -39
  415. data/spec/unit/indirector/rest_spec.rb +1 -0
  416. data/spec/unit/indirector_spec.rb +2 -2
  417. data/spec/unit/interface/option_builder_spec.rb +1 -0
  418. data/spec/unit/interface/option_spec.rb +1 -0
  419. data/spec/unit/interface_spec.rb +2 -2
  420. data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
  421. data/spec/unit/module_tool/metadata_spec.rb +13 -0
  422. data/spec/unit/network/authstore_spec.rb +1 -1
  423. data/spec/unit/network/format_handler_spec.rb +33 -282
  424. data/spec/unit/network/format_support_spec.rb +199 -0
  425. data/spec/unit/network/formats_spec.rb +2 -2
  426. data/spec/unit/network/http/connection_spec.rb +88 -7
  427. data/spec/unit/network/http/handler_spec.rb +271 -249
  428. data/spec/unit/network/http/rack/rest_spec.rb +1 -1
  429. data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
  430. data/spec/unit/network/http_pool_spec.rb +40 -0
  431. data/spec/unit/network/server_spec.rb +18 -207
  432. data/spec/unit/node/facts_spec.rb +68 -17
  433. data/spec/unit/other/selinux_spec.rb +24 -20
  434. data/spec/unit/parameter/boolean_spec.rb +25 -0
  435. data/spec/unit/parameter/value_collection_spec.rb +7 -7
  436. data/spec/unit/parameter_spec.rb +10 -13
  437. data/spec/unit/parser/ast/function_spec.rb +4 -4
  438. data/spec/unit/parser/ast/leaf_spec.rb +45 -6
  439. data/spec/unit/parser/collector_spec.rb +3 -3
  440. data/spec/unit/parser/compiler_spec.rb +4 -3
  441. data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
  442. data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
  443. data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
  444. data/spec/unit/parser/functions/lookup_spec.rb +96 -0
  445. data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
  446. data/spec/unit/parser/functions/split_spec.rb +2 -2
  447. data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
  448. data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
  449. data/spec/unit/parser/functions_spec.rb +7 -7
  450. data/spec/unit/parser/lexer_spec.rb +1 -1
  451. data/spec/unit/parser/methods/collect_spec.rb +43 -0
  452. data/spec/unit/parser/resource_spec.rb +9 -9
  453. data/spec/unit/parser/scope_spec.rb +45 -2
  454. data/spec/unit/parser/type_loader_spec.rb +159 -175
  455. data/spec/unit/pops/binder/binder_spec.rb +62 -0
  456. data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
  457. data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
  458. data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
  459. data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
  460. data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
  461. data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
  462. data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
  463. data/spec/unit/pops/binder/injector_spec.rb +789 -0
  464. data/spec/unit/pops/containment_spec.rb +1 -0
  465. data/spec/unit/pops/issues_spec.rb +1 -1
  466. data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
  467. data/spec/unit/pops/parser/lexer_spec.rb +1 -1
  468. data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
  469. data/spec/unit/pops/parser/parser_spec.rb +1 -1
  470. data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
  471. data/spec/unit/pops/types/type_factory_spec.rb +65 -0
  472. data/spec/unit/pops/types/type_parser_spec.rb +93 -0
  473. data/spec/unit/property/list_spec.rb +1 -1
  474. data/spec/unit/property/ordered_list_spec.rb +1 -1
  475. data/spec/unit/provider/aixobject_spec.rb +101 -0
  476. data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
  477. data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
  478. data/spec/unit/provider/mount/parsed_spec.rb +44 -56
  479. data/spec/unit/provider/mount_spec.rb +11 -2
  480. data/spec/unit/provider/naginator_spec.rb +8 -0
  481. data/spec/unit/provider/package/apt_spec.rb +5 -1
  482. data/spec/unit/provider/package/aptitude_spec.rb +9 -5
  483. data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
  484. data/spec/unit/provider/package/dpkg_spec.rb +274 -99
  485. data/spec/unit/provider/package/openbsd_spec.rb +84 -1
  486. data/spec/unit/provider/package/opkg_spec.rb +3 -3
  487. data/spec/unit/provider/package/pip_spec.rb +16 -0
  488. data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
  489. data/spec/unit/provider/package/rpm_spec.rb +112 -21
  490. data/spec/unit/provider/package/urpmi.rb +80 -0
  491. data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
  492. data/spec/unit/provider/package/yum_spec.rb +85 -0
  493. data/spec/unit/provider/package/zypper_spec.rb +25 -6
  494. data/spec/unit/provider/parsedfile_spec.rb +3 -2
  495. data/spec/unit/provider/service/init_spec.rb +10 -10
  496. data/spec/unit/provider/service/openrc_spec.rb +16 -0
  497. data/spec/unit/provider/service/openwrt_spec.rb +1 -1
  498. data/spec/unit/provider/service/redhat_spec.rb +7 -0
  499. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
  500. data/spec/unit/provider/user/aix_spec.rb +89 -0
  501. data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
  502. data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
  503. data/spec/unit/provider_spec.rb +2 -13
  504. data/spec/unit/reports/http_spec.rb +1 -1
  505. data/spec/unit/resource/catalog_spec.rb +23 -97
  506. data/spec/unit/resource/resource_type.json +34 -0
  507. data/spec/unit/resource/status_spec.rb +56 -0
  508. data/spec/unit/resource/type_collection_spec.rb +6 -6
  509. data/spec/unit/resource/type_spec.rb +25 -5
  510. data/spec/unit/resource_spec.rb +68 -24
  511. data/spec/unit/run_spec.rb +16 -0
  512. data/spec/unit/scheduler/scheduler_spec.rb +14 -27
  513. data/spec/unit/semver_spec.rb +5 -0
  514. data/spec/unit/settings/enum_setting_spec.rb +27 -0
  515. data/spec/unit/settings_spec.rb +53 -44
  516. data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
  517. data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
  518. data/spec/unit/transaction/event_manager_spec.rb +2 -2
  519. data/spec/unit/transaction/event_spec.rb +57 -0
  520. data/spec/unit/transaction/report_spec.rb +66 -0
  521. data/spec/unit/transaction/resource_harness_spec.rb +27 -20
  522. data/spec/unit/transaction_spec.rb +182 -390
  523. data/spec/unit/type/augeas_spec.rb +3 -3
  524. data/spec/unit/type/component_spec.rb +0 -9
  525. data/spec/unit/type/computer_spec.rb +1 -1
  526. data/spec/unit/type/cron_spec.rb +2 -2
  527. data/spec/unit/type/exec_spec.rb +4 -2
  528. data/spec/unit/type/file/content_spec.rb +11 -0
  529. data/spec/unit/type/file/group_spec.rb +1 -1
  530. data/spec/unit/type/file_spec.rb +16 -8
  531. data/spec/unit/type/mount_spec.rb +445 -259
  532. data/spec/unit/type/package_spec.rb +4 -4
  533. data/spec/unit/type/resources_spec.rb +30 -1
  534. data/spec/unit/type/user_spec.rb +26 -3
  535. data/spec/unit/type/yumrepo_spec.rb +7 -27
  536. data/spec/unit/type/zone_spec.rb +4 -1
  537. data/spec/unit/type_spec.rb +66 -33
  538. data/spec/unit/util/backups_spec.rb +3 -3
  539. data/spec/unit/util/http_proxy_spec.rb +83 -0
  540. data/spec/unit/util/log_spec.rb +79 -8
  541. data/spec/unit/util/metric_spec.rb +12 -0
  542. data/spec/unit/util/monkey_patches_spec.rb +6 -0
  543. data/spec/unit/util/network_device/config_spec.rb +26 -64
  544. data/spec/unit/util/pidlock_spec.rb +4 -1
  545. data/spec/unit/util/tagging_spec.rb +5 -9
  546. data/spec/unit/util/warnings_spec.rb +1 -1
  547. data/spec/unit/util/watched_file_spec.rb +52 -0
  548. data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
  549. data/spec/unit/util/watcher_spec.rb +56 -0
  550. data/spec/unit/util_spec.rb +16 -0
  551. metadata +2767 -2576
  552. data/ext/debian/puppet.manpages +0 -32
  553. data/ext/osx/PackageInfo.plist +0 -36
  554. data/ext/osx/createpackage.sh +0 -187
  555. data/ext/redhat/rundir-perms.patch +0 -28
  556. data/lib/puppet/external/base64.rb +0 -19
  557. data/lib/puppet/util/graph.rb +0 -27
  558. data/lib/puppet/util/loadedfile.rb +0 -61
  559. data/lib/puppet/util/log_paths.rb +0 -22
  560. data/lib/puppet/util/subclass_loader.rb +0 -78
  561. data/spec/monkey_patches/publicize_methods.rb +0 -11
  562. data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -13,6 +13,17 @@ on?" This is already called out in the [CONTRIBUTING.md](http://goo.gl/XRH2J).
13
13
  Therefore, it is the responsibility of the committer to re-base the change set
14
14
  on the appropriate branch which should receive the contribution.
15
15
 
16
+ It is also the responsibility of the committer to review the change set in an
17
+ effort to make sure the end users must opt-in to new behavior that is
18
+ incompatible with previous behavior. We employ the use of [feature
19
+ flags](http://stackoverflow.com/questions/7707383/what-is-a-feature-flag) as
20
+ the primary way to achieve this user opt-in behavior. Finally, it is the
21
+ responsibility of the committer to make sure the `master` and `stable` branches
22
+ are both clean and working at all times. Clean means that dead code is not
23
+ allowed, everything needs to be usable in some manner at all points in time.
24
+ Stable is not an indication of the build status, but rather an expression of
25
+ our intent that the `stable` branch does not receive new functionality.
26
+
16
27
  The rest of this document addresses the concerns of the committer. This
17
28
  document will help guide the committer decide which branch to base, or re-base
18
29
  a contribution on top of. This document also describes our branch management
@@ -37,8 +48,21 @@ making the decision what base branch to merge the change set into.
37
48
 
38
49
  **base branch** - A branch in Git that contains an active history of changes
39
50
  and will eventually be released using semantic version guidelines. The branch
40
- named master will always exist as a base branch. All other base branches will
41
- be associated with a specific released version of Puppet, e.g. 2.7.x and 3.0.x.
51
+ named `master` will always exist as a base branch. The other base branches are
52
+ `stable`, and `security` described below.
53
+
54
+ **master branch** - The branch where new functionality that are not bug fixes
55
+ is merged.
56
+
57
+ **stable branch** - The branch where bug fixes against the latest release or
58
+ release candidate are merged.
59
+
60
+ **security** - Where critical security fixes are merged. These change sets
61
+ will then be merged into release branches independently from one another. (i.e.
62
+ no merging up). Please do not submit pull requests against the security branch
63
+ and instead report all security related issues to security@puppetlabs.com as
64
+ per our security policy published at
65
+ [https://puppetlabs.com/security/](https://puppetlabs.com/security/).
42
66
 
43
67
  Committer Guide
44
68
  ====
@@ -53,32 +77,58 @@ This section provides a guide to help a committer decide the specific base
53
77
  branch that a change set should be merged into.
54
78
 
55
79
  The latest minor release of a major release is the only base branch that should
56
- be patched. Older minor releases in a major release do not get patched. Before
57
- the switch to [semantic versions](http://semver.org/) committers did not have
58
- to think about the difference between minor and major releases. Committing to
59
- the latest minor release of a major release is a policy intended to limit the
60
- number of active base branches that must be managed.
80
+ be patched. These patches will be merged into `master` if they contain new
81
+ functionality. They will be merged into `stable` and `master` if they fix a
82
+ critical bug. Older minor releases in a major release do not get patched.
83
+
84
+ Before the switch to [semantic versions](http://semver.org/) committers did not
85
+ have to think about the difference between minor and major releases.
86
+ Committing to the latest minor release of a major release is a policy intended
87
+ to limit the number of active base branches that must be managed.
61
88
 
62
89
  Security patches are handled as a special case. Security patches may be
63
- applied to earlier minor releases of a major release.
90
+ applied to earlier minor releases of a major release, but the patches should
91
+ first be merged into the `security` branch. Security patches should be merged
92
+ by Puppet Labs staff members. Pull requests should not be submitted with the
93
+ security branch as the base branch. Please send all security related
94
+ information or patches to security@puppetlabs.com as per our [Security
95
+ Policy](https://puppetlabs.com/security/).
96
+
97
+ The CI systems are configured to run against `master` and `stable`. Over time,
98
+ these branches will refer to different versions, but their name will remain
99
+ fixed to avoid having to update CI jobs and tasks as new versions are released.
64
100
 
65
101
  How to commit a change set to multiple base branches
66
102
  ---
67
103
 
68
- A change set may apply to multiple releases. In this situation the change set
69
- needs to be committed to multiple base branches. This section provides a guide
70
- for how to merge patches across releases, e.g. 2.7 is patched, how should the
71
- changes be applied to 3.0?
72
-
73
- First, merge the change set into the lowest numbered base branch, e.g. 2.7.
74
- Next, merge the changed base branch up through all later base branches by using
75
- the `--no-ff --log` git merge options. We commonly refer to this as our "merge
76
- up process" because we merge in once, then merge up multiple times.
77
-
78
- When a new minor release branch is created (e.g. 3.1.x) then the previous one
79
- is deleted (e.g. 3.0.x). Any security or urgent fixes that might have to be
80
- applied to the older code line is done by creating an ad-hoc branch from the
81
- tag of the last patch release of the old minor line.
104
+ A change set may apply to multiple branches, for example a bug fix should be
105
+ applied to the stable release and the development branch. In this situation
106
+ the change set needs to be committed to multiple base branches. This section
107
+ provides a guide for how to merge patches into these branches, e.g.
108
+ `stable` is patched, how should the changes be applied to `master`?
109
+
110
+ First, rebase the change set onto the `stable` branch. Next, merge the change
111
+ set into the `stable` branch using a merge commit. Once merged into `stable`,
112
+ merge the same change set into `master` without doing a rebase as to preserve
113
+ the commit identifiers. This merge strategy follows the [git
114
+ flow](http://nvie.com/posts/a-successful-git-branching-model/) model. Both of
115
+ these change set merges should have a merge commit which makes it much easier
116
+ to track a set of commits as a logical change set through the history of a
117
+ branch. Merge commits should be created using the `--no-ff --log` git merge
118
+ options.
119
+
120
+ Any merge conflicts should be resolved using the merge commit in order to
121
+ preserve the commit identifiers for each individual change. This ensures `git
122
+ branch --contains` will accurately report all of the base branches which
123
+ contain a specific patch.
124
+
125
+ Using this strategy, the stable branch need not be reset. Both `master` and
126
+ `stable` have infinite lifetimes. Patch versions, also known as bug fix
127
+ releases, will be tagged and released directly from the `stable` branch. Major
128
+ and minor versions, also known as feature releases, will be tagged and released
129
+ directly from the `master` branch. Upon release of a new major or minor
130
+ version all of the changes in the `master` branch will be merged into the
131
+ `stable` branch.
82
132
 
83
133
  Code review checklist
84
134
  ---
@@ -100,7 +150,6 @@ branch:
100
150
  or modify it.) HINT: `git diff master --check`
101
151
  * Does the change set conform to the contributing guide?
102
152
 
103
-
104
153
  Commit citizen guidelines:
105
154
  ---
106
155
 
@@ -117,7 +166,8 @@ paying attention to our automated build tools.
117
166
  backwards compatible change set into master, then the target version should
118
167
  be 3.2.0 in the issue tracker.)
119
168
  * Ensure the pull request is closed (Hint: amend your merge commit to contain
120
- the string `closes: #123` where 123 is the pull request number.
169
+ the string `closes #123` where 123 is the pull request number and github
170
+ will automatically close the pull request when the branch is pushed.)
121
171
 
122
172
  Example Procedure
123
173
  ====
@@ -130,7 +180,7 @@ Suppose a contributor submits a pull request based on master. The change set
130
180
  fixes a bug reported against Puppet 3.1.1 which is the most recently released
131
181
  version of Puppet.
132
182
 
133
- In this example the committer should rebase the change set onto the 3.1.x
183
+ In this example the committer should rebase the change set onto the `stable`
134
184
  branch since this is a bug rather than new functionality.
135
185
 
136
186
  First, the committer pulls down the branch using the `hub` gem. This tool
@@ -142,44 +192,53 @@ branch to track the remote branch.
142
192
  Switched to a new branch 'jeffmccune-fix_foo_error'
143
193
 
144
194
  At this point the topic branch is a descendant of master, but we want it to
145
- descend from 3.1.x. The committer creates a new branch then re-bases the
146
- change set:
195
+ descend from `stable`. The committer rebases the change set onto `stable`.
147
196
 
148
- $ git branch bug/3.1.x/fix_foo_error
149
- $ git rebase --onto 3.1.x master bug/3.1.x/fix_foo_error
197
+ $ git branch bug/stable/fix_foo_error
198
+ $ git rebase --onto stable master bug/stable/fix_foo_error
150
199
  First, rewinding head to replay your work on top of it...
151
200
  Applying: (#23456) Fix FooError that always bites users in 3.1.1
152
201
 
153
202
  The `git rebase` command may be interpreted as, "First, check out the branch
154
- named `bug/3.1.x/fix_foo_error`, then take the changes that were previously
155
- based on `master` and re-base them onto `3.1.x`.
203
+ named `bug/stable/fix_foo_error`, then take the changes that were previously
204
+ based on `master` and re-base them onto `stable`.
156
205
 
157
- Now that we have a topic branch containing the change set based on the correct
206
+ Now that we have a topic branch containing the change set based on the `stable`
158
207
  release branch, the committer merges in:
159
208
 
160
- $ git checkout 3.1.x
161
- Switched to branch '3.1.x'
162
- $ git merge --no-ff --log bug/3.1.x/fix_foo_error
209
+ $ git checkout stable
210
+ Switched to branch 'stable'
211
+ $ git merge --no-ff --log bug/stable/fix_foo_error
163
212
  Merge made by the 'recursive' strategy.
164
213
  foo | 0
165
214
  1 file changed, 0 insertions(+), 0 deletions(-)
166
215
  create mode 100644 foo
167
216
 
168
- Once merged into the first base branch, the committer merges up:
217
+ Once merged into the first base branch, the committer merges the `stable`
218
+ branch into `master`, being careful to preserve the same commit identifiers.
169
219
 
170
220
  $ git checkout master
171
221
  Switched to branch 'master'
172
- $ git merge --no-ff --log 3.1.x
222
+ $ git merge --no-ff --log stable
173
223
  Merge made by the 'recursive' strategy.
174
224
  foo | 0
175
225
  1 file changed, 0 insertions(+), 0 deletions(-)
176
226
  create mode 100644 foo
177
227
 
178
- Once the change set has been merged "in and up." the committer pushes. (Note,
179
- the checklist should be complete at this point.) Note that both the 3.1.x and
180
- master branches are being pushed at the same time.
228
+ Once the change set has been merged into one base branch, the change set should
229
+ not be modified in order to keep the history clean, avoid "double" commits, and
230
+ preserve the usefulness of `git branch --contains`. If there are any merge
231
+ conflicts, they are to be resolved in the merge commit itself and not by
232
+ re-writing (rebasing) the patches for one base branch, but not another.
233
+
234
+ Once the change set has been merged into `stable` and into `master`, the
235
+ committer pushes. Please note, the checklist should be complete at this point.
236
+ It's helpful to make sure your local branches are up to date to avoid one of
237
+ the branches failing to fast forward while the other succeeds. Both the
238
+ `stable` and `master` branches are being pushed at the same time.
181
239
 
182
- $ git push puppetlabs master:master 3.1.x:3.1.x
240
+ $ git push puppetlabs master:master stable:stable
183
241
 
184
242
  That's it! The committer then updates the pull request, updates the issue in
185
- our issue tracker, and keeps an eye on the build status.
243
+ our issue tracker, and keeps an eye on the [build
244
+ status](http://jenkins.puppetlabs.com).
data/Gemfile CHANGED
@@ -14,7 +14,7 @@ end
14
14
  platforms :ruby do
15
15
  gem 'pry', :group => :development
16
16
  gem 'yard', :group => :development
17
- gem 'redcarpet', :group => :development
17
+ gem 'redcarpet', '~> 2.0', :group => :development
18
18
  gem "racc", "~> 1.4", :group => :development
19
19
  end
20
20
 
@@ -22,11 +22,22 @@ gem "puppet", :path => File.dirname(__FILE__), :require => false
22
22
  gem "facter", *location_for(ENV['FACTER_LOCATION'] || '~> 1.6')
23
23
  gem "hiera", *location_for(ENV['HIERA_LOCATION'] || '~> 1.0')
24
24
  gem "rake", :require => false
25
- gem "rspec", "~> 2.11.0", :require => false
26
- gem "mocha", "~> 0.10.5", :require => false
27
25
  gem "rgen", "0.6.5", :require => false
28
26
 
29
- gem "yarjuf", "~> 1.0"
27
+
28
+ group(:development, :test) do
29
+
30
+ # Jenkins workers may be using RSpec 2.9, so RSpec 2.11 syntax
31
+ # (like `expect(value).to eq matcher`) should be avoided.
32
+ gem "rspec", "~> 2.11.0", :require => false
33
+
34
+ # Mocha is not compatible across minor version changes; because of this only
35
+ # versions matching ~> 0.10.5 are supported. All other versions are unsupported
36
+ # and can be expected to fail.
37
+ gem "mocha", "~> 0.10.5", :require => false
38
+
39
+ gem "yarjuf", "~> 1.0"
40
+ end
30
41
 
31
42
  group(:extra) do
32
43
  gem "rack", "~> 1.4", :require => false
data/README.md CHANGED
@@ -33,7 +33,7 @@ Generally, you need the following things installed:
33
33
 
34
34
  Contributions
35
35
  ------
36
- Please see our [Contibution
36
+ Please see our [Contribution
37
37
  Documents](https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md)
38
38
  and our [Developer
39
39
  Documentation](https://github.com/puppetlabs/puppet/blob/master/README_DEVELOPER.md).
@@ -51,3 +51,7 @@ site](http://projects.puppetlabs.com). A [mailing
51
51
  list](https://groups.google.com/forum/?fromgroups#!forum/puppet-users) is
52
52
  available for asking questions and getting help from others. In addition there
53
53
  is an active #puppet channel on Freenode.
54
+
55
+ HTTP API
56
+ --------
57
+ {file:api_docs/http_api_index.md HTTP API Index}
@@ -13,7 +13,7 @@ this difference while working on the static compiler and types and providers.
13
13
 
14
14
  The two different types of catalog becomes relevant when writing spec tests
15
15
  because we frequently need to wire up a fake catalog so that we can exercise
16
- types, providers, or terminii that filter the catalog.
16
+ types, providers, or termini that filter the catalog.
17
17
 
18
18
  The two different types of catalogs are so-called "resource" catalogs and "RAL"
19
19
  (resource abstraction layer) catalogs. At a high level, the resource catalog
@@ -130,67 +130,35 @@ method.
130
130
 
131
131
  # Ruby Dependencies #
132
132
 
133
- Puppet is considered an Application as it relates to the recommendation of
134
- adding a Gemfile.lock file to the repository and the information published at
135
- [Clarifying the Roles of the .gemspec and
136
- Gemfile](http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/)
133
+ To install the dependencies run:
137
134
 
138
- To install the dependencies run: `bundle install` to install the dependencies.
135
+ $ bundle install --path .bundle/gems/
139
136
 
140
- A checkout of the source repository should be used in a way that provides
141
- puppet as a gem rather than a simple Ruby library. The parent directory should
142
- be set along the `GEM_PATH`, preferably before other tools such as RVM that
143
- manage gemsets using `GEM_PATH`.
137
+ Once this is done, you can interact with puppet through bundler using `bundle
138
+ exec <command>` which will ensure that `<command>` is executed in the context
139
+ of puppet's dependencies.
144
140
 
145
- For example, Puppet checked out into `/workspace/src/puppet` using `git
146
- checkout https://github.com/puppetlabs/puppet` in `/workspace/src` can be used
147
- with the following actions. The trick is to symlink `gems` to `src`.
141
+ For example to run the specs:
148
142
 
149
- $ cd /workspace
150
- $ ln -s src gems
151
- $ mkdir specifications
152
- $ pushd specifications; ln -s ../gems/puppet/puppet.gemspec; ln -s ../gems/puppet/lib; popd
153
- $ export GEM_PATH="/workspace:${GEM_PATH}"
154
- $ gem list puppet
143
+ $ bundle exec rake spec
155
144
 
156
- This should list out
145
+ To run puppet itself (for a resource lookup say):
157
146
 
158
- puppet (2.7.19)
147
+ $ bundle exec puppet resource host localhost
159
148
 
160
- The final directory structure should look like this:
149
+ which should return something like:
161
150
 
162
- /workspace/src --- git working directory
163
- /gems -> src
164
- /specifications/puppet.gemspec -> ../gems/puppet/puppet.gemspec
165
- /lib -> ../gems/puppet/lib
166
-
167
- ## Bundler ##
168
-
169
- With a source checkout of Puppet properly setup as a gem, dependencies can be
170
- installed using [Bundler](http://gembundler.com/)
171
-
172
- $ bundle install
173
- Fetching gem metadata from http://rubygems.org/........
174
- Using diff-lcs (1.1.3)
175
- Installing facter (1.6.11)
176
- Using metaclass (0.0.1)
177
- Using mocha (0.10.5)
178
- Using puppet (2.7.19) from source at /workspace/puppet-2.7.x/src/puppet
179
- Using rack (1.4.1)
180
- Using rspec-core (2.10.1)
181
- Using rspec-expectations (2.10.0)
182
- Using rspec-mocks (2.10.1)
183
- Using rspec (2.10.0)
184
- Using bundler (1.1.5)
185
- Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
151
+ host { 'localhost':
152
+ ensure => 'present',
153
+ ip => '127.0.0.1',
154
+ target => '/etc/hosts',
155
+ }
186
156
 
187
157
  # Running Tests #
188
158
 
189
159
  Puppet Labs projects use a common convention of using Rake to run unit tests.
190
160
  The tests can be run with the following rake task:
191
161
 
192
- rake spec
193
- # Or if using Bundler
194
162
  bundle exec rake spec
195
163
 
196
164
  This allows the Rakefile to set up the environment beforehand if needed. This
@@ -199,14 +167,20 @@ method is how the unit tests are run in [Jenkins](https://jenkins.puppetlabs.com
199
167
  Under the hood Puppet's tests use `rspec`. To run all of them, you can directly
200
168
  use 'rspec':
201
169
 
202
- rspec
203
- # Or if using Bundler
204
170
  bundle exec rspec
205
171
 
206
172
  To run a single file's worth of tests (much faster!), give the filename, and use
207
173
  the nested format to see the descriptions:
208
174
 
209
- rspec spec/unit/ssl/host_spec.rb --format nested
175
+ bundle exec rspec spec/unit/ssl/host_spec.rb --format nested
176
+
177
+ ## Testing dependency version requirements
178
+
179
+ Puppet is only compatible with certain versions of RSpec and Mocha. If you are
180
+ not using Bundler to install the required test libraries you must ensure that
181
+ you are using the right library versions. Using unsupported versions of Mocha
182
+ and RSpec will probably display many spurious failures. The supported versions
183
+ of RSpec and Mocha can be found in the project Gemfile.
210
184
 
211
185
  # A brief introduction to testing in Puppet
212
186
 
@@ -468,6 +442,95 @@ describe "mocking an object" do
468
442
  end
469
443
  end
470
444
  ```
445
+ ### Writing tests without side effects
446
+
447
+ When properly written each test should be able to run in isolation, and tests
448
+ should be able to be run in any order. This makes tests more reliable and allows
449
+ a single test to be run if only that test is failing, instead of running all
450
+ 17000+ tests each time something is changed. However, there are a number of ways
451
+ that can make tests fail when run in isolation or out of order.
452
+
453
+ #### Using instance variables
454
+
455
+ Puppet has a number of older tests that use `before` blocks and instance
456
+ variables to set up fixture data, instead of `let` blocks. These can retain
457
+ state between tests, which can lead to test failures when tests are run out of
458
+ order.
459
+
460
+ ```ruby
461
+ # test.rb
462
+ RSpec.configure do |c|
463
+ c.mock_framework = :mocha
464
+ end
465
+
466
+ describe "fixture data" do
467
+ describe "using instance variables" do
468
+
469
+ # BAD
470
+ before :all do
471
+ # This fixture will be created only once and will retain the `foo` stub
472
+ # between tests.
473
+ @fixture = stub 'test data'
474
+ end
475
+
476
+ it "can be stubbed" do
477
+ @fixture.stubs(:foo).returns :bar
478
+ @fixture.foo.should == :bar
479
+ end
480
+
481
+ it "should not keep state between tests" do
482
+ # The foo stub was added in the previous test and shouldn't be present
483
+ # in this test.
484
+ expect { @fixture.foo }.to raise_error
485
+ end
486
+ end
487
+
488
+ describe "using `let` blocks" do
489
+
490
+ # GOOD
491
+ # This will be recreated between tests so that state isn't retained.
492
+ let(:fixture) { stub 'test data' }
493
+
494
+ it "can be stubbed" do
495
+ fixture.stubs(:foo).returns :bar
496
+ fixture.foo.should == :bar
497
+ end
498
+
499
+ it "should not keep state between tests" do
500
+ # since let blocks are regenerated between tests, the foo stub added in
501
+ # the previous test will not be present here.
502
+ expect { fixture.foo }.to raise_error
503
+ end
504
+ end
505
+ end
506
+ ```
507
+
508
+ ```
509
+ bundle exec rspec test.rb -fd
510
+
511
+ fixture data
512
+ using instance variables
513
+ can be stubbed
514
+ should not keep state between tests (FAILED - 1)
515
+ using `let` blocks
516
+ can be stubbed
517
+ should not keep state between tests
518
+
519
+ Failures:
520
+
521
+ 1) fixture data using instance variables should not keep state between tests
522
+ Failure/Error: expect { @fixture.foo }.to raise_error
523
+ expected Exception but nothing was raised
524
+ # ./test.rb:17:in `block (3 levels) in <top (required)>'
525
+
526
+ Finished in 0.00248 seconds
527
+ 4 examples, 1 failure
528
+
529
+ Failed examples:
530
+
531
+ rspec ./test.rb:16 # fixture data using instance variables should not keep state between tests
532
+ ```
533
+
471
534
 
472
535
  ### RSpec references
473
536
 
@@ -703,11 +766,11 @@ default clientbucket.
703
766
  Create a module that recursively downloads something. The jeffmccune-filetest
704
767
  module will recursively copy the rubygems source tree.
705
768
 
706
- $ puppet module install jeffmccune-filetest
769
+ $ bundle exec puppet module install jeffmccune-filetest
707
770
 
708
771
  Start the master with the StaticCompiler turned on:
709
772
 
710
- $ puppet master \
773
+ $ bundle exec puppet master \
711
774
  --catalog_terminus=static_compiler \
712
775
  --verbose \
713
776
  --no-daemonize
@@ -722,7 +785,7 @@ Add the special Filebucket[puppet] resource:
722
785
 
723
786
  Get the static catalog:
724
787
 
725
- $ puppet agent --test
788
+ $ bundle exec puppet agent --test
726
789
 
727
790
  You should expect all file metadata to be contained in the catalog, including a
728
791
  checksum representing the content. When managing an out of sync file resource,