puppet 6.4.5-x64-mingw32 → 6.5.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 (329) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +10 -10
  3. data/Gemfile +6 -6
  4. data/Gemfile.lock +46 -52
  5. data/ext/build_defaults.yaml +0 -1
  6. data/ext/project_data.yaml +3 -3
  7. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  8. data/ext/solaris/smf/puppet.xml +0 -2
  9. data/ext/windows/eventlog/Rakefile +32 -0
  10. data/ext/windows/eventlog/puppetres.dll +0 -0
  11. data/ext/windows/eventlog/puppetres.mc +18 -0
  12. data/ext/windows/service/daemon.rb +8 -38
  13. data/install.rb +24 -6
  14. data/lib/puppet.rb +3 -1
  15. data/lib/puppet/application.rb +1 -1
  16. data/lib/puppet/application/agent.rb +11 -34
  17. data/lib/puppet/application/apply.rb +6 -6
  18. data/lib/puppet/application/describe.rb +9 -3
  19. data/lib/puppet/application/device.rb +4 -14
  20. data/lib/puppet/application/doc.rb +1 -1
  21. data/lib/puppet/application/lookup.rb +2 -2
  22. data/lib/puppet/application/resource.rb +4 -4
  23. data/lib/puppet/application/script.rb +2 -2
  24. data/lib/puppet/application/ssl.rb +10 -9
  25. data/lib/puppet/configurer.rb +30 -86
  26. data/lib/puppet/configurer/downloader.rb +6 -2
  27. data/lib/puppet/defaults.rb +50 -44
  28. data/lib/puppet/error.rb +14 -9
  29. data/lib/puppet/face/catalog.rb +20 -1
  30. data/lib/puppet/face/config.rb +48 -10
  31. data/lib/puppet/face/facts.rb +1 -1
  32. data/lib/puppet/face/help.rb +1 -1
  33. data/lib/puppet/face/module/list.rb +5 -5
  34. data/lib/puppet/face/module/search.rb +1 -1
  35. data/lib/puppet/face/module/uninstall.rb +1 -1
  36. data/lib/puppet/face/module/upgrade.rb +1 -1
  37. data/lib/puppet/face/parser.rb +48 -9
  38. data/lib/puppet/face/plugin.rb +2 -9
  39. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  40. data/lib/puppet/file_system.rb +12 -2
  41. data/lib/puppet/file_system/file_impl.rb +6 -3
  42. data/lib/puppet/file_system/memory_file.rb +1 -1
  43. data/lib/puppet/file_system/posix.rb +2 -3
  44. data/lib/puppet/forge.rb +3 -3
  45. data/lib/puppet/functions.rb +2 -1
  46. data/lib/puppet/functions/camelcase.rb +2 -2
  47. data/lib/puppet/functions/epp.rb +4 -4
  48. data/lib/puppet/functions/find_file.rb +9 -9
  49. data/lib/puppet/functions/inline_epp.rb +5 -5
  50. data/lib/puppet/functions/regsubst.rb +6 -8
  51. data/lib/puppet/gettext/module_translations.rb +1 -1
  52. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  53. data/lib/puppet/graph/simple_graph.rb +3 -4
  54. data/lib/puppet/indirector/catalog/compiler.rb +5 -11
  55. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  56. data/lib/puppet/indirector/hiera.rb +0 -2
  57. data/lib/puppet/indirector/resource/ral.rb +3 -1
  58. data/lib/puppet/indirector/resource/validator.rb +1 -1
  59. data/lib/puppet/interface.rb +1 -2
  60. data/lib/puppet/loaders.rb +1 -0
  61. data/lib/puppet/metatype/manager.rb +1 -1
  62. data/lib/puppet/module.rb +1 -1
  63. data/lib/puppet/module/task.rb +4 -20
  64. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  65. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  66. data/lib/puppet/module_tool/metadata.rb +1 -1
  67. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  68. data/lib/puppet/module_tool/tar/mini.rb +2 -12
  69. data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
  70. data/lib/puppet/network/http/connection.rb +12 -10
  71. data/lib/puppet/network/http/factory.rb +11 -1
  72. data/lib/puppet/network/http/pool.rb +0 -2
  73. data/lib/puppet/network/http/site.rb +1 -1
  74. data/lib/puppet/network/resolver.rb +2 -2
  75. data/lib/puppet/node/environment.rb +2 -4
  76. data/lib/puppet/pal/pal_impl.rb +2 -2
  77. data/lib/puppet/parser/ast.rb +1 -1
  78. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  79. data/lib/puppet/parser/functions.rb +1 -1
  80. data/lib/puppet/parser/functions/epp.rb +3 -3
  81. data/lib/puppet/parser/functions/fail.rb +8 -1
  82. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  83. data/lib/puppet/parser/scope.rb +7 -8
  84. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  85. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  86. data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -3
  87. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  88. data/lib/puppet/pops/loader/null_loader.rb +60 -0
  89. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
  90. data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
  91. data/lib/puppet/pops/loaders.rb +1 -1
  92. data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
  93. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  94. data/lib/puppet/pops/merge_strategy.rb +18 -22
  95. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  96. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  97. data/lib/puppet/pops/parser/locator.rb +1 -1
  98. data/lib/puppet/pops/parser/pn_parser.rb +16 -17
  99. data/lib/puppet/pops/puppet_stack.rb +49 -51
  100. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  101. data/lib/puppet/pops/types/string_converter.rb +10 -10
  102. data/lib/puppet/pops/types/types.rb +6 -5
  103. data/lib/puppet/property.rb +1 -1
  104. data/lib/puppet/property/ensure.rb +1 -1
  105. data/lib/puppet/provider/exec.rb +2 -6
  106. data/lib/puppet/provider/file/posix.rb +0 -5
  107. data/lib/puppet/provider/nameservice.rb +3 -10
  108. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  109. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  110. data/lib/puppet/provider/package.rb +0 -2
  111. data/lib/puppet/provider/package/apt.rb +1 -5
  112. data/lib/puppet/provider/package/dnf.rb +1 -1
  113. data/lib/puppet/provider/package/dpkg.rb +18 -34
  114. data/lib/puppet/provider/package/openbsd.rb +1 -1
  115. data/lib/puppet/provider/package/pip.rb +13 -37
  116. data/lib/puppet/provider/package/portage.rb +4 -4
  117. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  118. data/lib/puppet/provider/package/rpm.rb +18 -56
  119. data/lib/puppet/provider/package/windows/package.rb +1 -1
  120. data/lib/puppet/provider/package/yum.rb +5 -9
  121. data/lib/puppet/provider/package_targetable.rb +4 -7
  122. data/lib/puppet/provider/parsedfile.rb +1 -1
  123. data/lib/puppet/provider/service/daemontools.rb +9 -9
  124. data/lib/puppet/provider/service/launchd.rb +5 -20
  125. data/lib/puppet/provider/service/openbsd.rb +1 -1
  126. data/lib/puppet/provider/service/rcng.rb +2 -2
  127. data/lib/puppet/provider/service/runit.rb +8 -2
  128. data/lib/puppet/provider/service/systemd.rb +19 -14
  129. data/lib/puppet/provider/service/windows.rb +0 -8
  130. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  131. data/lib/puppet/provider/user/hpux.rb +1 -1
  132. data/lib/puppet/provider/user/pw.rb +3 -12
  133. data/lib/puppet/provider/user/user_role_add.rb +1 -5
  134. data/lib/puppet/provider/user/useradd.rb +20 -45
  135. data/lib/puppet/provider/user/windows_adsi.rb +5 -4
  136. data/lib/puppet/reference/configuration.rb +3 -3
  137. data/lib/puppet/reference/indirection.rb +2 -2
  138. data/lib/puppet/reference/metaparameter.rb +3 -1
  139. data/lib/puppet/reference/providers.rb +3 -1
  140. data/lib/puppet/reference/type.rb +9 -3
  141. data/lib/puppet/reports.rb +1 -1
  142. data/lib/puppet/resource.rb +1 -18
  143. data/lib/puppet/resource/catalog.rb +1 -1
  144. data/lib/puppet/rest/routes.rb +30 -17
  145. data/lib/puppet/settings.rb +3 -43
  146. data/lib/puppet/settings/environment_conf.rb +0 -1
  147. data/lib/puppet/ssl/certificate_request.rb +12 -2
  148. data/lib/puppet/ssl/host.rb +2 -2
  149. data/lib/puppet/ssl/oids.rb +1 -1
  150. data/lib/puppet/ssl/ssl_provider.rb +11 -5
  151. data/lib/puppet/ssl/state_machine.rb +102 -98
  152. data/lib/puppet/test/test_helper.rb +1 -0
  153. data/lib/puppet/transaction.rb +11 -33
  154. data/lib/puppet/transaction/report.rb +1 -1
  155. data/lib/puppet/type.rb +4 -2
  156. data/lib/puppet/type/exec.rb +17 -23
  157. data/lib/puppet/type/file.rb +39 -11
  158. data/lib/puppet/type/file/data_sync.rb +1 -5
  159. data/lib/puppet/type/group.rb +2 -4
  160. data/lib/puppet/type/notify.rb +3 -4
  161. data/lib/puppet/type/package.rb +3 -20
  162. data/lib/puppet/type/schedule.rb +1 -1
  163. data/lib/puppet/type/service.rb +3 -8
  164. data/lib/puppet/type/user.rb +2 -4
  165. data/lib/puppet/util.rb +29 -39
  166. data/lib/puppet/util/command_line/trollop.rb +1 -1
  167. data/lib/puppet/util/execution.rb +3 -4
  168. data/lib/puppet/util/http_proxy.rb +19 -27
  169. data/lib/puppet/util/log.rb +2 -2
  170. data/lib/puppet/util/log/destinations.rb +2 -2
  171. data/lib/puppet/util/logging.rb +20 -32
  172. data/lib/puppet/util/metric.rb +2 -2
  173. data/lib/puppet/util/monkey_patches.rb +33 -0
  174. data/lib/puppet/util/pidlock.rb +2 -3
  175. data/lib/puppet/util/provider_features.rb +4 -2
  176. data/lib/puppet/util/rdoc.rb +1 -1
  177. data/lib/puppet/util/reference.rb +1 -1
  178. data/lib/puppet/util/resource_template.rb +1 -1
  179. data/lib/puppet/util/selinux.rb +2 -8
  180. data/lib/puppet/util/skip_tags.rb +4 -0
  181. data/lib/puppet/util/windows/adsi.rb +18 -48
  182. data/lib/puppet/util/windows/process.rb +8 -8
  183. data/lib/puppet/util/windows/registry.rb +5 -7
  184. data/lib/puppet/util/windows/security.rb +0 -2
  185. data/lib/puppet/util/windows/service.rb +4 -149
  186. data/lib/puppet/util/windows/sid.rb +0 -1
  187. data/lib/puppet/vendor.rb +1 -1
  188. data/lib/puppet/version.rb +1 -1
  189. data/lib/puppet/x509/cert_provider.rb +81 -24
  190. data/locales/puppet.pot +462 -482
  191. data/man/man5/puppet.conf.5 +43 -44
  192. data/man/man8/puppet-agent.8 +1 -1
  193. data/man/man8/puppet-apply.8 +3 -3
  194. data/man/man8/puppet-catalog.8 +31 -3
  195. data/man/man8/puppet-config.8 +1 -1
  196. data/man/man8/puppet-describe.8 +1 -1
  197. data/man/man8/puppet-device.8 +1 -1
  198. data/man/man8/puppet-doc.8 +1 -1
  199. data/man/man8/puppet-epp.8 +1 -1
  200. data/man/man8/puppet-facts.8 +1 -1
  201. data/man/man8/puppet-filebucket.8 +1 -1
  202. data/man/man8/puppet-generate.8 +1 -1
  203. data/man/man8/puppet-help.8 +1 -1
  204. data/man/man8/puppet-key.8 +1 -1
  205. data/man/man8/puppet-lookup.8 +1 -1
  206. data/man/man8/puppet-man.8 +1 -1
  207. data/man/man8/puppet-module.8 +1 -1
  208. data/man/man8/puppet-node.8 +1 -1
  209. data/man/man8/puppet-parser.8 +1 -1
  210. data/man/man8/puppet-plugin.8 +1 -1
  211. data/man/man8/puppet-report.8 +1 -1
  212. data/man/man8/puppet-resource.8 +1 -1
  213. data/man/man8/puppet-script.8 +1 -1
  214. data/man/man8/puppet-ssl.8 +1 -1
  215. data/man/man8/puppet-status.8 +1 -1
  216. data/man/man8/puppet.8 +3 -3
  217. data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
  218. data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
  219. data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
  220. data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
  221. data/spec/fixtures/ssl/ca.pem +30 -30
  222. data/spec/fixtures/ssl/crl.pem +15 -15
  223. data/spec/fixtures/ssl/ec-key.pem +18 -0
  224. data/spec/fixtures/ssl/ec.pem +40 -0
  225. data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
  226. data/spec/fixtures/ssl/encrypted-key.pem +57 -57
  227. data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
  228. data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
  229. data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
  230. data/spec/fixtures/ssl/intermediate.pem +31 -31
  231. data/spec/fixtures/ssl/pluto-key.pem +56 -56
  232. data/spec/fixtures/ssl/pluto.pem +28 -28
  233. data/spec/fixtures/ssl/request-key.pem +56 -56
  234. data/spec/fixtures/ssl/request.pem +24 -24
  235. data/spec/fixtures/ssl/revoked-key.pem +56 -56
  236. data/spec/fixtures/ssl/revoked.pem +25 -25
  237. data/spec/fixtures/ssl/signed-key.pem +56 -56
  238. data/spec/fixtures/ssl/signed.pem +25 -25
  239. data/spec/fixtures/ssl/tampered-cert.pem +27 -27
  240. data/spec/fixtures/ssl/tampered-csr.pem +24 -24
  241. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
  242. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
  243. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
  244. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
  245. data/spec/integration/configurer_spec.rb +0 -52
  246. data/spec/integration/provider/service/init_spec.rb +1 -0
  247. data/spec/integration/provider/service/systemd_spec.rb +5 -8
  248. data/spec/integration/type/file_spec.rb +38 -28
  249. data/spec/integration/util/execution_spec.rb +0 -27
  250. data/spec/lib/puppet/certificate_factory.rb +2 -2
  251. data/spec/lib/puppet/test_ca.rb +17 -4
  252. data/spec/lib/puppet_spec/fixtures.rb +4 -0
  253. data/spec/spec_helper.rb +0 -28
  254. data/spec/unit/application/agent_spec.rb +34 -67
  255. data/spec/unit/application/device_spec.rb +1 -27
  256. data/spec/unit/application/ssl_spec.rb +60 -35
  257. data/spec/unit/configurer_spec.rb +399 -395
  258. data/spec/unit/defaults_spec.rb +4 -4
  259. data/spec/unit/face/facts_spec.rb +0 -9
  260. data/spec/unit/face/parser_spec.rb +69 -22
  261. data/spec/unit/face/plugin_spec.rb +0 -8
  262. data/spec/unit/file_system_spec.rb +30 -1
  263. data/spec/unit/forge/forge_spec.rb +3 -1
  264. data/spec/unit/forge/repository_spec.rb +3 -1
  265. data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
  266. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  267. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  268. data/spec/unit/network/http/api/indirected_routes_spec.rb +10 -25
  269. data/spec/unit/network/http/connection_spec.rb +145 -119
  270. data/spec/unit/network/http/factory_spec.rb +5 -27
  271. data/spec/unit/parser/scope_spec.rb +0 -10
  272. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
  273. data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
  274. data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
  275. data/spec/unit/pops/types/types_spec.rb +27 -0
  276. data/spec/unit/provider/exec_spec.rb +0 -209
  277. data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
  278. data/spec/unit/provider/package/dnf_spec.rb +0 -7
  279. data/spec/unit/provider/package/dpkg_spec.rb +80 -240
  280. data/spec/unit/provider/package/pip_spec.rb +8 -61
  281. data/spec/unit/provider/package/portage_spec.rb +4 -4
  282. data/spec/unit/provider/package/rpm_spec.rb +16 -150
  283. data/spec/unit/provider/package/yum_spec.rb +0 -7
  284. data/spec/unit/provider/service/daemontools_spec.rb +0 -24
  285. data/spec/unit/provider/service/launchd_spec.rb +0 -28
  286. data/spec/unit/provider/service/runit_spec.rb +0 -24
  287. data/spec/unit/provider/service/systemd_spec.rb +25 -39
  288. data/spec/unit/provider/service/windows_spec.rb +0 -20
  289. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  290. data/spec/unit/provider/user/pw_spec.rb +0 -37
  291. data/spec/unit/provider/user/useradd_spec.rb +0 -88
  292. data/spec/unit/resource_spec.rb +1 -26
  293. data/spec/unit/ssl/host_spec.rb +5 -0
  294. data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
  295. data/spec/unit/ssl/state_machine_spec.rb +233 -158
  296. data/spec/unit/transaction_spec.rb +0 -64
  297. data/spec/unit/type/exec_spec.rb +12 -15
  298. data/spec/unit/type/file/content_spec.rb +3 -9
  299. data/spec/unit/type/file/source_spec.rb +4 -4
  300. data/spec/unit/type/file_spec.rb +15 -11
  301. data/spec/unit/type/package_spec.rb +0 -5
  302. data/spec/unit/type/schedule_spec.rb +1 -3
  303. data/spec/unit/type/service_spec.rb +0 -16
  304. data/spec/unit/util/execution_spec.rb +0 -16
  305. data/spec/unit/util/http_proxy_spec.rb +21 -151
  306. data/spec/unit/util/ldap/manager_spec.rb +0 -15
  307. data/spec/unit/util/log/destinations_spec.rb +3 -7
  308. data/spec/unit/util/log_spec.rb +138 -0
  309. data/spec/unit/util/logging_spec.rb +0 -200
  310. data/spec/unit/util/pidlock_spec.rb +0 -26
  311. data/spec/unit/util/skip_tags_spec.rb +14 -0
  312. data/spec/unit/util/windows/adsi_spec.rb +0 -51
  313. data/spec/unit/util/windows/service_spec.rb +0 -9
  314. data/spec/unit/util_spec.rb +10 -0
  315. data/spec/unit/x509/cert_provider_spec.rb +82 -43
  316. data/tasks/generate_cert_fixtures.rake +13 -1
  317. data/tasks/manpages.rake +0 -1
  318. metadata +28 -22
  319. data/ext/cert_inspector +0 -140
  320. data/ext/envpuppet +0 -139
  321. data/ext/envpuppet.bat +0 -14
  322. data/ext/puppet-test +0 -476
  323. data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
  324. data/ext/upload_facts.rb +0 -119
  325. data/lib/puppet/provider/package/dnfmodule.rb +0 -87
  326. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
  327. data/spec/integration/type/notify_spec.rb +0 -46
  328. data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
  329. data/spec/unit/provider/package_targetable_spec.rb +0 -60
@@ -35,12 +35,6 @@ Puppet::Type.type(:service).provide :windows, :parent => :service do
35
35
  raise Puppet::Error.new(_("Cannot enable %{resource_name} for manual start, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
36
36
  end
37
37
 
38
- def delayed_start
39
- Puppet::Util::Windows::Service.set_startup_mode( @resource[:name], :SERVICE_AUTO_START, true )
40
- rescue => detail
41
- raise Puppet::Error.new(_("Cannot enable %{resource_name} for delayed start, error was: %{detail}") % { resource_name: @resource[:name], detail: detail }, detail )
42
- end
43
-
44
38
  def enabled?
45
39
  return :false unless Puppet::Util::Windows::Service.exists?(@resource[:name])
46
40
 
@@ -53,8 +47,6 @@ Puppet::Type.type(:service).provide :windows, :parent => :service do
53
47
  :true
54
48
  when :SERVICE_DEMAND_START
55
49
  :manual
56
- when :SERVICE_DELAYED_AUTO_START
57
- :delayed
58
50
  when :SERVICE_DISABLED
59
51
  :false
60
52
  else
@@ -503,7 +503,7 @@ Puppet::Type.type(:user).provide :directoryservice do
503
503
  def next_system_id(min_id=20)
504
504
  dscl_output = dscl '.', '-list', '/Users', 'uid'
505
505
  # We're ok with throwing away negative uids here. Also, remove nil values.
506
- user_ids = dscl_output.split.compact.collect { |l| l.to_i if l =~ /^\d+$/ }
506
+ user_ids = dscl_output.split.compact.collect { |l| l.to_i if l.match(/^\d+$/) }
507
507
  ids = user_ids.compact!.sort! { |a,b| a.to_f <=> b.to_f }
508
508
  # We're just looking for an unused id in our sorted array.
509
509
  ids.each_index do |i|
@@ -29,7 +29,7 @@ Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do
29
29
 
30
30
  def modifycmd(param,value)
31
31
  cmd = super(param, value)
32
- cmd.insert(1,"-F")
32
+ cmd << "-F"
33
33
  if trusted then
34
34
  # Append an additional command to reset the password age to 0
35
35
  # until a workaround with expiry module can be found for trusted
@@ -66,11 +66,11 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
66
66
 
67
67
  # use pw to update password hash
68
68
  def password=(cryptopw)
69
- Puppet.debug "change password for user '#{@resource[:name]}' method called with hash [redacted]"
69
+ Puppet.debug "change password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
70
70
  stdin, _, _ = Open3.popen3("pw user mod #{@resource[:name]} -H 0")
71
71
  stdin.puts(cryptopw)
72
72
  stdin.close
73
- Puppet.debug "finished password for user '#{@resource[:name]}' method called with hash [redacted]"
73
+ Puppet.debug "finished password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
74
74
  end
75
75
 
76
76
  # get password from /etc/master.passwd
@@ -78,19 +78,10 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
78
78
  Puppet.debug "checking password for user '#{@resource[:name]}' method called"
79
79
  current_passline = `getent passwd #{@resource[:name]}`
80
80
  current_password = current_passline.chomp.split(':')[1] if current_passline
81
- Puppet.debug "finished password for user '#{@resource[:name]}' method called : [redacted]"
81
+ Puppet.debug "finished password for user '#{@resource[:name]}' method called : '#{current_password}'"
82
82
  current_password
83
83
  end
84
84
 
85
- def has_sensitive_data?(property = nil)
86
- #Check for sensitive values?
87
- properties = property ? [property] : Puppet::Type.type(:user).validproperties
88
- properties.any? do |prop|
89
- p = @resource.parameter(prop)
90
- p && p.respond_to?(:is_sensitive) && p.is_sensitive
91
- end
92
- end
93
-
94
85
  # Get expiry from system and convert to Puppet-style date
95
86
  def expiry
96
87
  expiry = self.get(:expiry)
@@ -36,7 +36,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
36
36
  has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords, :manages_password_age, :manages_shell
37
37
 
38
38
  def check_valid_shell
39
- unless File.exist?(@resource.should(:shell))
39
+ unless File.exists?(@resource.should(:shell))
40
40
  raise(Puppet::Error, "Shell #{@resource.should(:shell)} must exist")
41
41
  end
42
42
  unless File.executable?(@resource.should(:shell).to_s)
@@ -202,10 +202,6 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
202
202
  shadow_entry[5].empty? ? -1 : shadow_entry[5]
203
203
  end
204
204
 
205
- def has_sensitive_data?(property = nil)
206
- false
207
- end
208
-
209
205
  # Read in /etc/shadow, find the line for our used and rewrite it with the
210
206
  # new pw. Smooth like 80 grit sandpaper.
211
207
  #
@@ -55,44 +55,35 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
55
55
  get(:uid)
56
56
  end
57
57
 
58
- def comment
59
- return localcomment if @resource.forcelocal?
60
- get(:comment)
61
- end
62
-
63
58
  def finduser(key, value)
64
59
  passwd_file = "/etc/passwd"
65
- passwd_keys = [:account, :password, :uid, :gid, :gecos, :directory, :shell]
60
+ passwd_keys = ['account', 'password', 'uid', 'gid', 'gecos', 'directory', 'shell']
66
61
  index = passwd_keys.index(key)
67
62
  File.open(passwd_file) do |f|
68
63
  f.each_line do |line|
69
- user = line.split(":")
70
- if user[index] == value
71
- return Hash[passwd_keys.zip(user)]
72
- end
64
+ user = line.split(":")
65
+ if user[index] == value
66
+ f.close
67
+ return user
68
+ end
73
69
  end
74
70
  end
75
71
  false
76
72
  end
77
73
 
78
74
  def local_username
79
- finduser(:uid, @resource.uid)
75
+ finduser('uid', @resource.uid)
80
76
  end
81
77
 
82
78
  def localuid
83
- user = finduser(:account, resource[:name])
84
- return user[:uid] if user
79
+ user = finduser('account', resource[:name])
80
+ return user[2] if user
85
81
  false
86
82
  end
87
83
 
88
- def localcomment
89
- user = finduser(:account, resource[:name])
90
- user[:gecos]
91
- end
92
-
93
84
  def shell=(value)
94
85
  check_valid_shell
95
- set(:shell, value)
86
+ set("shell", value)
96
87
  end
97
88
 
98
89
  verify :gid, "GID must be an integer" do |value|
@@ -115,8 +106,8 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
115
106
  # to ensure consistent behaviour of the useradd provider when
116
107
  # using both useradd and luseradd
117
108
  if (!@resource.allowdupe?) && @resource.forcelocal?
118
- if @resource.should(:uid) && finduser(:uid, @resource.should(:uid).to_s)
119
- raise(Puppet::Error, "UID #{@resource.should(:uid)} already exists, use allowdupe to force user creation")
109
+ if @resource.should(:uid) && finduser('uid', @resource.should(:uid).to_s)
110
+ raise(Puppet::Error, "UID #{@resource.should(:uid).to_s} already exists, use allowdupe to force user creation")
120
111
  end
121
112
  elsif @resource.allowdupe? && (!@resource.forcelocal?)
122
113
  return ["-o"]
@@ -125,7 +116,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
125
116
  end
126
117
 
127
118
  def check_valid_shell
128
- unless File.exist?(@resource.should(:shell))
119
+ unless File.exists?(@resource.should(:shell))
129
120
  raise(Puppet::Error, "Shell #{@resource.should(:shell)} must exist")
130
121
  end
131
122
  unless File.executable?(@resource.should(:shell).to_s)
@@ -156,35 +147,19 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
156
147
  # validproperties is a list of properties in undefined order
157
148
  # sort them to have a predictable command line in tests
158
149
  Puppet::Type.type(:user).validproperties.sort.each do |property|
159
- value = get_value_for_property(property)
160
- next if value.nil?
150
+ next if property == :ensure
151
+ next if property_manages_password_age?(property)
152
+ next if (property == :groups) && @resource.forcelocal?
153
+ next if (property == :expiry) && @resource.forcelocal?
161
154
  # the value needs to be quoted, mostly because -c might
162
155
  # have spaces in it
163
- cmd << flag(property) << munge(property, value)
156
+ if (value = @resource.should(property)) && (value != "")
157
+ cmd << flag(property) << munge(property, value)
158
+ end
164
159
  end
165
160
  cmd
166
161
  end
167
162
 
168
- def get_value_for_property(property)
169
- return nil if property == :ensure
170
- return nil if property_manages_password_age?(property)
171
- return nil if property == :groups and @resource.forcelocal?
172
- return nil if property == :expiry and @resource.forcelocal?
173
- value = @resource.should(property)
174
- return nil if !value || value == ""
175
-
176
- value
177
- end
178
-
179
- def has_sensitive_data?(property = nil)
180
- #Check for sensitive values?
181
- properties = property ? [property] : Puppet::Type.type(:user).validproperties
182
- properties.any? do |prop|
183
- p = @resource.parameter(prop)
184
- p && p.respond_to?(:is_sensitive) && p.is_sensitive
185
- end
186
- end
187
-
188
163
  def addcmd
189
164
  if @resource.forcelocal?
190
165
  cmd = [command(:localadd)]
@@ -125,13 +125,14 @@ Puppet::Type.type(:user).provide :windows_adsi do
125
125
 
126
126
  def password=(value)
127
127
  if user.disabled?
128
- info _("The user account '%s' is disabled; The password will still be changed" % @resource[:name])
128
+ warning _("The user account '%s' is disabled; puppet will not reset the password" % @resource[:name])
129
129
  elsif user.locked_out?
130
- info _("The user account '%s' is locked out; The password will still be changed" % @resource[:name])
130
+ warning _("The user account '%s' is locked out; puppet will not reset the password" % @resource[:name])
131
131
  elsif user.expired?
132
- info _("The user account '%s' is expired; The password will still be changed" % @resource[:name])
132
+ warning _("The user account '%s' is expired; puppet will not reset the password" % @resource[:name])
133
+ else
134
+ user.password = value
133
135
  end
134
- user.password = value
135
136
  end
136
137
 
137
138
  def uid
@@ -33,9 +33,9 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
33
33
  elsif name.to_s == 'logdir'
34
34
  val = 'Unix/Linux: /var/log/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\var\log -- Non-root user: ~/.puppetlabs/var/log'
35
35
  elsif name.to_s == 'hiera_config'
36
- val = '$confdir/hiera.yaml. However, if a file exists at $codedir/hiera.yaml, Puppet uses that instead.'
36
+ val = '$confdir/hiera.yaml. However, for backwards compatibility, if a file exists at $codedir/hiera.yaml, Puppet uses that instead.'
37
37
  elsif name.to_s == 'certname'
38
- val = "the Host's fully qualified domain name, as determined by facter"
38
+ val = "the Host's fully qualified domain name, as determined by Facter"
39
39
  end
40
40
 
41
41
  # Leave out the section information; it was apparently confusing people.
@@ -80,7 +80,7 @@ config.header = <<EOT
80
80
  * Settings that take a single file or directory can optionally set the owner,
81
81
  group, and mode for their value: `rundir = $vardir/run { owner = puppet,
82
82
  group = puppet, mode = 644 }`
83
- * The Puppet executables will ignore any setting that isn't relevant to
83
+ * The Puppet executables ignores any setting that isn't relevant to
84
84
  their function.
85
85
 
86
86
  See the [configuration guide][confguide] for more details.
@@ -5,14 +5,14 @@ require 'puppet/file_serving/metadata'
5
5
 
6
6
  reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirection types and their terminus classes" do
7
7
  text = ""
8
- Puppet::Indirector::Indirection.instances.sort_by(&:to_s).each do |indirection|
8
+ Puppet::Indirector::Indirection.instances.sort { |a,b| a.to_s <=> b.to_s }.each do |indirection|
9
9
  ind = Puppet::Indirector::Indirection.instance(indirection)
10
10
  name = indirection.to_s.capitalize
11
11
  text << "## " + indirection.to_s + "\n\n"
12
12
 
13
13
  text << Puppet::Util::Docs.scrub(ind.doc) + "\n\n"
14
14
 
15
- Puppet::Indirector::Terminus.terminus_classes(ind.name).sort_by(&:to_s).each do |terminus|
15
+ Puppet::Indirector::Terminus.terminus_classes(ind.name).sort { |a,b| a.to_s <=> b.to_s }.each do |terminus|
16
16
  terminus_name = terminus.to_s
17
17
  term_class = Puppet::Indirector::Terminus.terminus_class(ind.name, terminus)
18
18
  if term_class
@@ -19,7 +19,9 @@ etc.), prevent Puppet from making changes (`noop`), and change logging verbosity
19
19
  params << param
20
20
  }
21
21
 
22
- params.sort_by(&:to_s).each { |param|
22
+ params.sort { |a,b|
23
+ a.to_s <=> b.to_s
24
+ }.each { |param|
23
25
  str << markdown_header(param.to_s, 3)
24
26
  str << scrub(Puppet::Type.metaparamdoc(param))
25
27
  str << "\n\n"
@@ -32,9 +32,10 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
32
32
 
33
33
  table_data = {}
34
34
 
35
+ functional = false
35
36
  notes = []
36
37
  default = type.defaultprovider ? type.defaultprovider.name : 'none'
37
- type.providers.sort_by(&:to_s).each do |pname|
38
+ type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname|
38
39
  data = []
39
40
  table_data[pname] = data
40
41
  provider = type.provider(pname)
@@ -43,6 +44,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
43
44
  if missing = provider.suitable?(false) and missing.empty?
44
45
  data << "*X*"
45
46
  suit = true
47
+ functional = true
46
48
  else
47
49
  data << "[#{count}]_" # A pointer to the appropriate footnote
48
50
  suit = false
@@ -49,7 +49,9 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
49
49
 
50
50
  }
51
51
 
52
- types.sort_by(&:to_s).each { |name,type|
52
+ types.sort { |a,b|
53
+ a.to_s <=> b.to_s
54
+ }.each { |name,type|
53
55
 
54
56
  str << "
55
57
 
@@ -67,7 +69,9 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
67
69
  end
68
70
 
69
71
  docs = {}
70
- type.validproperties.sort_by(&:to_s).reject { |sname|
72
+ type.validproperties.sort { |a,b|
73
+ a.to_s <=> b.to_s
74
+ }.reject { |sname|
71
75
  property = type.propertybyname(sname)
72
76
  property.nodoc
73
77
  }.each { |sname|
@@ -87,7 +91,9 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
87
91
  }
88
92
 
89
93
  str << markdown_header("Parameters", 4) + "\n"
90
- type.parameters.sort_by(&:to_s).each { |type_name, param|
94
+ type.parameters.sort { |a,b|
95
+ a.to_s <=> b.to_s
96
+ }.each { |type_name, param|
91
97
  docs[type_name] = scrub(type.paramdoc(type_name))
92
98
  }
93
99
 
@@ -74,7 +74,7 @@ class Puppet::Reports
74
74
 
75
75
  # Use this method so they all get loaded
76
76
  instance_loader(:report).loadall(Puppet.lookup(:current_environment))
77
- loaded_instances(:report).sort_by(&:to_s).each do |name|
77
+ loaded_instances(:report).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
78
78
  mod = self.report(name)
79
79
  docs << "#{name}\n#{"-" * name.to_s.length}\n"
80
80
 
@@ -209,7 +209,7 @@ class Puppet::Resource
209
209
  end
210
210
 
211
211
  def stage?
212
- @is_stage ||= @type.to_s.casecmp("stage").zero?
212
+ @is_stage ||= @type.to_s.downcase == "stage"
213
213
  end
214
214
 
215
215
  # Construct a resource from data.
@@ -427,8 +427,6 @@ class Puppet::Resource
427
427
  end
428
428
 
429
429
  # Convert our resource to yaml for Hiera purposes.
430
- #
431
- # @deprecated Use {to_hiera_hash} instead.
432
430
  def to_hierayaml
433
431
  # Collect list of attributes to align => and move ensure first
434
432
  attr = parameters.keys
@@ -448,21 +446,6 @@ class Puppet::Resource
448
446
  " %s:\n%s" % [self.title, attributes]
449
447
  end
450
448
 
451
- # Convert our resource to a hiera hash suitable for serialization.
452
- def to_hiera_hash
453
- # to_data_hash converts to safe Data types, e.g. no symbols, unicode replacement character
454
- h = to_data_hash
455
-
456
- params = h['parameters'] || {}
457
- value = params.delete('ensure')
458
-
459
- res = {}
460
- res['ensure'] = value if value
461
- res.merge!(Hash[params.sort])
462
-
463
- return { h['title'] => res }
464
- end
465
-
466
449
  # Convert our resource to Puppet code.
467
450
  def to_manifest
468
451
  # Collect list of attributes to align => and move ensure first
@@ -637,7 +637,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
637
637
  result.add_resource newres
638
638
  end
639
639
 
640
- message = convert.to_s.tr "_", " "
640
+ message = convert.to_s.gsub "_", " "
641
641
  edges.each do |edge|
642
642
  # Skip edges between virtual resources.
643
643
  next if virtual_not_exported?(edge.source)
@@ -1,10 +1,10 @@
1
+ require 'time'
1
2
  require 'puppet/rest/route'
2
3
  require 'puppet/network/http_pool'
3
4
  require 'puppet/network/http/compression'
4
5
 
5
6
  module Puppet::Rest
6
7
  module Routes
7
-
8
8
  extend Puppet::Network::HTTP::Compression.module
9
9
 
10
10
  ACCEPT_ENCODING = 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
@@ -16,9 +16,14 @@ module Puppet::Rest
16
16
  srv_service: :ca)
17
17
  end
18
18
 
19
- # Make an HTTP request to fetch the named certificate
20
- # @param [String] name the name of the certificate to fetch
21
- # @param [Puppet::SSL::SSLContext] ssl_context the ssl content to use when making the request
19
+ def self.clear
20
+ @ca = nil
21
+ end
22
+
23
+ # Make an HTTP request to fetch the named certificate.
24
+ #
25
+ # @param name [String] the name of the certificate to fetch
26
+ # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request
22
27
  # @raise [Puppet::Rest::ResponseError] if the response status is not OK
23
28
  # @return [String] the PEM-encoded certificate or certificate bundle
24
29
  def self.get_certificate(name, ssl_context)
@@ -41,14 +46,19 @@ module Puppet::Rest
41
46
  end
42
47
  end
43
48
 
44
- # Make an HTTP request to fetch the named crl
45
- # @param [String] name the crl to fetch
46
- # @param [Puppet::SSL::SSLContext] ssl_context the ssl content to use when making the request
49
+ # Make an HTTP request to fetch the named crl.
50
+ #
51
+ # @param name [String] name of the crl to fetch
52
+ # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request
53
+ # @param if_modified_since [Time, nil] If non-nil, then only download the CRL if it has been
54
+ # modified since the specified time.
47
55
  # @raise [Puppet::Rest::ResponseError] if the response status is not OK
48
56
  # @return [String] the PEM-encoded crl
49
- def self.get_crls(name, ssl_context)
57
+ def self.get_crls(name, ssl_context, if_modified_since: nil)
50
58
  ca.with_base_url(Puppet::Network::Resolver.new) do |url|
51
59
  header = { 'Accept' => 'text/plain', 'Accept-Encoding' => ACCEPT_ENCODING }
60
+ header['If-Modified-Since'] = if_modified_since.httpdate if if_modified_since
61
+
52
62
  url.path += "certificate_revocation_list/#{name}"
53
63
 
54
64
  use_ssl = url.is_a? URI::HTTPS
@@ -66,11 +76,12 @@ module Puppet::Rest
66
76
  end
67
77
  end
68
78
 
69
- # Make an HTTP request to send the named CSR
70
- # @param [String] csr_pem the contents of the CSR to sent to the CA
71
- # @param [String] name the name of the host whose CSR is being submitted
72
- # @param [Puppet::SSL::SSLContext] ssl_context the ssl content to use when making the request
73
- # @rasies [Puppet::Rest::ResponseError] if the response status is not OK
79
+ # Make an HTTP request to send the named CSR.
80
+ #
81
+ # @param csr_pem [String] the contents of the CSR to sent to the CA
82
+ # @param name [String] the name of the host whose CSR is being submitted
83
+ # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request
84
+ # @raise [Puppet::Rest::ResponseError] if the response status is not OK
74
85
  def self.put_certificate_request(csr_pem, name, ssl_context)
75
86
  ca.with_base_url(Puppet::Network::Resolver.new) do |url|
76
87
  header = { 'Accept' => 'text/plain',
@@ -91,11 +102,13 @@ module Puppet::Rest
91
102
  end
92
103
  end
93
104
 
94
- # Make an HTTP request to get the named CSR
95
- # @param [String] name the name of the host whose CSR is being queried
96
- # @param [Puppet::SSL::SSLContext] ssl_context the ssl content to use when making the request
97
- # @rasies [Puppet::Rest::ResponseError] if the response status is not OK
105
+ # Make an HTTP request to get the named CSR.
106
+ #
107
+ # @param name [String] the name of the host whose CSR is being queried
108
+ # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request
109
+ # @raise [Puppet::Rest::ResponseError] if the response status is not OK
98
110
  # @return [String] the PEM encoded certificate request
111
+ # @deprecated
99
112
  def self.get_certificate_request(name, ssl_context)
100
113
  ca.with_base_url(Puppet::Network::Resolver.new) do |url|
101
114
  header = { 'Accept' => 'text/plain', 'Accept-Encoding' => ACCEPT_ENCODING }