puppet 6.21.1-x64-mingw32 → 7.4.1-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 (402) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -4
  3. data/Gemfile.lock +5 -5
  4. data/README.md +1 -1
  5. data/conf/fileserver.conf +5 -10
  6. data/ext/build_defaults.yaml +1 -2
  7. data/ext/osx/file_mapping.yaml +0 -5
  8. data/ext/project_data.yaml +2 -14
  9. data/ext/redhat/puppet.spec.erb +0 -1
  10. data/ext/windows/service/daemon.rb +6 -5
  11. data/install.rb +21 -17
  12. data/lib/puppet.rb +11 -20
  13. data/lib/puppet/application.rb +172 -98
  14. data/lib/puppet/application/device.rb +100 -104
  15. data/lib/puppet/application/filebucket.rb +13 -9
  16. data/lib/puppet/application/ssl.rb +1 -1
  17. data/lib/puppet/configurer.rb +27 -29
  18. data/lib/puppet/configurer/plugin_handler.rb +21 -19
  19. data/lib/puppet/defaults.rb +57 -162
  20. data/lib/puppet/environments.rb +8 -23
  21. data/lib/puppet/face/facts.rb +73 -49
  22. data/lib/puppet/face/help.rb +1 -1
  23. data/lib/puppet/face/node/clean.rb +8 -0
  24. data/lib/puppet/face/plugin.rb +5 -8
  25. data/lib/puppet/ffi/windows.rb +12 -0
  26. data/lib/puppet/ffi/windows/api_types.rb +311 -0
  27. data/lib/puppet/ffi/windows/constants.rb +404 -0
  28. data/lib/puppet/ffi/windows/functions.rb +628 -0
  29. data/lib/puppet/ffi/windows/structs.rb +338 -0
  30. data/lib/puppet/file_serving/configuration.rb +0 -5
  31. data/lib/puppet/file_serving/configuration/parser.rb +6 -32
  32. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  33. data/lib/puppet/file_serving/mount.rb +1 -2
  34. data/lib/puppet/forge/repository.rb +0 -1
  35. data/lib/puppet/generate/models/type/type.rb +4 -1
  36. data/lib/puppet/http.rb +22 -13
  37. data/lib/puppet/http/client.rb +164 -114
  38. data/lib/puppet/{network/resolver.rb → http/dns.rb} +2 -2
  39. data/lib/puppet/http/errors.rb +16 -0
  40. data/lib/puppet/http/external_client.rb +5 -7
  41. data/lib/puppet/{network/http → http}/factory.rb +8 -11
  42. data/lib/puppet/{network/http → http}/pool.rb +61 -26
  43. data/lib/puppet/{network/http/session.rb → http/pool_entry.rb} +2 -3
  44. data/lib/puppet/http/proxy.rb +137 -0
  45. data/lib/puppet/http/redirector.rb +4 -12
  46. data/lib/puppet/http/resolver.rb +5 -15
  47. data/lib/puppet/http/resolver/server_list.rb +6 -10
  48. data/lib/puppet/http/resolver/settings.rb +4 -7
  49. data/lib/puppet/http/resolver/srv.rb +7 -11
  50. data/lib/puppet/http/response.rb +36 -54
  51. data/lib/puppet/http/response_converter.rb +24 -0
  52. data/lib/puppet/http/response_net_http.rb +42 -0
  53. data/lib/puppet/http/retry_after_handler.rb +4 -13
  54. data/lib/puppet/http/service.rb +12 -26
  55. data/lib/puppet/http/service/ca.rb +11 -22
  56. data/lib/puppet/http/service/compiler.rb +22 -69
  57. data/lib/puppet/http/service/file_server.rb +18 -27
  58. data/lib/puppet/http/service/puppetserver.rb +26 -12
  59. data/lib/puppet/http/service/report.rb +8 -10
  60. data/lib/puppet/http/session.rb +11 -20
  61. data/lib/puppet/{network/http → http}/site.rb +1 -2
  62. data/lib/puppet/indirector/catalog/rest.rb +2 -4
  63. data/lib/puppet/indirector/facts/facter.rb +25 -3
  64. data/lib/puppet/indirector/facts/rest.rb +3 -22
  65. data/lib/puppet/indirector/file_bucket_file/rest.rb +3 -9
  66. data/lib/puppet/indirector/file_content/rest.rb +2 -6
  67. data/lib/puppet/indirector/file_metadata/rest.rb +3 -9
  68. data/lib/puppet/indirector/file_server.rb +1 -8
  69. data/lib/puppet/indirector/generic_http.rb +0 -11
  70. data/lib/puppet/indirector/node/rest.rb +2 -4
  71. data/lib/puppet/indirector/report/rest.rb +3 -8
  72. data/lib/puppet/indirector/request.rb +0 -101
  73. data/lib/puppet/indirector/rest.rb +12 -263
  74. data/lib/puppet/module_tool/applications.rb +0 -1
  75. data/lib/puppet/network/authconfig.rb +2 -96
  76. data/lib/puppet/network/authorization.rb +13 -35
  77. data/lib/puppet/network/formats.rb +67 -0
  78. data/lib/puppet/network/http.rb +3 -3
  79. data/lib/puppet/network/http/api/indirected_routes.rb +2 -20
  80. data/lib/puppet/network/http/api/master/v3.rb +11 -13
  81. data/lib/puppet/network/http/connection.rb +247 -316
  82. data/lib/puppet/network/http/handler.rb +0 -1
  83. data/lib/puppet/network/http_pool.rb +16 -34
  84. data/lib/puppet/node.rb +1 -30
  85. data/lib/puppet/pal/json_catalog_encoder.rb +4 -0
  86. data/lib/puppet/pal/pal_impl.rb +3 -1
  87. data/lib/puppet/parser/ast/pops_bridge.rb +0 -38
  88. data/lib/puppet/parser/compiler.rb +0 -198
  89. data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +14 -39
  90. data/lib/puppet/parser/resource.rb +0 -69
  91. data/lib/puppet/pops/evaluator/evaluator_impl.rb +0 -5
  92. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +3 -3
  93. data/lib/puppet/pops/evaluator/runtime3_support.rb +1 -1
  94. data/lib/puppet/pops/issues.rb +0 -5
  95. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -8
  96. data/lib/puppet/pops/model/ast.pp +0 -42
  97. data/lib/puppet/pops/model/ast.rb +0 -290
  98. data/lib/puppet/pops/model/factory.rb +0 -45
  99. data/lib/puppet/pops/model/model_label_provider.rb +0 -5
  100. data/lib/puppet/pops/model/model_tree_dumper.rb +0 -22
  101. data/lib/puppet/pops/model/pn_transformer.rb +0 -16
  102. data/lib/puppet/pops/parser/egrammar.ra +0 -56
  103. data/lib/puppet/pops/parser/eparser.rb +1520 -1712
  104. data/lib/puppet/pops/parser/lexer2.rb +4 -4
  105. data/lib/puppet/pops/parser/parser_support.rb +0 -5
  106. data/lib/puppet/pops/resource/resource_type_impl.rb +2 -24
  107. data/lib/puppet/pops/types/type_calculator.rb +0 -7
  108. data/lib/puppet/pops/types/type_parser.rb +0 -4
  109. data/lib/puppet/pops/types/types.rb +0 -1
  110. data/lib/puppet/pops/validation/checker4_0.rb +9 -37
  111. data/lib/puppet/pops/validation/tasks_checker.rb +0 -12
  112. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -2
  113. data/lib/puppet/provider.rb +0 -13
  114. data/lib/puppet/provider/nameservice.rb +0 -18
  115. data/lib/puppet/provider/package/dpkg.rb +0 -10
  116. data/lib/puppet/provider/package/gem.rb +23 -3
  117. data/lib/puppet/provider/package/pip.rb +0 -1
  118. data/lib/puppet/provider/package/pkg.rb +0 -4
  119. data/lib/puppet/provider/package/portage.rb +1 -1
  120. data/lib/puppet/provider/package/puppet_gem.rb +1 -4
  121. data/lib/puppet/provider/service/smf.rb +191 -73
  122. data/lib/puppet/provider/user/directoryservice.rb +0 -10
  123. data/lib/puppet/reference/configuration.rb +7 -5
  124. data/lib/puppet/reference/indirection.rb +1 -1
  125. data/lib/puppet/resource.rb +1 -89
  126. data/lib/puppet/resource/catalog.rb +1 -14
  127. data/lib/puppet/resource/type.rb +3 -119
  128. data/lib/puppet/resource/type_collection.rb +3 -48
  129. data/lib/puppet/runtime.rb +1 -2
  130. data/lib/puppet/settings.rb +45 -33
  131. data/lib/puppet/settings/integer_setting.rb +17 -0
  132. data/lib/puppet/settings/port_setting.rb +15 -0
  133. data/lib/puppet/settings/priority_setting.rb +5 -4
  134. data/lib/puppet/ssl.rb +10 -6
  135. data/lib/puppet/ssl/base.rb +3 -5
  136. data/lib/puppet/ssl/certificate.rb +0 -6
  137. data/lib/puppet/ssl/certificate_request.rb +1 -12
  138. data/lib/puppet/ssl/certificate_signer.rb +6 -0
  139. data/lib/puppet/ssl/oids.rb +3 -1
  140. data/lib/puppet/ssl/ssl_provider.rb +17 -0
  141. data/lib/puppet/ssl/state_machine.rb +3 -1
  142. data/lib/puppet/ssl/verifier.rb +2 -0
  143. data/lib/puppet/test/test_helper.rb +1 -3
  144. data/lib/puppet/transaction.rb +1 -7
  145. data/lib/puppet/transaction/report.rb +2 -4
  146. data/lib/puppet/type.rb +0 -76
  147. data/lib/puppet/type/file.rb +5 -7
  148. data/lib/puppet/type/file/checksum.rb +1 -1
  149. data/lib/puppet/type/file/source.rb +1 -1
  150. data/lib/puppet/type/filebucket.rb +3 -3
  151. data/lib/puppet/type/package.rb +5 -13
  152. data/lib/puppet/type/user.rb +1 -1
  153. data/lib/puppet/util/execution.rb +0 -11
  154. data/lib/puppet/util/http_proxy.rb +2 -215
  155. data/lib/puppet/util/monkey_patches.rb +0 -46
  156. data/lib/puppet/util/rdoc.rb +0 -7
  157. data/lib/puppet/util/retry_action.rb +1 -1
  158. data/lib/puppet/util/run_mode.rb +9 -1
  159. data/lib/puppet/util/windows.rb +3 -8
  160. data/lib/puppet/util/windows/daemon.rb +360 -0
  161. data/lib/puppet/util/windows/error.rb +1 -0
  162. data/lib/puppet/util/windows/eventlog.rb +4 -9
  163. data/lib/puppet/util/windows/file.rb +8 -242
  164. data/lib/puppet/util/windows/monkey_patches/process.rb +414 -0
  165. data/lib/puppet/util/windows/process.rb +4 -226
  166. data/lib/puppet/util/windows/service.rb +9 -460
  167. data/lib/puppet/util/windows/string.rb +12 -13
  168. data/lib/puppet/util/yaml.rb +0 -22
  169. data/lib/puppet/vendor/require_vendored.rb +0 -1
  170. data/lib/puppet/version.rb +1 -1
  171. data/lib/puppet/x509.rb +5 -1
  172. data/lib/puppet/x509/cert_provider.rb +29 -1
  173. data/locales/puppet.pot +521 -1226
  174. data/man/man5/puppet.conf.5 +34 -94
  175. data/man/man8/puppet-facts.8 +56 -35
  176. data/man/man8/puppet-filebucket.8 +3 -3
  177. data/man/man8/puppet-module.8 +0 -57
  178. data/man/man8/puppet.8 +1 -1
  179. data/spec/fixtures/unit/provider/service/smf/{svcs.out → svcs_instances.out} +0 -0
  180. data/spec/integration/application/agent_spec.rb +24 -11
  181. data/spec/integration/application/apply_spec.rb +1 -1
  182. data/spec/integration/application/filebucket_spec.rb +16 -16
  183. data/spec/integration/application/help_spec.rb +2 -0
  184. data/spec/integration/application/plugin_spec.rb +23 -1
  185. data/spec/integration/defaults_spec.rb +7 -3
  186. data/spec/integration/indirector/file_content/file_server_spec.rb +0 -2
  187. data/spec/integration/indirector/file_metadata/file_server_spec.rb +0 -2
  188. data/spec/integration/network/http_pool_spec.rb +3 -21
  189. data/spec/integration/parser/catalog_spec.rb +0 -38
  190. data/spec/integration/parser/node_spec.rb +0 -9
  191. data/spec/integration/parser/pcore_resource_spec.rb +0 -37
  192. data/spec/integration/type/file_spec.rb +5 -4
  193. data/spec/integration/util/windows/monkey_patches/process_spec.rb +231 -0
  194. data/spec/integration/util/windows/security_spec.rb +1 -1
  195. data/spec/lib/puppet_spec/puppetserver.rb +1 -1
  196. data/spec/lib/puppet_spec/settings.rb +1 -0
  197. data/spec/spec_helper.rb +2 -0
  198. data/spec/unit/agent_spec.rb +0 -2
  199. data/spec/unit/application/facts_spec.rb +86 -0
  200. data/spec/unit/application/filebucket_spec.rb +41 -39
  201. data/spec/unit/application/ssl_spec.rb +2 -2
  202. data/spec/unit/certificate_factory_spec.rb +1 -1
  203. data/spec/unit/configurer/downloader_spec.rb +6 -2
  204. data/spec/unit/configurer/plugin_handler_spec.rb +56 -18
  205. data/spec/unit/configurer_spec.rb +12 -9
  206. data/spec/unit/context/trusted_information_spec.rb +2 -6
  207. data/spec/unit/defaults_spec.rb +22 -47
  208. data/spec/unit/environments_spec.rb +0 -3
  209. data/spec/unit/face/facts_spec.rb +4 -0
  210. data/spec/unit/face/node_spec.rb +14 -2
  211. data/spec/unit/face/plugin_spec.rb +73 -33
  212. data/spec/unit/file_bucket/file_spec.rb +1 -1
  213. data/spec/unit/file_serving/configuration/parser_spec.rb +22 -18
  214. data/spec/unit/file_serving/configuration_spec.rb +6 -12
  215. data/spec/unit/functions/camelcase_spec.rb +1 -1
  216. data/spec/unit/functions/capitalize_spec.rb +1 -1
  217. data/spec/unit/functions/downcase_spec.rb +1 -1
  218. data/spec/unit/functions/upcase_spec.rb +1 -1
  219. data/spec/unit/http/client_spec.rb +7 -8
  220. data/spec/unit/{network/resolver_spec.rb → http/dns_spec.rb} +3 -3
  221. data/spec/unit/http/external_client_spec.rb +4 -4
  222. data/spec/unit/{network/http → http}/factory_spec.rb +5 -11
  223. data/spec/unit/{network/http/session_spec.rb → http/pool_entry_spec.rb} +3 -3
  224. data/spec/unit/{network/http → http}/pool_spec.rb +12 -17
  225. data/spec/unit/{util/http_proxy_spec.rb → http/proxy_spec.rb} +2 -69
  226. data/spec/unit/http/resolver_spec.rb +13 -13
  227. data/spec/unit/http/service/compiler_spec.rb +0 -62
  228. data/spec/unit/http/service/file_server_spec.rb +3 -3
  229. data/spec/unit/http/service/puppetserver_spec.rb +34 -4
  230. data/spec/unit/http/service_spec.rb +0 -1
  231. data/spec/unit/http/session_spec.rb +16 -14
  232. data/spec/unit/{network/http → http}/site_spec.rb +3 -3
  233. data/spec/unit/indirector/facts/facter_spec.rb +113 -0
  234. data/spec/unit/indirector/file_bucket_file/file_spec.rb +5 -3
  235. data/spec/unit/indirector/file_content/rest_spec.rb +0 -4
  236. data/spec/unit/indirector/file_metadata/rest_spec.rb +0 -4
  237. data/spec/unit/indirector/file_server_spec.rb +1 -15
  238. data/spec/unit/indirector/report/rest_spec.rb +2 -17
  239. data/spec/unit/indirector/request_spec.rb +0 -264
  240. data/spec/unit/indirector/rest_spec.rb +98 -752
  241. data/spec/unit/network/authconfig_spec.rb +2 -129
  242. data/spec/unit/network/authorization_spec.rb +2 -55
  243. data/spec/unit/network/formats_spec.rb +45 -4
  244. data/spec/unit/network/http/api/indirected_routes_spec.rb +1 -92
  245. data/spec/unit/network/http/api/master/v3_spec.rb +28 -7
  246. data/spec/unit/network/http/api_spec.rb +10 -0
  247. data/spec/unit/network/http/connection_spec.rb +19 -41
  248. data/spec/unit/network/http/handler_spec.rb +0 -1
  249. data/spec/unit/network/http_pool_spec.rb +0 -4
  250. data/spec/unit/node/environment_spec.rb +33 -21
  251. data/spec/unit/node_spec.rb +2 -54
  252. data/spec/unit/parser/functions/create_resources_spec.rb +2 -20
  253. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +4 -7
  254. data/spec/unit/pops/loaders/loaders_spec.rb +6 -21
  255. data/spec/unit/pops/parser/parse_application_spec.rb +4 -22
  256. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +0 -1
  257. data/spec/unit/pops/parser/parse_capabilities_spec.rb +8 -21
  258. data/spec/unit/pops/parser/parse_site_spec.rb +20 -24
  259. data/spec/unit/pops/resource/resource_type_impl_spec.rb +0 -71
  260. data/spec/unit/pops/serialization/to_from_hr_spec.rb +1 -1
  261. data/spec/unit/pops/types/type_calculator_spec.rb +6 -6
  262. data/spec/unit/pops/types/type_factory_spec.rb +1 -1
  263. data/spec/unit/pops/validator/validator_spec.rb +61 -46
  264. data/spec/unit/pops/visitor_spec.rb +1 -1
  265. data/spec/unit/provider/nameservice_spec.rb +0 -57
  266. data/spec/unit/provider/package/dpkg_spec.rb +0 -48
  267. data/spec/unit/provider/package/gem_spec.rb +32 -0
  268. data/spec/unit/provider/package/puppet_gem_spec.rb +3 -2
  269. data/spec/unit/provider/service/smf_spec.rb +401 -165
  270. data/spec/unit/provider/service/windows_spec.rb +0 -1
  271. data/spec/unit/provider_spec.rb +0 -12
  272. data/spec/unit/resource/type_collection_spec.rb +2 -22
  273. data/spec/unit/resource_spec.rb +0 -56
  274. data/spec/unit/settings/http_extra_headers_spec.rb +2 -4
  275. data/spec/unit/settings/integer_setting_spec.rb +42 -0
  276. data/spec/unit/settings/port_setting_spec.rb +31 -0
  277. data/spec/unit/settings/priority_setting_spec.rb +4 -4
  278. data/spec/unit/settings_spec.rb +17 -0
  279. data/spec/unit/ssl/base_spec.rb +36 -3
  280. data/spec/unit/ssl/certificate_request_spec.rb +19 -55
  281. data/spec/unit/ssl/certificate_spec.rb +2 -11
  282. data/spec/unit/ssl/state_machine_spec.rb +0 -1
  283. data/spec/unit/ssl/verifier_spec.rb +0 -21
  284. data/spec/unit/transaction/report_spec.rb +0 -2
  285. data/spec/unit/transaction/resource_harness_spec.rb +2 -2
  286. data/spec/unit/transaction_spec.rb +45 -79
  287. data/spec/unit/type/file/checksum_spec.rb +6 -6
  288. data/spec/unit/type/file/content_spec.rb +1 -1
  289. data/spec/unit/type/file/ensure_spec.rb +1 -1
  290. data/spec/unit/type/file/mode_spec.rb +1 -1
  291. data/spec/unit/type/file/source_spec.rb +0 -1
  292. data/spec/unit/type/file_spec.rb +12 -6
  293. data/spec/unit/type/package_spec.rb +1 -1
  294. data/spec/unit/type_spec.rb +20 -0
  295. data/spec/unit/util/backups_spec.rb +0 -2
  296. data/spec/unit/util/execution_spec.rb +0 -29
  297. data/spec/unit/util/monkey_patches_spec.rb +0 -6
  298. data/spec/unit/util/run_mode_spec.rb +21 -121
  299. data/spec/unit/util/windows/string_spec.rb +1 -3
  300. data/spec/unit/util/yaml_spec.rb +0 -54
  301. data/spec/unit/util_spec.rb +0 -18
  302. metadata +47 -218
  303. data/conf/auth.conf +0 -150
  304. data/lib/puppet/application/cert.rb +0 -76
  305. data/lib/puppet/application/key.rb +0 -4
  306. data/lib/puppet/application/man.rb +0 -4
  307. data/lib/puppet/application/status.rb +0 -4
  308. data/lib/puppet/face/key.rb +0 -16
  309. data/lib/puppet/face/man.rb +0 -145
  310. data/lib/puppet/face/module/build.rb +0 -14
  311. data/lib/puppet/face/module/generate.rb +0 -14
  312. data/lib/puppet/face/module/search.rb +0 -103
  313. data/lib/puppet/face/status.rb +0 -51
  314. data/lib/puppet/indirector/certificate/file.rb +0 -9
  315. data/lib/puppet/indirector/certificate/rest.rb +0 -18
  316. data/lib/puppet/indirector/certificate_request/file.rb +0 -9
  317. data/lib/puppet/indirector/certificate_request/memory.rb +0 -7
  318. data/lib/puppet/indirector/certificate_request/rest.rb +0 -11
  319. data/lib/puppet/indirector/file_content/http.rb +0 -22
  320. data/lib/puppet/indirector/key/file.rb +0 -46
  321. data/lib/puppet/indirector/key/memory.rb +0 -7
  322. data/lib/puppet/indirector/ssl_file.rb +0 -162
  323. data/lib/puppet/indirector/status.rb +0 -3
  324. data/lib/puppet/indirector/status/local.rb +0 -12
  325. data/lib/puppet/indirector/status/rest.rb +0 -27
  326. data/lib/puppet/module_tool/applications/searcher.rb +0 -29
  327. data/lib/puppet/network/auth_config_parser.rb +0 -90
  328. data/lib/puppet/network/authstore.rb +0 -283
  329. data/lib/puppet/network/http/api/master/v3/authorization.rb +0 -18
  330. data/lib/puppet/network/http/api/master/v3/environment.rb +0 -88
  331. data/lib/puppet/network/http/base_pool.rb +0 -36
  332. data/lib/puppet/network/http/compression.rb +0 -127
  333. data/lib/puppet/network/http/connection_adapter.rb +0 -184
  334. data/lib/puppet/network/http/nocache_pool.rb +0 -28
  335. data/lib/puppet/network/rest_controller.rb +0 -2
  336. data/lib/puppet/network/rights.rb +0 -210
  337. data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +0 -66
  338. data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +0 -22
  339. data/lib/puppet/parser/environment_compiler.rb +0 -202
  340. data/lib/puppet/pops/types/enumeration.rb +0 -16
  341. data/lib/puppet/resource/capability_finder.rb +0 -154
  342. data/lib/puppet/rest/errors.rb +0 -15
  343. data/lib/puppet/rest/response.rb +0 -35
  344. data/lib/puppet/rest/route.rb +0 -85
  345. data/lib/puppet/rest/routes.rb +0 -135
  346. data/lib/puppet/ssl/host.rb +0 -505
  347. data/lib/puppet/ssl/key.rb +0 -61
  348. data/lib/puppet/ssl/validator.rb +0 -61
  349. data/lib/puppet/ssl/validator/default_validator.rb +0 -209
  350. data/lib/puppet/ssl/validator/no_validator.rb +0 -22
  351. data/lib/puppet/ssl/verifier_adapter.rb +0 -58
  352. data/lib/puppet/status.rb +0 -40
  353. data/lib/puppet/util/connection.rb +0 -88
  354. data/lib/puppet/util/fact_dif.rb +0 -62
  355. data/lib/puppet/util/ssl.rb +0 -83
  356. data/lib/puppet/util/windows/api_types.rb +0 -309
  357. data/lib/puppet/util/windows/monkey_patches/dir.rb +0 -40
  358. data/lib/puppet/vendor/load_pathspec.rb +0 -1
  359. data/lib/puppet/vendor/pathspec/CHANGELOG.md +0 -2
  360. data/lib/puppet/vendor/pathspec/LICENSE +0 -201
  361. data/lib/puppet/vendor/pathspec/PUPPET_README.md +0 -6
  362. data/lib/puppet/vendor/pathspec/README.md +0 -53
  363. data/lib/puppet/vendor/pathspec/lib/pathspec.rb +0 -122
  364. data/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +0 -275
  365. data/lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb +0 -17
  366. data/lib/puppet/vendor/pathspec/lib/pathspec/spec.rb +0 -14
  367. data/man/man8/puppet-key.8 +0 -126
  368. data/man/man8/puppet-man.8 +0 -76
  369. data/man/man8/puppet-status.8 +0 -108
  370. data/spec/integration/network/authconfig_spec.rb +0 -256
  371. data/spec/integration/util/windows/monkey_patches/dir_spec.rb +0 -11
  372. data/spec/unit/application/man_spec.rb +0 -52
  373. data/spec/unit/capability_spec.rb +0 -414
  374. data/spec/unit/face/key_spec.rb +0 -9
  375. data/spec/unit/face/module/search_spec.rb +0 -231
  376. data/spec/unit/face/status_spec.rb +0 -9
  377. data/spec/unit/indirector/certificate/file_spec.rb +0 -14
  378. data/spec/unit/indirector/certificate/rest_spec.rb +0 -61
  379. data/spec/unit/indirector/certificate_request/file_spec.rb +0 -14
  380. data/spec/unit/indirector/certificate_request/rest_spec.rb +0 -25
  381. data/spec/unit/indirector/key/file_spec.rb +0 -78
  382. data/spec/unit/indirector/ssl_file_spec.rb +0 -305
  383. data/spec/unit/indirector/status/local_spec.rb +0 -10
  384. data/spec/unit/indirector/status/rest_spec.rb +0 -50
  385. data/spec/unit/module_tool/applications/searcher_spec.rb +0 -38
  386. data/spec/unit/network/auth_config_parser_spec.rb +0 -115
  387. data/spec/unit/network/authstore_spec.rb +0 -422
  388. data/spec/unit/network/http/api/master/v3/authorization_spec.rb +0 -57
  389. data/spec/unit/network/http/api/master/v3/environment_spec.rb +0 -185
  390. data/spec/unit/network/http/compression_spec.rb +0 -240
  391. data/spec/unit/network/http/nocache_pool_spec.rb +0 -64
  392. data/spec/unit/network/http_spec.rb +0 -9
  393. data/spec/unit/network/rights_spec.rb +0 -439
  394. data/spec/unit/parser/environment_compiler_spec.rb +0 -730
  395. data/spec/unit/pops/types/enumeration_spec.rb +0 -51
  396. data/spec/unit/resource/capability_finder_spec.rb +0 -148
  397. data/spec/unit/rest/route_spec.rb +0 -132
  398. data/spec/unit/ssl/host_spec.rb +0 -645
  399. data/spec/unit/ssl/key_spec.rb +0 -173
  400. data/spec/unit/ssl/validator_spec.rb +0 -278
  401. data/spec/unit/status_spec.rb +0 -45
  402. data/spec/unit/util/ssl_spec.rb +0 -91
@@ -28,7 +28,7 @@ describe Puppet::HTTP::Resolver do
28
28
  end
29
29
 
30
30
  it 'returns a service based on the current server_list setting' do
31
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 200)
31
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 200)
32
32
 
33
33
  service = subject.resolve(session, :ca)
34
34
  expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca)
@@ -36,7 +36,7 @@ describe Puppet::HTTP::Resolver do
36
36
  end
37
37
 
38
38
  it 'returns a service based on the current server_list setting if the server returns any success codes' do
39
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 202)
39
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 202)
40
40
 
41
41
  service = subject.resolve(session, :ca)
42
42
  expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca)
@@ -46,24 +46,24 @@ describe Puppet::HTTP::Resolver do
46
46
  it 'includes extra http headers' do
47
47
  Puppet[:http_extra_headers] = 'region:us-west'
48
48
 
49
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master")
49
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server")
50
50
  .with(headers: {'Region' => 'us-west'})
51
51
 
52
52
  subject.resolve(session, :ca)
53
53
  end
54
54
 
55
55
  it 'uses the provided ssl context during resolution' do
56
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 200)
56
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 200)
57
57
 
58
58
  other_ctx = Puppet::SSL::SSLContext.new
59
- expect(client).to receive(:connect).with(URI("https://ca.example.com:8141/status/v1/simple/master"), options: {ssl_context: other_ctx}).and_call_original
59
+ expect(client).to receive(:connect).with(URI("https://ca.example.com:8141/status/v1/simple/server"), options: {ssl_context: other_ctx}).and_call_original
60
60
 
61
61
  subject.resolve(session, :ca, ssl_context: other_ctx)
62
62
  end
63
63
 
64
64
  it 'logs unsuccessful HTTP 500 responses' do
65
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: [500, 'Internal Server Error'])
66
- stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200)
65
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: [500, 'Internal Server Error'])
66
+ stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200)
67
67
 
68
68
  subject.resolve(session, :ca)
69
69
 
@@ -71,8 +71,8 @@ describe Puppet::HTTP::Resolver do
71
71
  end
72
72
 
73
73
  it 'cancels resolution if no servers in server_list are accessible' do
74
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503)
75
- stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 503)
74
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503)
75
+ stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 503)
76
76
 
77
77
  canceled = false
78
78
  canceled_handler = lambda { |cancel| canceled = cancel }
@@ -82,8 +82,8 @@ describe Puppet::HTTP::Resolver do
82
82
  end
83
83
 
84
84
  it 'cycles through server_list until a valid server is found' do
85
- stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503)
86
- stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200)
85
+ stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503)
86
+ stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200)
87
87
 
88
88
  service = subject.resolve(session, :ca)
89
89
  expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca)
@@ -91,8 +91,8 @@ describe Puppet::HTTP::Resolver do
91
91
  end
92
92
 
93
93
  it 'resolves once per session' do
94
- failed = stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503)
95
- passed = stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200)
94
+ failed = stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503)
95
+ passed = stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200)
96
96
 
97
97
  service = subject.resolve(session, :puppet)
98
98
  expect(service).to be_a(Puppet::HTTP::Service::Compiler)
@@ -11,7 +11,6 @@ describe Puppet::HTTP::Service::Compiler do
11
11
  let(:node) { Puppet::Node.new(certname) }
12
12
  let(:facts) { Puppet::Node::Facts.new(certname) }
13
13
  let(:catalog) { Puppet::Resource::Catalog.new(certname) }
14
- let(:status) { Puppet::Status.new }
15
14
  let(:formatter) { Puppet::Network::FormatHandler.format(:json) }
16
15
 
17
16
  before :each do
@@ -466,67 +465,6 @@ describe Puppet::HTTP::Service::Compiler do
466
465
  end
467
466
  end
468
467
 
469
- context 'when getting status' do
470
- let(:uri) { %r{/puppet/v3/status/ziggy} }
471
- let(:status_response) { { body: formatter.render(status), headers: {'Content-Type' => formatter.mime } } }
472
-
473
- it 'always sends production' do
474
- stub_request(:get, uri)
475
- .with(query: hash_including("environment" => "production"))
476
- .to_return(**status_response)
477
-
478
- subject.get_status(certname)
479
- end
480
-
481
- it 'returns a deserialized status' do
482
- stub_request(:get, uri)
483
- .to_return(**status_response)
484
-
485
- _, s = subject.get_status(certname)
486
- expect(s).to be_a(Puppet::Status)
487
- expect(s.status).to eq("is_alive" => true)
488
- end
489
-
490
- it 'returns the request response' do
491
- stub_request(:get, uri)
492
- .to_return(**status_response)
493
-
494
- resp, _ = subject.get_status(certname)
495
- expect(resp).to be_a(Puppet::HTTP::Response)
496
- end
497
-
498
- it 'raises a response error if unsuccessful' do
499
- stub_request(:get, uri)
500
- .to_return(status: [500, "Server Error"])
501
-
502
- expect {
503
- subject.get_status(certname)
504
- }.to raise_error do |err|
505
- expect(err).to be_an_instance_of(Puppet::HTTP::ResponseError)
506
- expect(err.message).to eq('Server Error')
507
- expect(err.response.code).to eq(500)
508
- end
509
- end
510
-
511
- it 'raises a protocol error if the content-type header is missing' do
512
- stub_request(:get, uri)
513
- .to_return(body: "content-type is missing")
514
-
515
- expect {
516
- subject.get_status(certname)
517
- }.to raise_error(Puppet::HTTP::ProtocolError, /No content type in http response; cannot parse/)
518
- end
519
-
520
- it 'raises a serialization error if the content is invalid' do
521
- stub_request(:get, uri)
522
- .to_return(body: "this isn't valid JSON", headers: {'Content-Type' => 'application/json'})
523
-
524
- expect {
525
- subject.get_status(certname)
526
- }.to raise_error(Puppet::HTTP::SerializationError, /Failed to deserialize Puppet::Status from json/)
527
- end
528
- end
529
-
530
468
  context 'filebucket' do
531
469
  let(:filebucket_file) { Puppet::FileBucket::File.new('file to store') }
532
470
  let(:formatter) { Puppet::Network::FormatHandler.format(:binary) }
@@ -41,7 +41,7 @@ describe Puppet::HTTP::Service::FileServer do
41
41
 
42
42
  context 'retrieving file metadata' do
43
43
  let(:path) { tmpfile('get_file_metadata') }
44
- let(:url) { "https://www.example.com/puppet/v3/file_metadata/:mount/#{path}?checksum_type=md5&environment=testing&links=manage&source_permissions=ignore" }
44
+ let(:url) { "https://www.example.com/puppet/v3/file_metadata/:mount/#{path}?checksum_type=sha256&environment=testing&links=manage&source_permissions=ignore" }
45
45
  let(:filemetadata) { Puppet::FileServing::Metadata.new(path) }
46
46
  let(:request_path) { "/:mount/#{path}"}
47
47
 
@@ -122,7 +122,7 @@ describe Puppet::HTTP::Service::FileServer do
122
122
 
123
123
  context 'retrieving multiple file metadatas' do
124
124
  let(:path) { tmpfile('get_file_metadatas') }
125
- let(:url) { "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=md5&links=manage&recurse=false&source_permissions=ignore&environment=testing" }
125
+ let(:url) { "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=sha256&links=manage&recurse=false&source_permissions=ignore&environment=testing" }
126
126
  let(:filemetadatas) { [Puppet::FileServing::Metadata.new(path)] }
127
127
  let(:formatter) { Puppet::Network::FormatHandler.format(:json) }
128
128
  let(:request_path) { "/:mount/#{path}"}
@@ -158,7 +158,7 @@ describe Puppet::HTTP::Service::FileServer do
158
158
  end
159
159
 
160
160
  it 'automatically converts an array of parameters to the stringified query' do
161
- url = "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=md5&environment=testing&ignore=CVS&ignore=.git&ignore=.hg&links=manage&recurse=false&source_permissions=ignore"
161
+ url = "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=sha256&environment=testing&ignore=CVS&ignore=.git&ignore=.hg&links=manage&recurse=false&source_permissions=ignore"
162
162
  stub_request(:get, url).with(
163
163
  headers: {'Accept'=>'application/json, application/x-msgpack, text/pson',}
164
164
  ).to_return(
@@ -12,7 +12,7 @@ describe Puppet::HTTP::Service::Puppetserver do
12
12
 
13
13
  context 'when making requests' do
14
14
  it 'includes default HTTP headers' do
15
- stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master").with do |request|
15
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server").with do |request|
16
16
  expect(request.headers).to include({'X-Puppet-Version' => /./, 'User-Agent' => /./})
17
17
  expect(request.headers).to_not include('X-Puppet-Profiling')
18
18
  end.to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'})
@@ -23,7 +23,7 @@ describe Puppet::HTTP::Service::Puppetserver do
23
23
  it 'includes extra headers' do
24
24
  Puppet[:http_extra_headers] = 'region:us-west'
25
25
 
26
- stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master")
26
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server")
27
27
  .with(headers: {'Region' => 'us-west'})
28
28
  .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'})
29
29
 
@@ -36,7 +36,7 @@ describe Puppet::HTTP::Service::Puppetserver do
36
36
  Puppet[:server] = 'compiler2.example.com'
37
37
  Puppet[:serverport] = 8141
38
38
 
39
- stub_request(:get, "https://compiler2.example.com:8141/status/v1/simple/master")
39
+ stub_request(:get, "https://compiler2.example.com:8141/status/v1/simple/server")
40
40
  .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'})
41
41
 
42
42
  subject.get_simple_status
@@ -44,7 +44,7 @@ describe Puppet::HTTP::Service::Puppetserver do
44
44
  end
45
45
 
46
46
  context 'when getting puppetserver status' do
47
- let(:url) { "https://puppetserver.example.com:8140/status/v1/simple/master" }
47
+ let(:url) { "https://puppetserver.example.com:8140/status/v1/simple/server" }
48
48
 
49
49
  it 'returns the request response and status' do
50
50
  stub_request(:get, url)
@@ -79,4 +79,34 @@ describe Puppet::HTTP::Service::Puppetserver do
79
79
  service.get_simple_status(ssl_context: other_ctx)
80
80
  end
81
81
  end
82
+
83
+ context 'when /status/v1/simple/server returns not found' do
84
+ it 'calls /status/v1/simple/master' do
85
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server")
86
+ .to_return(status: [404, 'not found: server'])
87
+
88
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master")
89
+ .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'})
90
+
91
+ resp, status = subject.get_simple_status
92
+ expect(resp).to be_a(Puppet::HTTP::Response)
93
+ expect(status).to eq('running')
94
+ end
95
+
96
+ it 'raises a response error if fallback is unsuccessful' do
97
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server")
98
+ .to_return(status: [404, 'not found: server'])
99
+
100
+ stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master")
101
+ .to_return(status: [404, 'not found: master'])
102
+
103
+ expect {
104
+ subject.get_simple_status
105
+ }.to raise_error do |err|
106
+ expect(err).to be_an_instance_of(Puppet::HTTP::ResponseError)
107
+ expect(err.message).to eq('not found: master')
108
+ expect(err.response.code).to eq(404)
109
+ end
110
+ end
111
+ end
82
112
  end
@@ -126,7 +126,6 @@ describe Puppet::HTTP::Service do
126
126
  Puppet::Node::Facts,
127
127
  Puppet::Transaction::Report,
128
128
  Puppet::FileServing::Metadata,
129
- Puppet::Status
130
129
  ].each do |model|
131
130
  expect(service.mime_types(model)).to eq(mimes)
132
131
  end
@@ -127,7 +127,7 @@ describe Puppet::HTTP::Session do
127
127
  Puppet[:server_list] = 'foo.example.com,bar.example.com,baz.example.com'
128
128
  Puppet[:ca_server] = 'caserver.example.com'
129
129
 
130
- allow_any_instance_of(Puppet::Network::Resolver).to receive(:each_srv_record).and_yield('mars.example.srv', 8140)
130
+ allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record).and_yield('mars.example.srv', 8140)
131
131
  service = session.route_to(:ca)
132
132
 
133
133
  expect(service.url).to eq(URI("https://mars.example.srv:8140/puppet-ca/v1"))
@@ -147,9 +147,9 @@ describe Puppet::HTTP::Session do
147
147
  Puppet[:use_srv_records] = true
148
148
  Puppet[:server_list] = 'foo.example.com,bar.example.com,baz.example.com'
149
149
 
150
- allow_any_instance_of(Puppet::Network::Resolver).to receive(:each_srv_record)
151
- stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500)
152
- stub_request(:get, "https://bar.example.com:8140/status/v1/simple/master").to_return(status: 200)
150
+ allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record)
151
+ stub_request(:get, "https://foo.example.com:8140/status/v1/simple/server").to_return(status: 500)
152
+ stub_request(:get, "https://bar.example.com:8140/status/v1/simple/server").to_return(status: 200)
153
153
 
154
154
  service = session.route_to(:ca)
155
155
 
@@ -160,7 +160,7 @@ describe Puppet::HTTP::Session do
160
160
  Puppet[:server_list] = 'foo.example.com'
161
161
 
162
162
  expect_any_instance_of(Puppet::HTTP::Resolver::Settings).to receive(:resolve).never
163
- stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500)
163
+ stub_request(:get, "https://foo.example.com:8140/status/v1/simple/server").to_return(status: 500)
164
164
 
165
165
  expect {
166
166
  session.route_to(:ca)
@@ -179,7 +179,7 @@ describe Puppet::HTTP::Session do
179
179
  Puppet::HTTP::Service::SERVICE_NAMES.each do |name|
180
180
  it "resolves #{name} using server_list" do
181
181
  Puppet[:server_list] = 'apple.example.com'
182
- req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200)
182
+ req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200)
183
183
 
184
184
  session.route_to(name)
185
185
 
@@ -201,7 +201,7 @@ describe Puppet::HTTP::Session do
201
201
 
202
202
  it 'resolves once for all services in a session' do
203
203
  Puppet[:server_list] = 'apple.example.com'
204
- req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200)
204
+ req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200)
205
205
 
206
206
  Puppet::HTTP::Service::SERVICE_NAMES.each do |name|
207
207
  session.route_to(name)
@@ -212,7 +212,7 @@ describe Puppet::HTTP::Session do
212
212
 
213
213
  it 'resolves server_list for each new session' do
214
214
  Puppet[:server_list] = 'apple.example.com'
215
- req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200)
215
+ req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200)
216
216
 
217
217
  client.create_session.route_to(:puppet)
218
218
  client.create_session.route_to(:puppet)
@@ -222,6 +222,8 @@ describe Puppet::HTTP::Session do
222
222
  end
223
223
 
224
224
  context 'when retrieving capabilities' do
225
+ let(:response) { Puppet::HTTP::Response.new(uri, 200, 'OK') }
226
+
225
227
  let(:session) do
226
228
  resolver = DummyResolver.new(good_service)
227
229
  described_class.new(client, [resolver])
@@ -242,7 +244,7 @@ describe Puppet::HTTP::Session do
242
244
  end
243
245
 
244
246
  it "supports locales if the cached service's version is 5.3.4 or greater" do
245
- response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.3.4'}, uri)
247
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.3.4')
246
248
 
247
249
  session.route_to(:puppet)
248
250
  session.process_response(response)
@@ -251,7 +253,7 @@ describe Puppet::HTTP::Session do
251
253
  end
252
254
 
253
255
  it "does not support locales if the cached service's version is 5.3.3" do
254
- response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.3.3'}, uri)
256
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.3.3')
255
257
 
256
258
  session.route_to(:puppet)
257
259
  session.process_response(response)
@@ -260,7 +262,7 @@ describe Puppet::HTTP::Session do
260
262
  end
261
263
 
262
264
  it "does not support locales if the cached service's version is missing" do
263
- response = Puppet::HTTP::Response.new({}, uri)
265
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return(nil)
264
266
 
265
267
  session.route_to(:puppet)
266
268
  session.process_response(response)
@@ -277,7 +279,7 @@ describe Puppet::HTTP::Session do
277
279
  end
278
280
 
279
281
  it "supports json if the cached service's version is 5 or greater" do
280
- response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.5.12'}, uri)
282
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.5.12')
281
283
 
282
284
  session.route_to(:puppet)
283
285
  session.process_response(response)
@@ -286,7 +288,7 @@ describe Puppet::HTTP::Session do
286
288
  end
287
289
 
288
290
  it "does not support json if the cached service's version is less than 5.0" do
289
- response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '4.10.1'}, uri)
291
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return('4.10.1')
290
292
 
291
293
  session.route_to(:puppet)
292
294
  session.process_response(response)
@@ -295,7 +297,7 @@ describe Puppet::HTTP::Session do
295
297
  end
296
298
 
297
299
  it "supports json if the cached service's version is missing" do
298
- response = Puppet::HTTP::Response.new({}, uri)
300
+ allow(response).to receive(:[]).with('X-Puppet-Version').and_return(nil)
299
301
 
300
302
  session.route_to(:puppet)
301
303
  session.process_response(response)
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
- require 'puppet/network/http'
3
+ require 'puppet/http'
4
4
 
5
- describe Puppet::Network::HTTP::Site do
5
+ describe Puppet::HTTP::Site do
6
6
  let(:scheme) { 'https' }
7
7
  let(:host) { 'rubygems.org' }
8
8
  let(:port) { 443 }
9
9
 
10
10
  def create_site(scheme, host, port)
11
- Puppet::Network::HTTP::Site.new(scheme, host, port)
11
+ described_class.new(scheme, host, port)
12
12
  end
13
13
 
14
14
  it 'accepts scheme, host, and port' do
@@ -28,6 +28,7 @@ describe Puppet::Node::Facts::Facter do
28
28
  @request = double('request', :key => @name)
29
29
  @environment = double('environment')
30
30
  allow(@request).to receive(:environment).and_return(@environment)
31
+ allow(@request).to receive(:options).and_return({})
31
32
  allow(@request.environment).to receive(:modules).and_return([])
32
33
  allow(@request.environment).to receive(:modulepath).and_return([])
33
34
  end
@@ -104,6 +105,7 @@ describe Puppet::Node::Facts::Facter do
104
105
  expect(FileTest).to receive(:directory?).with(factpath1).and_return(true)
105
106
  expect(FileTest).to receive(:directory?).with(factpath2).and_return(true)
106
107
  allow(@request.environment).to receive(:modulepath).and_return([modulepath])
108
+ allow(@request).to receive(:options).and_return({})
107
109
  expect(Dir).to receive(:glob).with("#{modulepath}/*/lib/facter").and_return([modulelibfacter])
108
110
  expect(Dir).to receive(:glob).with("#{modulepath}/*/plugins/facter").and_return([modulepluginsfacter])
109
111
 
@@ -149,4 +151,115 @@ describe Puppet::Node::Facts::Facter do
149
151
  Puppet::Node::Facts::Facter.setup_external_search_paths @request
150
152
  end
151
153
  end
154
+
155
+ describe 'when :resolve_options is true' do
156
+ let(:options) { { resolve_options: true, user_query: ["os", "timezone"] } }
157
+ let(:facts) { Puppet::Node::Facts.new("foo") }
158
+
159
+ before :each do
160
+ allow(@request).to receive(:options).and_return(options)
161
+ allow(Puppet::Node::Facts).to receive(:new).and_return(facts)
162
+ allow(facts).to receive(:add_local_facts)
163
+ end
164
+
165
+ it 'should call Facter.resolve method' do
166
+ expect(Facter).to receive(:resolve).with("os timezone")
167
+ @facter.find(@request)
168
+ end
169
+
170
+ it 'should NOT add local facts' do
171
+ expect(facts).not_to receive(:add_local_facts)
172
+
173
+ @facter.find(@request)
174
+ end
175
+
176
+ context 'when --show-legacy flag is present' do
177
+ let(:options) { { resolve_options: true, user_query: ["os", "timezone"], show_legacy: true } }
178
+
179
+ it 'should call Facter.resolve method with show-legacy' do
180
+ expect(Facter).to receive(:resolve).with("os timezone --show-legacy")
181
+ @facter.find(@request)
182
+ end
183
+ end
184
+
185
+ context 'when --timing flag is present' do
186
+ let(:options) { { resolve_options: true, user_query: ["os", "timezone"], timing: true } }
187
+
188
+ it 'calls Facter.resolve with --timing' do
189
+ expect(Facter).to receive(:resolve).with("os timezone --timing")
190
+ @facter.find(@request)
191
+ end
192
+ end
193
+
194
+ describe 'when Facter version is lower than 4.0.40' do
195
+ before :each do
196
+ allow(Facter).to receive(:respond_to?).and_return(false)
197
+ allow(Facter).to receive(:respond_to?).with(:resolve).and_return(false)
198
+ end
199
+
200
+ it 'raises an error' do
201
+ expect { @facter.find(@request) }.to raise_error(Puppet::Error, "puppet facts show requires version 4.0.40 or greater of Facter.")
202
+ end
203
+ end
204
+
205
+ describe 'when setting up external search paths' do
206
+ let(:options) { { resolve_options: true, user_query: ["os", "timezone"], external_dir: 'some/dir' } }
207
+ let(:pluginfactdest) { File.expand_path 'plugin/dest' }
208
+ let(:modulepath) { File.expand_path 'module/foo' }
209
+ let(:modulefactsd) { File.expand_path 'module/foo/facts.d' }
210
+
211
+ before :each do
212
+ expect(FileTest).to receive(:directory?).with(pluginfactdest).and_return(true)
213
+ mod = Puppet::Module.new('foo', modulepath, @request.environment)
214
+ allow(@request.environment).to receive(:modules).and_return([mod])
215
+ Puppet[:pluginfactdest] = pluginfactdest
216
+ end
217
+
218
+ it 'should skip files' do
219
+ expect(File).to receive(:directory?).with(modulefactsd).and_return(false)
220
+ expect(Facter).to receive(:search_external).with([pluginfactdest, options[:external_dir]])
221
+ Puppet::Node::Facts::Facter.setup_external_search_paths @request
222
+ end
223
+
224
+ it 'should add directories' do
225
+ expect(File).to receive(:directory?).with(modulefactsd).and_return(true)
226
+ expect(Facter).to receive(:search_external).with([modulefactsd, pluginfactdest, options[:external_dir]])
227
+ Puppet::Node::Facts::Facter.setup_external_search_paths @request
228
+ end
229
+ end
230
+
231
+ describe 'when setting up search paths' do
232
+ let(:factpath1) { File.expand_path 'one' }
233
+ let(:factpath2) { File.expand_path 'two' }
234
+ let(:factpath) { [factpath1, factpath2].join(File::PATH_SEPARATOR) }
235
+ let(:modulepath) { File.expand_path 'module/foo' }
236
+ let(:modulelibfacter) { File.expand_path 'module/foo/lib/facter' }
237
+ let(:modulepluginsfacter) { File.expand_path 'module/foo/plugins/facter' }
238
+ let(:options) { { resolve_options: true, custom_dir: 'some/dir' } }
239
+
240
+ before :each do
241
+ expect(FileTest).to receive(:directory?).with(factpath1).and_return(true)
242
+ expect(FileTest).to receive(:directory?).with(factpath2).and_return(true)
243
+ allow(@request.environment).to receive(:modulepath).and_return([modulepath])
244
+ expect(Dir).to receive(:glob).with("#{modulepath}/*/lib/facter").and_return([modulelibfacter])
245
+ expect(Dir).to receive(:glob).with("#{modulepath}/*/plugins/facter").and_return([modulepluginsfacter])
246
+
247
+ Puppet[:factpath] = factpath
248
+ end
249
+
250
+ it 'should skip files' do
251
+ expect(FileTest).to receive(:directory?).with(modulelibfacter).and_return(false)
252
+ expect(FileTest).to receive(:directory?).with(modulepluginsfacter).and_return(false)
253
+ expect(Facter).to receive(:search).with(factpath1, factpath2, options[:custom_dir])
254
+ Puppet::Node::Facts::Facter.setup_search_paths @request
255
+ end
256
+
257
+ it 'should add directories' do
258
+ expect(FileTest).to receive(:directory?).with(modulelibfacter).and_return(true)
259
+ expect(FileTest).to receive(:directory?).with(modulepluginsfacter).and_return(false)
260
+ expect(Facter).to receive(:search).with(modulelibfacter, factpath1, factpath2, options[:custom_dir])
261
+ Puppet::Node::Facts::Facter.setup_search_paths @request
262
+ end
263
+ end
264
+ end
152
265
  end