puppet 5.3.7-x64-mingw32 → 5.4.0-x64-mingw32

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 (454) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +42 -29
  3. data/README.md +8 -6
  4. data/ext/cert_inspector +2 -2
  5. data/ext/envpuppet +1 -1
  6. data/ext/gentoo/init.d/puppetmaster +4 -4
  7. data/ext/ips/puppet-agent +11 -11
  8. data/ext/ips/puppet-master +11 -11
  9. data/ext/puppet-test +1 -2
  10. data/ext/redhat/client.init +2 -2
  11. data/ext/redhat/logrotate +1 -1
  12. data/ext/solaris/smf/puppet +11 -11
  13. data/ext/solaris/smf/svc-puppetd +5 -5
  14. data/ext/solaris/smf/svc-puppetmasterd +5 -5
  15. data/ext/windows/service/daemon.rb +1 -1
  16. data/install.rb +2 -3
  17. data/lib/puppet/agent.rb +1 -1
  18. data/lib/puppet/application/cert.rb +1 -3
  19. data/lib/puppet/application/describe.rb +0 -1
  20. data/lib/puppet/application/device.rb +12 -99
  21. data/lib/puppet/application/filebucket.rb +32 -11
  22. data/lib/puppet/application/lookup.rb +1 -11
  23. data/lib/puppet/application/script.rb +261 -0
  24. data/lib/puppet/configurer.rb +3 -4
  25. data/lib/puppet/configurer/plugin_handler.rb +26 -9
  26. data/lib/puppet/context.rb +1 -1
  27. data/lib/puppet/datatypes.rb +213 -0
  28. data/lib/puppet/datatypes/error.rb +21 -0
  29. data/lib/puppet/datatypes/impl/error.rb +40 -0
  30. data/lib/puppet/defaults.rb +51 -20
  31. data/lib/puppet/environments.rb +17 -0
  32. data/lib/puppet/error.rb +17 -0
  33. data/lib/puppet/etc.rb +2 -2
  34. data/lib/puppet/external/pson/pure/generator.rb +1 -1
  35. data/lib/puppet/external/pson/pure/parser.rb +1 -1
  36. data/lib/puppet/face/config.rb +45 -0
  37. data/lib/puppet/face/epp.rb +3 -3
  38. data/lib/puppet/face/help/action.erb +3 -0
  39. data/lib/puppet/face/module/build.rb +1 -0
  40. data/lib/puppet/face/module/generate.rb +5 -0
  41. data/lib/puppet/face/module/install.rb +1 -0
  42. data/lib/puppet/face/module/search.rb +6 -2
  43. data/lib/puppet/face/module/uninstall.rb +1 -0
  44. data/lib/puppet/face/module/upgrade.rb +1 -0
  45. data/lib/puppet/face/parser.rb +0 -1
  46. data/lib/puppet/face/plugin.rb +1 -3
  47. data/lib/puppet/feature/base.rb +1 -1
  48. data/lib/puppet/feature/bolt.rb +3 -0
  49. data/lib/puppet/file_bucket/dipper.rb +1 -2
  50. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  51. data/lib/puppet/file_system/uniquefile.rb +2 -2
  52. data/lib/puppet/forge.rb +6 -0
  53. data/lib/puppet/functions.rb +70 -88
  54. data/lib/puppet/functions/all.rb +6 -2
  55. data/lib/puppet/functions/annotate.rb +1 -1
  56. data/lib/puppet/functions/any.rb +7 -3
  57. data/lib/puppet/functions/contain.rb +6 -0
  58. data/lib/puppet/functions/convert_to.rb +32 -0
  59. data/lib/puppet/functions/defined.rb +0 -3
  60. data/lib/puppet/functions/each.rb +10 -6
  61. data/lib/puppet/functions/filter.rb +16 -10
  62. data/lib/puppet/functions/find_file.rb +0 -1
  63. data/lib/puppet/functions/include.rb +6 -0
  64. data/lib/puppet/functions/map.rb +12 -9
  65. data/lib/puppet/functions/module_directory.rb +41 -0
  66. data/lib/puppet/functions/new.rb +1 -4
  67. data/lib/puppet/functions/regsubst.rb +1 -1
  68. data/lib/puppet/functions/require.rb +6 -0
  69. data/lib/puppet/generate/type.rb +1 -1
  70. data/lib/puppet/gettext/config.rb +2 -2
  71. data/lib/puppet/gettext/stubs.rb +1 -1
  72. data/lib/puppet/indirector/catalog/compiler.rb +0 -1
  73. data/lib/puppet/indirector/file_bucket_file/file.rb +6 -2
  74. data/lib/puppet/indirector/file_server.rb +1 -1
  75. data/lib/puppet/indirector/node/ldap.rb +19 -3
  76. data/lib/puppet/indirector/request.rb +10 -6
  77. data/lib/puppet/indirector/rest.rb +11 -12
  78. data/lib/puppet/info_service/class_information_service.rb +1 -1
  79. data/lib/puppet/interface/action.rb +11 -0
  80. data/lib/puppet/interface/action_builder.rb +8 -0
  81. data/lib/puppet/interface/option_manager.rb +1 -1
  82. data/lib/puppet/loaders.rb +2 -0
  83. data/lib/puppet/module.rb +6 -2
  84. data/lib/puppet/module_tool/applications/builder.rb +4 -0
  85. data/lib/puppet/module_tool/applications/installer.rb +3 -0
  86. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
  87. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  88. data/lib/puppet/module_tool/applications/upgrader.rb +3 -0
  89. data/lib/puppet/module_tool/installed_modules.rb +1 -1
  90. data/lib/puppet/module_tool/metadata.rb +0 -1
  91. data/lib/puppet/network/authstore.rb +1 -1
  92. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  93. data/lib/puppet/network/http/connection.rb +1 -9
  94. data/lib/puppet/network/http/factory.rb +0 -3
  95. data/lib/puppet/network/http/webrick.rb +1 -0
  96. data/lib/puppet/network/rights.rb +1 -1
  97. data/lib/puppet/node.rb +53 -0
  98. data/lib/puppet/node/environment.rb +1 -1
  99. data/lib/puppet/parameter/boolean.rb +1 -1
  100. data/lib/puppet/parser.rb +1 -0
  101. data/lib/puppet/parser/abstract_compiler.rb +36 -0
  102. data/lib/puppet/parser/ast/branch.rb +1 -1
  103. data/lib/puppet/parser/ast/pops_bridge.rb +8 -52
  104. data/lib/puppet/parser/compiler.rb +4 -54
  105. data/lib/puppet/parser/functions.rb +0 -1
  106. data/lib/puppet/parser/functions/create_resources.rb +6 -0
  107. data/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
  108. data/lib/puppet/parser/functions/inline_template.rb +6 -0
  109. data/lib/puppet/parser/functions/new.rb +47 -32
  110. data/lib/puppet/parser/functions/realize.rb +6 -0
  111. data/lib/puppet/parser/functions/return.rb +1 -22
  112. data/lib/puppet/parser/functions/reverse_each.rb +1 -1
  113. data/lib/puppet/parser/functions/scanf.rb +1 -1
  114. data/lib/puppet/parser/functions/sha256.rb +5 -0
  115. data/lib/puppet/parser/functions/tag.rb +6 -0
  116. data/lib/puppet/parser/functions/tagged.rb +6 -0
  117. data/lib/puppet/parser/functions/template.rb +5 -0
  118. data/lib/puppet/parser/scope.rb +28 -4
  119. data/lib/puppet/parser/script_compiler.rb +118 -0
  120. data/lib/puppet/parser/type_loader.rb +1 -1
  121. data/lib/puppet/pops.rb +1 -1
  122. data/lib/puppet/pops/evaluator/access_operator.rb +38 -4
  123. data/lib/puppet/pops/evaluator/closure.rb +12 -4
  124. data/lib/puppet/pops/evaluator/compare_operator.rb +4 -4
  125. data/lib/puppet/pops/evaluator/epp_evaluator.rb +13 -0
  126. data/lib/puppet/pops/evaluator/evaluator_impl.rb +38 -10
  127. data/lib/puppet/pops/evaluator/literal_evaluator.rb +1 -1
  128. data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
  129. data/lib/puppet/pops/evaluator/runtime3_support.rb +2 -3
  130. data/lib/puppet/pops/functions/dispatch.rb +6 -5
  131. data/lib/puppet/pops/functions/function.rb +2 -2
  132. data/lib/puppet/pops/issues.rb +34 -2
  133. data/lib/puppet/pops/loader/base_loader.rb +10 -0
  134. data/lib/puppet/pops/loader/dependency_loader.rb +7 -0
  135. data/lib/puppet/pops/loader/loader.rb +21 -2
  136. data/lib/puppet/pops/loader/loader_paths.rb +180 -30
  137. data/lib/puppet/pops/loader/module_loaders.rb +202 -33
  138. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +84 -0
  139. data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +9 -9
  140. data/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +40 -0
  141. data/lib/puppet/pops/loader/runtime3_type_loader.rb +6 -1
  142. data/lib/puppet/pops/loader/static_loader.rb +23 -8
  143. data/lib/puppet/pops/loader/task_instantiator.rb +69 -0
  144. data/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -0
  145. data/lib/puppet/pops/loaders.rb +122 -11
  146. data/lib/puppet/pops/lookup/data_dig_function_provider.rb +1 -1
  147. data/lib/puppet/pops/lookup/interpolation.rb +1 -1
  148. data/lib/puppet/pops/lookup/lookup_adapter.rb +0 -1
  149. data/lib/puppet/pops/model/ast.pp +3 -0
  150. data/lib/puppet/pops/model/ast.rb +34 -1
  151. data/lib/puppet/pops/model/factory.rb +30 -3
  152. data/lib/puppet/pops/model/model_label_provider.rb +1 -0
  153. data/lib/puppet/pops/model/model_tree_dumper.rb +12 -1
  154. data/lib/puppet/pops/model/tree_dumper.rb +1 -1
  155. data/lib/puppet/pops/parser/code_merger.rb +2 -2
  156. data/lib/puppet/pops/parser/egrammar.ra +44 -15
  157. data/lib/puppet/pops/parser/eparser.rb +1687 -1571
  158. data/lib/puppet/pops/parser/epp_support.rb +1 -3
  159. data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
  160. data/lib/puppet/pops/parser/interpolation_support.rb +2 -2
  161. data/lib/puppet/pops/parser/lexer2.rb +4 -4
  162. data/lib/puppet/pops/parser/lexer_support.rb +2 -2
  163. data/lib/puppet/pops/parser/locatable.rb +1 -1
  164. data/lib/puppet/pops/parser/locator.rb +7 -13
  165. data/lib/puppet/pops/parser/parser_support.rb +3 -3
  166. data/lib/puppet/pops/parser/slurp_support.rb +0 -3
  167. data/lib/puppet/pops/pcore.rb +45 -0
  168. data/lib/puppet/pops/resource/param.rb +1 -1
  169. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  170. data/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
  171. data/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
  172. data/lib/puppet/pops/serialization/extension.rb +1 -0
  173. data/lib/puppet/pops/serialization/from_data_converter.rb +64 -10
  174. data/lib/puppet/pops/serialization/json_path.rb +2 -1
  175. data/lib/puppet/pops/serialization/object.rb +3 -4
  176. data/lib/puppet/pops/serialization/serializer.rb +2 -1
  177. data/lib/puppet/pops/serialization/to_data_converter.rb +7 -3
  178. data/lib/puppet/pops/time/timespan.rb +1 -1
  179. data/lib/puppet/pops/types/iterable.rb +38 -9
  180. data/lib/puppet/pops/types/p_init_type.rb +1 -1
  181. data/lib/puppet/pops/types/p_meta_type.rb +4 -0
  182. data/lib/puppet/pops/types/p_object_type.rb +146 -14
  183. data/lib/puppet/pops/types/p_object_type_extension.rb +218 -0
  184. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -1
  185. data/lib/puppet/pops/types/p_sem_ver_type.rb +10 -2
  186. data/lib/puppet/pops/types/p_type_set_type.rb +0 -1
  187. data/lib/puppet/pops/types/p_uri_type.rb +190 -0
  188. data/lib/puppet/pops/types/puppet_object.rb +15 -1
  189. data/lib/puppet/pops/types/ruby_generator.rb +46 -54
  190. data/lib/puppet/pops/types/string_converter.rb +22 -1
  191. data/lib/puppet/pops/types/type_acceptor.rb +1 -1
  192. data/lib/puppet/pops/types/type_calculator.rb +13 -4
  193. data/lib/puppet/pops/types/type_factory.rb +29 -5
  194. data/lib/puppet/pops/types/type_formatter.rb +67 -4
  195. data/lib/puppet/pops/types/type_parser.rb +92 -4
  196. data/lib/puppet/pops/types/type_with_members.rb +43 -0
  197. data/lib/puppet/pops/types/types.rb +212 -80
  198. data/lib/puppet/pops/validation/checker4_0.rb +10 -6
  199. data/lib/puppet/pops/validation/tasks_checker.rb +60 -0
  200. data/lib/puppet/pops/validation/validator_factory_4_0.rb +6 -1
  201. data/lib/puppet/property.rb +1 -1
  202. data/lib/puppet/provider.rb +18 -8
  203. data/lib/puppet/provider/augeas/augeas.rb +3 -4
  204. data/lib/puppet/provider/exec.rb +0 -2
  205. data/lib/puppet/provider/group/groupadd.rb +25 -1
  206. data/lib/puppet/provider/group/windows_adsi.rb +7 -4
  207. data/lib/puppet/provider/mount.rb +25 -8
  208. data/lib/puppet/provider/nameservice.rb +9 -4
  209. data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
  210. data/lib/puppet/provider/nameservice/objectadd.rb +13 -24
  211. data/lib/puppet/provider/nameservice/pw.rb +14 -14
  212. data/lib/puppet/provider/package/appdmg.rb +0 -1
  213. data/lib/puppet/provider/package/apple.rb +0 -1
  214. data/lib/puppet/provider/package/gem.rb +2 -2
  215. data/lib/puppet/provider/package/macports.rb +2 -2
  216. data/lib/puppet/provider/package/pkg.rb +3 -0
  217. data/lib/puppet/provider/package/pkgdmg.rb +0 -1
  218. data/lib/puppet/provider/package/portage.rb +0 -1
  219. data/lib/puppet/provider/package/yum.rb +23 -8
  220. data/lib/puppet/provider/package/zypper.rb +2 -2
  221. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  222. data/lib/puppet/provider/service/init.rb +1 -0
  223. data/lib/puppet/provider/service/launchd.rb +6 -7
  224. data/lib/puppet/provider/service/redhat.rb +3 -2
  225. data/lib/puppet/provider/service/systemd.rb +2 -2
  226. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
  227. data/lib/puppet/provider/user/aix.rb +3 -2
  228. data/lib/puppet/provider/user/openbsd.rb +1 -1
  229. data/lib/puppet/provider/user/pw.rb +1 -1
  230. data/lib/puppet/provider/user/user_role_add.rb +7 -1
  231. data/lib/puppet/provider/user/useradd.rb +36 -6
  232. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  233. data/lib/puppet/provider/yumrepo/inifile.rb +2 -4
  234. data/lib/puppet/provider/zfs/zfs.rb +23 -3
  235. data/lib/puppet/provider/zpool/zpool.rb +1 -1
  236. data/lib/puppet/reference/configuration.rb +0 -2
  237. data/lib/puppet/reference/type.rb +0 -1
  238. data/lib/puppet/resource.rb +1 -2
  239. data/lib/puppet/resource/catalog.rb +1 -1
  240. data/lib/puppet/resource/status.rb +0 -1
  241. data/lib/puppet/resource/type.rb +4 -4
  242. data/lib/puppet/resource/type_collection.rb +1 -1
  243. data/lib/puppet/settings/base_setting.rb +1 -1
  244. data/lib/puppet/settings/environment_conf.rb +0 -1
  245. data/lib/puppet/settings/ini_file.rb +66 -12
  246. data/lib/puppet/ssl/certificate_authority.rb +1 -1
  247. data/lib/puppet/ssl/certificate_request.rb +2 -2
  248. data/lib/puppet/ssl/certificate_revocation_list.rb +2 -1
  249. data/lib/puppet/ssl/certificate_signer.rb +11 -0
  250. data/lib/puppet/ssl/host.rb +2 -2
  251. data/lib/puppet/syntax_checkers/base64.rb +1 -1
  252. data/lib/puppet/transaction.rb +37 -14
  253. data/lib/puppet/transaction/report.rb +3 -1
  254. data/lib/puppet/type.rb +17 -4
  255. data/lib/puppet/type/cron.rb +1 -1
  256. data/lib/puppet/type/exec.rb +5 -4
  257. data/lib/puppet/type/file.rb +3 -3
  258. data/lib/puppet/type/file/checksum.rb +7 -1
  259. data/lib/puppet/type/file/checksum_value.rb +4 -3
  260. data/lib/puppet/type/group.rb +3 -0
  261. data/lib/puppet/type/k5login.rb +101 -0
  262. data/lib/puppet/type/macauthorization.rb +1 -1
  263. data/lib/puppet/type/mount.rb +6 -2
  264. data/lib/puppet/type/tidy.rb +6 -4
  265. data/lib/puppet/type/user.rb +26 -39
  266. data/lib/puppet/type/yumrepo.rb +9 -0
  267. data/lib/puppet/type/zfs.rb +4 -0
  268. data/lib/puppet/util.rb +8 -15
  269. data/lib/puppet/util/character_encoding.rb +2 -2
  270. data/lib/puppet/util/checksums.rb +82 -1
  271. data/lib/puppet/util/errors.rb +0 -2
  272. data/lib/puppet/util/filetype.rb +2 -2
  273. data/lib/puppet/util/json_lockfile.rb +1 -1
  274. data/lib/puppet/util/log.rb +1 -1
  275. data/lib/puppet/util/log/destinations.rb +10 -1
  276. data/lib/puppet/util/monkey_patches.rb +1 -1
  277. data/lib/puppet/util/network_device/cisco/device.rb +5 -5
  278. data/lib/puppet/util/network_device/config.rb +2 -3
  279. data/lib/puppet/util/platform.rb +13 -0
  280. data/lib/puppet/util/plist.rb +4 -4
  281. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +2 -2
  282. data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +1 -1
  283. data/lib/puppet/util/reference.rb +8 -1
  284. data/lib/puppet/util/windows/adsi.rb +18 -15
  285. data/lib/puppet/util/windows/principal.rb +6 -7
  286. data/lib/puppet/util/windows/process.rb +1 -1
  287. data/lib/puppet/util/windows/registry.rb +2 -2
  288. data/lib/puppet/util/windows/sid.rb +7 -62
  289. data/lib/puppet/vendor/deep_merge/README.md +2 -2
  290. data/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +18 -18
  291. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +2 -2
  292. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +5 -5
  293. data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +1 -1
  294. data/lib/puppet/version.rb +1 -1
  295. data/lib/puppet_pal.rb +874 -0
  296. data/locales/ja/puppet.po +140 -163
  297. data/locales/puppet.pot +940 -597
  298. data/man/man5/puppet.conf.5 +16 -91
  299. data/man/man8/puppet-agent.8 +2 -6
  300. data/man/man8/puppet-apply.8 +2 -2
  301. data/man/man8/puppet-ca.8 +1 -1
  302. data/man/man8/puppet-catalog.8 +1 -1
  303. data/man/man8/puppet-cert.8 +1 -1
  304. data/man/man8/puppet-certificate.8 +1 -1
  305. data/man/man8/puppet-certificate_request.8 +1 -1
  306. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  307. data/man/man8/puppet-config.8 +1 -1
  308. data/man/man8/puppet-describe.8 +1 -1
  309. data/man/man8/puppet-device.8 +11 -33
  310. data/man/man8/puppet-doc.8 +1 -1
  311. data/man/man8/puppet-epp.8 +1 -1
  312. data/man/man8/puppet-facts.8 +1 -1
  313. data/man/man8/puppet-filebucket.8 +4 -22
  314. data/man/man8/puppet-generate.8 +1 -1
  315. data/man/man8/puppet-help.8 +1 -1
  316. data/man/man8/puppet-key.8 +1 -1
  317. data/man/man8/puppet-lookup.8 +1 -1
  318. data/man/man8/puppet-man.8 +1 -1
  319. data/man/man8/puppet-master.8 +1 -1
  320. data/man/man8/puppet-module.8 +2 -11
  321. data/man/man8/puppet-node.8 +1 -1
  322. data/man/man8/puppet-parser.8 +1 -1
  323. data/man/man8/puppet-plugin.8 +1 -1
  324. data/man/man8/puppet-report.8 +1 -1
  325. data/man/man8/puppet-resource.8 +1 -1
  326. data/man/man8/puppet-status.8 +1 -1
  327. data/man/man8/puppet.8 +2 -2
  328. data/spec/integration/application/lookup_spec.rb +0 -21
  329. data/spec/integration/parser/compiler_spec.rb +18 -0
  330. data/spec/integration/parser/script_compiler_spec.rb +113 -0
  331. data/spec/integration/provider/mount_spec.rb +2 -0
  332. data/spec/integration/type/file_spec.rb +11 -3
  333. data/spec/integration/util/windows/adsi_spec.rb +1 -86
  334. data/spec/integration/util/windows/principal_spec.rb +1 -10
  335. data/spec/shared_contexts/checksum.rb +4 -1
  336. data/spec/shared_contexts/digests.rb +46 -1
  337. data/spec/shared_contexts/types_setup.rb +8 -3
  338. data/spec/unit/agent_spec.rb +2 -2
  339. data/spec/unit/application/cert_spec.rb +5 -17
  340. data/spec/unit/application/device_spec.rb +2 -96
  341. data/spec/unit/application/filebucket_spec.rb +18 -4
  342. data/spec/unit/configurer/plugin_handler_spec.rb +5 -32
  343. data/spec/unit/configurer_spec.rb +3 -3
  344. data/spec/unit/datatypes_spec.rb +304 -0
  345. data/spec/unit/defaults_spec.rb +41 -20
  346. data/spec/unit/face/config_spec.rb +46 -1
  347. data/spec/unit/face/epp_face_spec.rb +7 -3
  348. data/spec/unit/face/module/search_spec.rb +11 -0
  349. data/spec/unit/face/parser_spec.rb +2 -2
  350. data/spec/unit/file_bucket/dipper_spec.rb +12 -1
  351. data/spec/unit/forge/module_release_spec.rb +70 -0
  352. data/spec/unit/functions/break_spec.rb +34 -2
  353. data/spec/unit/functions/contain_spec.rb +1 -0
  354. data/spec/unit/functions/convert_to_spec.rb +22 -0
  355. data/spec/unit/functions/epp_spec.rb +5 -0
  356. data/spec/unit/functions/include_spec.rb +15 -0
  357. data/spec/unit/functions/module_directory_spec.rb +43 -0
  358. data/spec/unit/functions/new_spec.rb +14 -14
  359. data/spec/unit/functions/require_spec.rb +2 -0
  360. data/spec/unit/functions/shared.rb +12 -0
  361. data/spec/unit/functions/step_spec.rb +1 -1
  362. data/spec/unit/functions4_spec.rb +49 -4
  363. data/spec/unit/indirector/catalog/compiler_spec.rb +3 -3
  364. data/spec/unit/indirector/file_bucket_file/file_spec.rb +148 -94
  365. data/spec/unit/indirector/node/ldap_spec.rb +15 -12
  366. data/spec/unit/indirector/rest_spec.rb +0 -43
  367. data/spec/unit/interface/action_spec.rb +33 -0
  368. data/spec/unit/module_tool/applications/builder_spec.rb +7 -0
  369. data/spec/unit/module_tool/applications/installer_spec.rb +8 -0
  370. data/spec/unit/module_tool/applications/uninstaller_spec.rb +8 -0
  371. data/spec/unit/module_tool/applications/upgrader_spec.rb +6 -0
  372. data/spec/unit/network/http/connection_spec.rb +1 -1
  373. data/spec/unit/network/http/factory_spec.rb +28 -35
  374. data/spec/unit/parser/compiler_spec.rb +0 -8
  375. data/spec/unit/parser/environment_compiler_spec.rb +36 -0
  376. data/spec/unit/parser/functions/create_resources_spec.rb +9 -0
  377. data/spec/unit/parser/functions/inline_template_spec.rb +7 -0
  378. data/spec/unit/parser/functions/realize_spec.rb +9 -0
  379. data/spec/unit/parser/functions/tag_spec.rb +7 -0
  380. data/spec/unit/parser/functions/tagged_spec.rb +25 -0
  381. data/spec/unit/parser/functions/template_spec.rb +8 -0
  382. data/spec/unit/parser/scope_spec.rb +19 -0
  383. data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -1
  384. data/spec/unit/pops/loaders/loader_spec.rb +516 -0
  385. data/spec/unit/pops/loaders/loaders_spec.rb +11 -0
  386. data/spec/unit/pops/loaders/module_loaders_spec.rb +43 -0
  387. data/spec/unit/pops/loaders/static_loader_spec.rb +15 -7
  388. data/spec/unit/pops/model/model_spec.rb +5 -0
  389. data/spec/unit/pops/parser/lexer2_spec.rb +15 -0
  390. data/spec/unit/pops/parser/locator_spec.rb +20 -0
  391. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +33 -0
  392. data/spec/unit/pops/parser/parse_calls_spec.rb +28 -0
  393. data/spec/unit/pops/parser/parse_conditionals_spec.rb +12 -0
  394. data/spec/unit/pops/parser/parse_plan_spec.rb +48 -0
  395. data/spec/unit/pops/serialization/packer_spec.rb +8 -0
  396. data/spec/unit/pops/serialization/serialization_spec.rb +30 -0
  397. data/spec/unit/pops/serialization/to_from_hr_spec.rb +31 -0
  398. data/spec/unit/pops/types/error_spec.rb +207 -0
  399. data/spec/unit/pops/types/p_init_type_spec.rb +98 -0
  400. data/spec/unit/pops/types/p_object_type_spec.rb +275 -10
  401. data/spec/unit/pops/types/p_uri_type_spec.rb +191 -0
  402. data/spec/unit/pops/types/ruby_generator_spec.rb +82 -44
  403. data/spec/unit/pops/types/task_spec.rb +353 -0
  404. data/spec/unit/pops/types/type_calculator_spec.rb +76 -5
  405. data/spec/unit/pops/types/type_formatter_spec.rb +31 -13
  406. data/spec/unit/pops/types/type_parser_spec.rb +13 -1
  407. data/spec/unit/pops/types/types_spec.rb +60 -0
  408. data/spec/unit/pops/validator/validator_spec.rb +76 -0
  409. data/spec/unit/provider/group/groupadd_spec.rb +77 -1
  410. data/spec/unit/provider/group/pw_spec.rb +4 -4
  411. data/spec/unit/provider/group/windows_adsi_spec.rb +22 -79
  412. data/spec/unit/provider/mount_spec.rb +18 -5
  413. data/spec/unit/provider/nameservice_spec.rb +5 -5
  414. data/spec/unit/provider/package/dnf_spec.rb +2 -2
  415. data/spec/unit/provider/package/gem_spec.rb +1 -1
  416. data/spec/unit/provider/package/pkg_spec.rb +3 -0
  417. data/spec/unit/provider/package/yum_spec.rb +40 -0
  418. data/spec/unit/provider/service/launchd_spec.rb +2 -1
  419. data/spec/unit/provider/service/redhat_spec.rb +5 -0
  420. data/spec/unit/provider/service/systemd_spec.rb +1 -1
  421. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  422. data/spec/unit/provider/user/openbsd_spec.rb +2 -2
  423. data/spec/unit/provider/user/pw_spec.rb +14 -14
  424. data/spec/unit/provider/user/user_role_add_spec.rb +19 -2
  425. data/spec/unit/provider/user/useradd_spec.rb +188 -22
  426. data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
  427. data/spec/unit/provider/zfs/zfs_spec.rb +55 -1
  428. data/spec/unit/provider_spec.rb +48 -0
  429. data/spec/unit/puppet_pal_2pec.rb +1005 -0
  430. data/spec/unit/puppet_pal_spec.rb +11 -0
  431. data/spec/unit/settings/ini_file_spec.rb +313 -2
  432. data/spec/unit/ssl/certificate_request_spec.rb +42 -1
  433. data/spec/unit/ssl/certificate_revocation_list_spec.rb +2 -1
  434. data/spec/unit/transaction/report_spec.rb +1 -0
  435. data/spec/unit/transaction_spec.rb +112 -21
  436. data/spec/unit/type/file/checksum_spec.rb +20 -0
  437. data/spec/unit/type/file_spec.rb +8 -0
  438. data/spec/unit/type/group_spec.rb +8 -0
  439. data/spec/unit/type/k5login_spec.rb +22 -1
  440. data/spec/unit/type/scheduled_task_spec.rb +15 -0
  441. data/spec/unit/type/user_spec.rb +11 -1
  442. data/spec/unit/type/yumrepo_spec.rb +5 -0
  443. data/spec/unit/util/checksums_spec.rb +3 -3
  444. data/spec/unit/util/log/destinations_spec.rb +14 -0
  445. data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
  446. data/spec/unit/util/plist_spec.rb +3 -3
  447. data/spec/unit/util/windows/adsi_spec.rb +27 -31
  448. data/spec/unit/util/windows/sid_spec.rb +15 -86
  449. data/spec/unit/util_spec.rb +17 -3
  450. data/tasks/manpages.rake +1 -1
  451. metadata +220 -182
  452. data/lib/puppet/bindings.rb +0 -148
  453. data/lib/puppet/configurer/downloader_factory.rb +0 -44
  454. data/spec/unit/configurer/downloader_factory_spec.rb +0 -129
@@ -81,91 +81,6 @@ describe Puppet::Util::Windows::ADSI::Group,
81
81
  end
82
82
 
83
83
  describe '.members' do
84
- it 'should return a list of members resolvable with Puppet::Util::Windows::ADSI::Group.name_sid_hash' do
85
- temp_groupname = "g#{SecureRandom.uuid}"
86
- temp_username = "u#{SecureRandom.uuid}"[0..12]
87
-
88
- # select a virtual account that requires an authority to be able to resolve to SID
89
- # the Dhcp service is chosen for no particular reason aside from it's a service available on all Windows versions
90
- dhcp_virtualaccount = Puppet::Util::Windows::SID.name_to_principal('NT SERVICE\Dhcp')
91
-
92
- # adding :SidTypeGroup as a group member will cause error in IAdsUser::Add
93
- # adding :SidTypeDomain (such as S-1-5-80 / NT SERVICE or computer name) won't error
94
- # but also won't be returned as a group member
95
- # uncertain how to obtain :SidTypeComputer (perhaps AD? the local machine is :SidTypeDomain)
96
- users = [
97
- # Use sid_to_name to get localized names of SIDs - BUILTIN, SYSTEM, NT AUTHORITY, Everyone are all localized
98
- # :SidTypeWellKnownGroup
99
- # SYSTEM is prefixed with the NT Authority authority, resolveable with or without authority
100
- { :sid => 'S-1-5-18', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-5-18') },
101
- # Everyone is not prefixed with an authority, resolveable with or without NT AUTHORITY authority
102
- { :sid => 'S-1-1-0', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-1-0') },
103
- # Dhcp service account is prefixed with NT SERVICE authority, requires authority to resolve SID
104
- # behavior is similar to IIS APPPOOL\DefaultAppPool
105
- { :sid => dhcp_virtualaccount.sid, :name => dhcp_virtualaccount.domain_account },
106
-
107
- # :SidTypeAlias with authority component
108
- # Administrators group is prefixed with BUILTIN authority, can be resolved with or without authority
109
- { :sid => 'S-1-5-32-544', :name => Puppet::Util::Windows::SID.sid_to_name('S-1-5-32-544') },
110
- ]
111
-
112
- begin
113
- # :SidTypeUser as user on localhost, can be resolved with or without authority prefix
114
- user = Puppet::Util::Windows::ADSI::User.create(temp_username)
115
- user.commit()
116
- users.push({ :sid => user.sid.sid, :name => Puppet::Util::Windows::ADSI.computer_name + '\\' + temp_username })
117
-
118
- # create a test group and add above 5 members by SID
119
- group = described_class.create(temp_groupname)
120
- group.commit()
121
- group.set_members(users.map { |u| u[:sid]} )
122
-
123
- # most importantly make sure that all name are convertible to SIDs
124
- expect { described_class.name_sid_hash(group.members) }.to_not raise_error
125
-
126
- # also verify the names returned are as expected
127
- expected_usernames = users.map { |u| u[:name] }
128
- expect(group.members.map(&:domain_account)).to eq(expected_usernames)
129
- ensure
130
- described_class.delete(temp_groupname) if described_class.exists?(temp_groupname)
131
- Puppet::Util::Windows::ADSI::User.delete(temp_username) if Puppet::Util::Windows::ADSI::User.exists?(temp_username)
132
- end
133
- end
134
-
135
- it 'should return a list of Principal objects even with unresolvable SIDs' do
136
- members = [
137
- # NULL SID is not localized
138
- stub('WIN32OLE', {
139
- :objectSID => [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
140
- :Name => 'NULL SID',
141
- :ole_respond_to? => true,
142
- }),
143
- # unresolvable SID is a different story altogether
144
- stub('WIN32OLE', {
145
- # completely valid SID, but Name is just a stringified version
146
- :objectSID => [1, 5, 0, 0, 0, 0, 0, 5, 21, 0, 0, 0, 5, 113, 65, 218, 15, 127, 9, 57, 219, 4, 84, 126, 88, 4, 0, 0],
147
- :Name => 'S-1-5-21-3661721861-956923663-2119435483-1112',
148
- :ole_respond_to? => true,
149
- })
150
- ]
151
-
152
- admins_name = Puppet::Util::Windows::SID.sid_to_name('S-1-5-32-544')
153
- admins = Puppet::Util::Windows::ADSI::Group.new(admins_name)
154
-
155
- # touch the native_group member to have it lazily loaded, so COM objects can be stubbed
156
- admins.native_group
157
- admins.native_group.stubs(:Members).returns(members)
158
-
159
- # well-known NULL SID
160
- expect(admins.members[0].sid).to eq('S-1-0-0')
161
- expect(admins.members[0].account_type).to eq(:SidTypeWellKnownGroup)
162
-
163
- # unresolvable SID
164
- expect(admins.members[1].sid).to eq('S-1-5-21-3661721861-956923663-2119435483-1112')
165
- expect(admins.members[1].account).to eq('S-1-5-21-3661721861-956923663-2119435483-1112 (unresolvable)')
166
- expect(admins.members[1].account_type).to eq(:SidTypeUnknown)
167
- end
168
-
169
84
  it 'should return a list of members with UTF-8 names' do
170
85
  begin
171
86
  original_codepage = Encoding.default_external
@@ -173,7 +88,7 @@ describe Puppet::Util::Windows::ADSI::Group,
173
88
 
174
89
  # lookup by English name Administrators is not OK on localized Windows
175
90
  admins = Puppet::Util::Windows::ADSI::Group.new(administrators_principal.account)
176
- admins.members.map(&:domain_account).each do |name|
91
+ admins.members.each do |name|
177
92
  expect(name.encoding).to be(Encoding::UTF_8)
178
93
  end
179
94
  ensure
@@ -8,7 +8,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
8
8
  let (:system_bytes) { [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0] }
9
9
  let (:null_sid_bytes) { bytes = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
10
10
  let (:administrator_bytes) { [1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0] }
11
- let (:computer_sid) { Puppet::Util::Windows::SID.name_to_principal(Puppet::Util::Windows::ADSI.computer_name) }
11
+ let (:computer_sid) { Puppet::Util::Windows::SID.name_to_sid_object(Puppet::Util::Windows::ADSI.computer_name) }
12
12
  # BUILTIN is localized on German Windows, but not French
13
13
  # looking this up like this dilutes the values of the tests as we're comparing two mechanisms
14
14
  # for returning the same values, rather than to a known good
@@ -23,7 +23,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
23
23
  expect(principal.domain).to eq('')
24
24
  expect(principal.domain_account).to eq('NULL SID')
25
25
  expect(principal.account_type).to eq(:SidTypeWellKnownGroup)
26
- expect(principal.to_s).to eq('NULL SID')
27
26
  end
28
27
 
29
28
  it "should create an instance from a well-known account prefixed with NT AUTHORITY" do
@@ -40,7 +39,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
40
39
  expect(principal.account).to eq('SYSTEM')
41
40
  expect(principal.domain).to eq('NT AUTHORITY')
42
41
  expect(principal.domain_account).to eq('NT AUTHORITY\\SYSTEM')
43
- expect(principal.to_s).to eq('NT AUTHORITY\\SYSTEM')
44
42
  end
45
43
 
46
44
  # Windows API LookupAccountSid behaves differently if current user is SYSTEM
@@ -89,7 +87,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
89
87
  expect(principal.domain).to eq(domain)
90
88
  expect(principal.domain_account).to eq(qualified_name)
91
89
  expect(principal.account_type).to eq(:SidTypeAlias)
92
- expect(principal.to_s).to eq(qualified_name)
93
90
  end
94
91
 
95
92
  it "should raise an error when trying to lookup an account that doesn't exist" do
@@ -109,7 +106,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
109
106
  expect(principal.account).to eq(builtin_localized)
110
107
  expect(principal.domain).to eq(builtin_localized)
111
108
  expect(principal.domain_account).to eq(builtin_localized)
112
- expect(principal.to_s).to eq(builtin_localized)
113
109
  end
114
110
 
115
111
  it "should return a BUILTIN domain principal for BUILTIN account names" do
@@ -119,7 +115,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
119
115
  expect(principal.account).to eq(builtin_localized)
120
116
  expect(principal.domain).to eq(builtin_localized)
121
117
  expect(principal.domain_account).to eq(builtin_localized)
122
- expect(principal.to_s).to eq(builtin_localized)
123
118
  end
124
119
 
125
120
  end
@@ -140,7 +135,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
140
135
  expect(principal.domain).to eq(computer_sid.domain)
141
136
  expect(principal.domain_account).to eq(guest_name)
142
137
  expect(principal.account_type).to eq(:SidTypeUser)
143
- expect(principal.to_s).to eq(guest_name)
144
138
  end
145
139
 
146
140
  it "should create an instance from a well-known group SID" do
@@ -151,7 +145,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
151
145
  expect(principal.domain).to eq('')
152
146
  expect(principal.domain_account).to eq('NULL SID')
153
147
  expect(principal.account_type).to eq(:SidTypeWellKnownGroup)
154
- expect(principal.to_s).to eq('NULL SID')
155
148
  end
156
149
 
157
150
  it "should create an instance from a well-known BUILTIN Alias SID" do
@@ -167,7 +160,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
167
160
  expect(principal.domain).to eq(domain)
168
161
  expect(principal.domain_account).to eq(qualified_name)
169
162
  expect(principal.account_type).to eq(:SidTypeAlias)
170
- expect(principal.to_s).to eq(qualified_name)
171
163
  end
172
164
 
173
165
  it "should raise an error when trying to lookup nil" do
@@ -222,7 +214,6 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet.features.microsoft
222
214
  expect(principal.account).to eq(builtin_localized)
223
215
  expect(principal.domain).to eq(builtin_localized)
224
216
  expect(principal.domain_account).to eq(builtin_localized)
225
- expect(principal.to_s).to eq(builtin_localized)
226
217
  end
227
218
  end
228
219
 
@@ -11,7 +11,10 @@ CHECKSUM_TYPES_TO_TRY = [
11
11
  ['md5', 'a7a169ac84bb863b30484d0aa03139c1'],
12
12
  ['md5lite', '22b4182363e81b326e98231fde616782'],
13
13
  ['sha256', '47fcae62967db2fb5cba2fc0d9cf3e6767035d763d825ecda535a7b1928b9746'],
14
- ['sha256lite', 'fd50217a2b0286ba25121bf2297bbe6c197933992de67e4e568f19861444ecf8']
14
+ ['sha256lite', 'fd50217a2b0286ba25121bf2297bbe6c197933992de67e4e568f19861444ecf8'],
15
+ ['sha224', '6894cd976b60b2caa825bc699b54f715853659f0243f67cda4dd7ac4'],
16
+ ['sha384', 'afc3d952fe1a4d3aa083d438ea464f6e7456c048d34ff554340721b463b38547e5ee7c964513dfba0d65dd91ac97deb5'],
17
+ ['sha512', 'a953dcd95824cfa2a555651585d3980b1091a740a785d52ee5e72a55c9038242433e55026758636b0a29d0e5f9e77f24bc888ea5d5e01ab36d2bbcb3d3163859']
15
18
  ]
16
19
 
17
20
  CHECKSUM_STAT_TIME = Time.now
@@ -11,7 +11,7 @@
11
11
  # automatically based on the rspec metadata selected with
12
12
  # `with_digest_algorithms`.
13
13
 
14
- DIGEST_ALGORITHMS_TO_TRY = ['md5', 'sha256']
14
+ DIGEST_ALGORITHMS_TO_TRY = ['md5', 'sha256', 'sha384', 'sha512', 'sha224']
15
15
 
16
16
  shared_context('with supported digest algorithms', :uses_checksums => true) do
17
17
 
@@ -53,3 +53,48 @@ shared_context("when digest_algorithm is set to md5", :digest_algorithm => 'md5'
53
53
  Puppet::Util::Checksums.md5(content)
54
54
  end
55
55
  end
56
+
57
+ shared_context("when digest_algorithm is set to sha512", :digest_algorithm => 'sha512') do
58
+ before { Puppet[:digest_algorithm] = 'sha512' }
59
+ after { Puppet[:digest_algorithm] = nil }
60
+
61
+ let(:digest_algorithm) { 'sha512' }
62
+
63
+ let(:plaintext) { "my\r\ncontents" }
64
+ let(:checksum) { 'ed9b62ae313c8e4e3e6a96f937101e85f8f8af8d51dea7772177244087e5d6152778605ad6bdb42886ff1436abaec4fa44acbfe171fda755959b52b0e4e015d4' }
65
+ let(:bucket_dir) { 'e/d/9/b/6/2/a/e/ed9b62ae313c8e4e3e6a96f937101e85f8f8af8d51dea7772177244087e5d6152778605ad6bdb42886ff1436abaec4fa44acbfe171fda755959b52b0e4e015d4' }
66
+
67
+ def digest(content)
68
+ Puppet::Util::Checksums.sha512(content)
69
+ end
70
+ end
71
+
72
+ shared_context("when digest_algorithm is set to sha384", :digest_algorithm => 'sha384') do
73
+ before { Puppet[:digest_algorithm] = 'sha384' }
74
+ after { Puppet[:digest_algorithm] = nil }
75
+
76
+ let(:digest_algorithm) { 'sha384' }
77
+
78
+ let(:plaintext) { "my\r\ncontents" }
79
+ let(:checksum) { 'f40debfec135e4f2b9fb92110c53aadb8e9bda28bb05f09901480fd70126fe3b70f9f074ce6182ec8184eb1bcabe4440' }
80
+ let(:bucket_dir) { 'f/4/0/d/e/b/f/e/f40debfec135e4f2b9fb92110c53aadb8e9bda28bb05f09901480fd70126fe3b70f9f074ce6182ec8184eb1bcabe4440' }
81
+
82
+ def digest(content)
83
+ Puppet::Util::Checksums.sha384(content)
84
+ end
85
+ end
86
+
87
+ shared_context("when digest_algorithm is set to sha224", :digest_algorithm => 'sha224') do
88
+ before { Puppet[:digest_algorithm] = 'sha224' }
89
+ after { Puppet[:digest_algorithm] = nil }
90
+
91
+ let(:digest_algorithm) { 'sha224' }
92
+
93
+ let(:plaintext) { "my\r\ncontents" }
94
+ let(:checksum) { 'b8c05079b24c37a0e03f03e611167a3ea24455db3ad638a3a0c7e9cb' }
95
+ let(:bucket_dir) { 'b/8/c/0/5/0/7/9/b8c05079b24c37a0e03f03e611167a3ea24455db3ad638a3a0c7e9cb' }
96
+
97
+ def digest(content)
98
+ Puppet::Util::Checksums.sha224(content)
99
+ end
100
+ end
@@ -1,6 +1,7 @@
1
1
  shared_context 'types_setup' do
2
2
 
3
3
  # Do not include the special type Unit in this list
4
+ # Do not include the type Variant in this list as it needs to be parameterized to be meaningful
4
5
  def self.all_types
5
6
  [ Puppet::Pops::Types::PAnyType,
6
7
  Puppet::Pops::Types::PUndefType,
@@ -23,7 +24,6 @@ shared_context 'types_setup' do
23
24
  Puppet::Pops::Types::PResourceType,
24
25
  Puppet::Pops::Types::PPatternType,
25
26
  Puppet::Pops::Types::PEnumType,
26
- Puppet::Pops::Types::PVariantType,
27
27
  Puppet::Pops::Types::PStructType,
28
28
  Puppet::Pops::Types::PTupleType,
29
29
  Puppet::Pops::Types::PCallableType,
@@ -38,13 +38,17 @@ shared_context 'types_setup' do
38
38
  Puppet::Pops::Types::PTimestampType,
39
39
  Puppet::Pops::Types::PSensitiveType,
40
40
  Puppet::Pops::Types::PBinaryType,
41
- Puppet::Pops::Types::PInitType
41
+ Puppet::Pops::Types::PInitType,
42
+ Puppet::Pops::Types::PURIType,
42
43
  ]
43
44
  end
44
45
  def all_types
45
46
  self.class.all_types
46
47
  end
47
48
 
49
+ # Do not include the Variant type in this list - while it is abstract it is also special in that
50
+ # it must be parameterized to be meaningful.
51
+ #
48
52
  def self.abstract_types
49
53
  [ Puppet::Pops::Types::PAnyType,
50
54
  Puppet::Pops::Types::PCallableType,
@@ -62,7 +66,6 @@ shared_context 'types_setup' do
62
66
  Puppet::Pops::Types::PPatternType,
63
67
  Puppet::Pops::Types::PScalarType,
64
68
  Puppet::Pops::Types::PScalarDataType,
65
- Puppet::Pops::Types::PVariantType,
66
69
  Puppet::Pops::Types::PUndefType,
67
70
  Puppet::Pops::Types::PTypeReferenceType,
68
71
  Puppet::Pops::Types::PTypeAliasType,
@@ -181,7 +184,9 @@ shared_context 'types_setup' do
181
184
  result << Puppet::Pops::Types::PHashType.new(tf.rich_data_key, tf.rich_data)
182
185
  result << Puppet::Pops::Types::PUndefType
183
186
  result << Puppet::Pops::Types::PDefaultType
187
+ result << Puppet::Pops::Types::PURIType
184
188
  result << Puppet::Pops::Types::PTupleType.new([tf.rich_data])
189
+ result << Puppet::Pops::Types::PObjectType
185
190
  result
186
191
  end
187
192
  def rich_data_compatible_types
@@ -66,7 +66,7 @@ describe Puppet::Agent do
66
66
  it "should initialize the client's transaction_uuid if passed as a client_option" do
67
67
  client = mock 'client'
68
68
  transaction_uuid = 'foo'
69
- AgentTestClient.expects(:new).with(anything, transaction_uuid, nil).returns client
69
+ AgentTestClient.expects(:new).with(transaction_uuid, nil).returns client
70
70
 
71
71
  client.expects(:run)
72
72
 
@@ -77,7 +77,7 @@ describe Puppet::Agent do
77
77
  it "should initialize the client's job_id if passed as a client_option" do
78
78
  client = mock 'client'
79
79
  job_id = '289'
80
- AgentTestClient.expects(:new).with(anything, anything, job_id).returns client
80
+ AgentTestClient.expects(:new).with(anything, job_id).returns client
81
81
 
82
82
  client.expects(:run)
83
83
 
@@ -191,9 +191,9 @@ describe Puppet::Application::Cert => true do
191
191
  @cert_app.subcommand = :destroy
192
192
  @cert_app.command_line.stubs(:args).returns(["unsigned-node"])
193
193
 
194
- Puppet::SSL::CertificateAuthority::Interface.unstub(:new)
195
- Puppet::SSL::CertificateAuthority::Interface.expects(:new).with(:revoke, anything).never
196
- Puppet::SSL::CertificateAuthority::Interface.expects(:new).with(:destroy, {:to => ['unsigned-node'], :digest => nil}).returns(@iface)
194
+ Puppet::SSL::CertificateAuthority::Interface.expects(:new).returns(@iface).with { |cert_mode,to| cert_mode == :destroy
195
+ to[:to] == ["unsigned-node"]
196
+ }
197
197
 
198
198
  @cert_app.main
199
199
  end
@@ -203,28 +203,16 @@ describe Puppet::Application::Cert => true do
203
203
  @cert_app.command_line.stubs(:args).returns(["host","unsigned-node"])
204
204
 
205
205
  Puppet::SSL::CertificateAuthority::Interface.expects(:new).returns(@iface).with { |cert_mode,to|
206
- cert_mode == :revoke &&
206
+ cert_mode == :revoke
207
207
  to[:to] == ["host"]
208
208
  }
209
209
  Puppet::SSL::CertificateAuthority::Interface.expects(:new).returns(@iface).with { |cert_mode,to|
210
- cert_mode == :destroy &&
210
+ cert_mode == :destroy
211
211
  to[:to] == ["host","unsigned-node"]
212
212
  }
213
213
 
214
214
  @cert_app.main
215
215
  end
216
-
217
- it "should refuse to destroy all certificates" do
218
- @cert_app.subcommand = :destroy
219
- @cert_app.all = true
220
-
221
- Puppet::SSL::CertificateAuthority::Interface.unstub(:new)
222
- Puppet::SSL::CertificateAuthority::Interface.expects(:new).never
223
-
224
- Puppet.expects(:log_exception).with {|e| e.message == "Refusing to destroy all certs, provide an explicit list of certs to destroy"}
225
-
226
- expect { @cert_app.main }.to exit_with(24)
227
- end
228
216
  end
229
217
 
230
218
  describe "when identifying subcommands" do
@@ -5,7 +5,6 @@ require 'puppet/application/device'
5
5
  require 'puppet/util/network_device/config'
6
6
  require 'ostruct'
7
7
  require 'puppet/configurer'
8
- require 'puppet/application/apply'
9
8
 
10
9
  describe Puppet::Application::Device do
11
10
  include PuppetSpec::Files
@@ -128,18 +127,6 @@ describe Puppet::Application::Device do
128
127
  expect(@device.args[:Port]).to eq("42")
129
128
  end
130
129
 
131
- it "should store the target options with --target" do
132
- @device.options.expects(:[]=).with(:target,'test123')
133
-
134
- @device.handle_target('test123')
135
- end
136
-
137
- it "should store the resource options with --resource" do
138
- @device.options.expects(:[]=).with(:resource,true)
139
-
140
- @device.handle_resource(true)
141
- end
142
-
143
130
  end
144
131
 
145
132
  describe "during setup" do
@@ -290,11 +277,7 @@ describe Puppet::Application::Device do
290
277
  Puppet.stubs(:notice)
291
278
  @device.options.stubs(:[]).with(:detailed_exitcodes).returns(false)
292
279
  @device.options.stubs(:[]).with(:target).returns(nil)
293
- @device.options.stubs(:[]).with(:apply).returns(nil)
294
- @device.options.stubs(:[]).with(:resource).returns(false)
295
- @device.options.stubs(:[]).with(:to_yaml).returns(false)
296
280
  @device.options.stubs(:[]).with(:client)
297
- @device.command_line.stubs(:args).returns([])
298
281
  Puppet::Util::NetworkDevice::Config.stubs(:devices).returns({})
299
282
  end
300
283
 
@@ -303,12 +286,6 @@ describe Puppet::Application::Device do
303
286
  @device.run_command
304
287
  end
305
288
 
306
- it "should exit if resource is requested without target" do
307
- @device.options.stubs(:[]).with(:resource).returns(true)
308
- Puppet.expects(:err).with "resource command requires target"
309
- expect { @device.main }.to exit_with 1
310
- end
311
-
312
289
  it "should get the device list" do
313
290
  device_hash = stub_everything 'device hash'
314
291
  Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
@@ -324,8 +301,8 @@ describe Puppet::Application::Device do
324
301
  }
325
302
 
326
303
  Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
327
- URI.expects(:parse).with("ssh://user:pass@testhost")
328
- URI.expects(:parse).with("https://user:pass@testhost/some/path").never
304
+ Puppet.expects(:info).with("starting applying configuration to device1 at ssh://testhost")
305
+ Puppet.expects(:info).with("starting applying configuration to device2 at https://testhost:443/some/path").never
329
306
  expect { @device.main }.to exit_with 1
330
307
  end
331
308
 
@@ -341,32 +318,6 @@ describe Puppet::Application::Device do
341
318
  expect { @device.main }.to exit_with 1
342
319
  end
343
320
 
344
- it "should error if target is passed and the apply path is incorrect" do
345
- @device.options.stubs(:[]).with(:apply).returns('file.pp')
346
- @device.options.stubs(:[]).with(:target).returns('device1')
347
-
348
- File.expects(:file?).returns(false)
349
- Puppet.expects(:err).with(regexp_matches(/does not exist, cannot apply/))
350
- expect { @device.main }.to exit_with 1
351
- end
352
-
353
- it "should run an apply" do
354
- @device.options.stubs(:[]).with(:apply).returns('file.pp')
355
- @device.options.stubs(:[]).with(:target).returns('device1')
356
- device_hash = {
357
- "device1" => OpenStruct.new(:name => "device1", :url => "ssh://user:pass@testhost", :provider => "cisco"),
358
- }
359
- Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
360
- Puppet::Util::NetworkDevice.stubs(:init)
361
- File.expects(:file?).returns(true)
362
-
363
- Puppet::Util::CommandLine.expects(:new).once
364
- Puppet::Application::Apply.expects(:new).once
365
-
366
- Puppet::Configurer.expects(:new).never
367
- expect { @device.main }.to exit_with 1
368
- end
369
-
370
321
  it "should exit if the device list is empty" do
371
322
  expect { @device.main }.to exit_with 1
372
323
  end
@@ -405,51 +356,6 @@ describe Puppet::Application::Device do
405
356
  expect { @device.main }.to exit_with 1
406
357
  end
407
358
 
408
- it "should raise an error if no type is given" do
409
- @device.options.stubs(:[]).with(:resource).returns(true)
410
- @device.options.stubs(:[]).with(:target).returns('device1')
411
- @device.command_line.stubs(:args).returns([])
412
- Puppet.expects(:log_exception).with {|e| e.message == "You must specify the type to display"}
413
- expect { @device.main }.to exit_with 1
414
- end
415
-
416
- it "should raise an error if the type is not found" do
417
- @device.options.stubs(:[]).with(:resource).returns(true)
418
- @device.options.stubs(:[]).with(:target).returns('device1')
419
- @device.command_line.stubs(:args).returns(['nope'])
420
- Puppet.expects(:log_exception).with {|e| e.message == "Could not find type nope"}
421
- expect { @device.main }.to exit_with 1
422
- end
423
-
424
- it "should retrieve all resources of a type" do
425
- @device.options.stubs(:[]).with(:resource).returns(true)
426
- @device.options.stubs(:[]).with(:target).returns('device1')
427
- @device.command_line.stubs(:args).returns(['user'])
428
- Puppet::Resource.indirection.expects(:search).with('user/', {}).returns([])
429
- expect { @device.main }.to exit_with 1
430
- end
431
-
432
- it "should retrieve named resources of a type" do
433
- @device.options.stubs(:[]).with(:resource).returns(true)
434
- @device.options.stubs(:[]).with(:target).returns('device1')
435
- @device.command_line.stubs(:args).returns(['user', 'title'])
436
- Puppet::Resource.indirection.expects(:find).with('user/title')
437
- expect { @device.main }.to exit_with 1
438
- end
439
-
440
- it "should output resources as YAML" do
441
- resources = [
442
- Puppet::Type.type(:user).new(:name => "title").to_resource,
443
- ]
444
- @device.options.stubs(:[]).with(:resource).returns(true)
445
- @device.options.stubs(:[]).with(:target).returns('device1')
446
- @device.options.stubs(:[]).with(:to_yaml).returns(true)
447
- @device.command_line.stubs(:args).returns(['user'])
448
- Puppet::Resource.indirection.expects(:search).with('user/', {}).returns(resources)
449
- @device.expects(:puts).with("user:\n title:\n")
450
- expect { @device.main }.to exit_with 1
451
- end
452
-
453
359
  it "should make sure all the required folders and files are created" do
454
360
  Puppet.settings.expects(:use).with(:main, :agent, :ssl).twice
455
361
  expect { @device.main }.to exit_with 1