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
@@ -1,7 +0,0 @@
1
- hostclass "foobar" do
2
- notify "this is a test", "loglevel" => "warning"
3
- end
4
-
5
- node "default" do
6
- acquire "foobar"
7
- end
@@ -1,119 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'net/https'
4
- require 'openssl'
5
- require 'openssl/x509'
6
- require 'optparse'
7
- require 'pathname'
8
- require 'yaml'
9
-
10
- require 'puppet'
11
- require 'puppet/network/http_pool'
12
-
13
- class Puppet::Application::UploadFacts < Puppet::Application
14
- run_mode :master
15
-
16
- option('--debug', '-d')
17
- option('--verbose', '-v')
18
-
19
- option('--logdest DEST', '-l DEST') do |arg|
20
- Puppet::Util::Log.newdestination(arg)
21
- options[:setdest] = true
22
- end
23
-
24
- option('--minutes MINUTES', '-m MINUTES') do |minutes|
25
- options[:time_limit] = 60 * minutes.to_i
26
- end
27
-
28
- def help
29
- print <<HELP
30
- == Synopsis
31
-
32
- Upload cached facts to the inventory service.
33
-
34
- = Usage
35
-
36
- upload_facts [-d|--debug] [-v|--verbose] [-m|--minutes <minutes>]
37
- [-l|--logdest syslog|<file>|console]
38
-
39
- = Description
40
-
41
- This command will read YAML facts from the puppet master's YAML directory, and
42
- save them to the configured facts_terminus. It is intended to be used with the
43
- facts_terminus set to inventory_service, in order to ensure facts which have
44
- been cached locally due to a temporary failure are still uploaded to the
45
- inventory service.
46
-
47
- = Usage Notes
48
-
49
- upload_facts is intended to be run from cron, with the facts_terminus set to
50
- inventory_service. The +--minutes+ argument should be set to the length of time
51
- between upload_facts runs. This will ensure that only new YAML files are
52
- uploaded.
53
-
54
- = Options
55
-
56
- Note that any setting that's valid in the configuration file
57
- is also a valid long argument. For example, 'server' is a valid configuration
58
- parameter, so you can specify '--server <servername>' as an argument.
59
-
60
- See the configuration file documentation at
61
- https://puppet.com/docs/puppet/latest/configuration.html for
62
- the full list of acceptable parameters. A commented list of all
63
- configuration options can also be generated by running puppet agent with
64
- '--genconfig'.
65
-
66
- minutes::
67
- Limit the upload only to YAML files which have been added within the last n
68
- minutes.
69
- HELP
70
-
71
- exit
72
- end
73
-
74
- def setup
75
- # Handle the logging settings.
76
- if options[:debug] or options[:verbose]
77
- if options[:debug]
78
- Puppet::Util::Log.level = :debug
79
- else
80
- Puppet::Util::Log.level = :info
81
- end
82
-
83
- Puppet::Util::Log.newdestination(:console) unless options[:setdest]
84
- end
85
-
86
- exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
87
- end
88
-
89
- def main
90
- dir = Pathname.new(Puppet[:yamldir]) + 'facts'
91
-
92
- cutoff = options[:time_limit] ? Time.now - options[:time_limit] : Time.at(0)
93
-
94
- files = dir.children.select do |file|
95
- file.extname == '.yaml' && file.mtime > cutoff
96
- end
97
-
98
- failed = false
99
-
100
- terminus = Puppet::Node::Facts.indirection.terminus
101
-
102
- files.each do |file|
103
- facts = YAML.load_file(file)
104
-
105
- request = Puppet::Indirector::Request.new(:facts, :save, facts, nil)
106
-
107
- # The terminus warns for us if we fail.
108
- if terminus.save(request)
109
- Puppet.info "Uploaded facts for #{facts.name} to inventory service"
110
- else
111
- failed = true
112
- end
113
- end
114
-
115
- exit !failed
116
- end
117
- end
118
-
119
- Puppet::Application::UploadFacts.new.run
@@ -1,87 +0,0 @@
1
- # dnfmodule - A puppet package provider for DNF modules
2
- #
3
- # Installing a module:
4
- # package { 'postgresql':
5
- # provider => 'dnfmodule',
6
- # ensure => '9.6', # install a specific stream
7
- # flavor => 'client', # install a specific profile
8
- # }
9
-
10
-
11
- require 'puppet/provider/package'
12
-
13
- Puppet::Type.type(:package).provide :dnfmodule, :parent => :dnf do
14
-
15
- has_feature :installable, :uninstallable, :versionable
16
- #has_feature :upgradeable
17
- # it's not (yet) feasible to make this upgradeable since module streams don't
18
- # always have matching version types (i.e. idm has streams DL1 and client,
19
- # other modules have semver streams, others have string streams... we cannot
20
- # programatically determine a latest version for ensure => 'latest'
21
-
22
- commands :dnf => '/usr/bin/dnf'
23
-
24
- def self.current_version
25
- @current_version ||= dnf('--version').split.first
26
- end
27
-
28
- def self.prefetch(packages)
29
- if Puppet::Util::Package.versioncmp(current_version, '3.0.1') < 0
30
- raise Puppet::Error, _("Modules are not supported on DNF versions lower than 3.0.1")
31
- end
32
- super
33
- end
34
-
35
- def self.instances
36
- packages = []
37
- cmd = "#{command(:dnf)} module list --installed -d 0 -e #{error_level}"
38
- execute(cmd).each_line do |line|
39
- next unless line =~ /\[i\][, ]/ # get rid of non-package lines (including last Hint line)
40
- line.gsub!(/\[[de]\]/, '') # we don't care about default/enabled flags
41
- packages << new(
42
- name: line.split[0],
43
- ensure: line.split[1],
44
- flavor: line.split('[i]').first.split.last, # this is nasty
45
- provider: name
46
- )
47
- end
48
- packages
49
- end
50
-
51
- def query
52
- pkg = self.class.instances.find do |package|
53
- @resource[:name] == package.name
54
- end
55
- pkg ? pkg.properties : nil
56
- end
57
-
58
- def reset
59
- execute([command(:dnf), 'module', 'reset', '-d', '0', '-e', self.class.error_level, '-y', @resource[:name]])
60
- end
61
-
62
- # to install specific streams and profiles:
63
- # $ dnf module install module-name:stream/profile
64
- # $ dnf module install perl:5.24/minimal
65
- # if unspecified, they will be defaulted (see [d] param in dnf module list output)
66
- def install
67
- args = @resource[:name]
68
- # ensure we start fresh (remove existing stream)
69
- uninstall unless [:absent, :purged].include?(@property_hash[:ensure])
70
- case @resource[:ensure]
71
- when true, false, Symbol
72
- # pass
73
- else
74
- args << ":#{@resource[:ensure]}"
75
- end
76
- if @resource[:flavor]
77
- args << "/#{@resource[:flavor]}"
78
- end
79
- execute([command(:dnf), 'module', 'install', '-d', '0', '-e', self.class.error_level, '-y', args])
80
- end
81
-
82
- def uninstall
83
- execute([command(:dnf), 'module', 'remove', '-d', '0', '-e', self.class.error_level, '-y', @resource[:name]])
84
- reset # reset module to the default stream
85
- end
86
- end
87
-
@@ -1,11 +0,0 @@
1
- localmirror-appstream
2
- Name Stream Profiles Summary
3
- gimp 2.8 [d][e] common [d], devel [i] gimp module
4
- mariadb 10.3 [d][e] client [i], server [d], galera MariaDB Module
5
- nodejs 10 [d][e] common [d], development, minimal [i], s2i Javascript runtime
6
- perl 5.26 [d][e] common [d], minimal [i] Practical Extraction and Report Language
7
- postgresql 10 [d][e] client, server [d] [i] PostgreSQL server and client module
8
- rust-toolset rhel8 [d][e] common [d] [i] Rust
9
- subversion 1.10 [d][e] common [d], server [i] Apache Subversion
10
-
11
- Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
- require 'puppet_spec/compiler'
3
-
4
- describe Puppet::Type.type(:notify) do
5
- include PuppetSpec::Compiler
6
-
7
- it "logs the title at notice level" do
8
- apply_compiled_manifest(<<-MANIFEST)
9
- notify { 'hi': }
10
- MANIFEST
11
-
12
- expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'hi'))
13
- end
14
-
15
- it "logs the message property" do
16
- apply_compiled_manifest(<<-MANIFEST)
17
- notify { 'title':
18
- message => 'hello'
19
- }
20
- MANIFEST
21
-
22
- expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'hello'"))
23
- end
24
-
25
- it "redacts sensitive message properties" do
26
- apply_compiled_manifest(<<-MANIFEST)
27
- $message = Sensitive('secret')
28
- notify { 'notify1':
29
- message => $message
30
- }
31
- MANIFEST
32
-
33
- expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'changed [redacted] to [redacted]'))
34
- end
35
-
36
- it "redacts sensitive interpolated message properties" do
37
- apply_compiled_manifest(<<-MANIFEST)
38
- $message = Sensitive('secret')
39
- notify { 'notify2':
40
- message => "${message}"
41
- }
42
- MANIFEST
43
-
44
- expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'Sensitive [value redacted]'"))
45
- end
46
- end
@@ -1,186 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Puppet::Type.type(:package).provider(:dnfmodule) do
4
- include PuppetSpec::Fixtures
5
-
6
- let(:dnf_version) do
7
- <<-DNF_OUTPUT
8
- 4.0.9
9
- Installed: dnf-0:4.0.9.2-5.el8.noarch at Wed 29 May 2019 07:05:05 AM GMT
10
- Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu 14 Feb 2019 12:04:07 PM GMT
11
-
12
- Installed: rpm-0:4.14.2-9.el8.x86_64 at Wed 29 May 2019 07:04:33 AM GMT
13
- Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Thu 20 Dec 2018 01:30:03 PM GMT
14
- DNF_OUTPUT
15
- end
16
-
17
- let(:execute_options) do
18
- {:failonfail => true, :combine => true, :custom_environment => {}}
19
- end
20
-
21
- let(:packages) { File.read(my_fixture("dnf-module-list-installed.txt")) }
22
- let(:dnf_path) { '/usr/bin/dnf' }
23
-
24
- before(:each) { allow(Puppet::Util).to receive(:which).with('/usr/bin/dnf').and_return(dnf_path) }
25
-
26
- it "should have lower specificity" do
27
- allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
28
- allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat)
29
- allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8')
30
- expect(described_class.specificity).to be < 200
31
- end
32
-
33
- describe "should be an opt-in provider" do
34
- Array(4..8).each do |ver|
35
- it "should not be default for redhat #{ver}" do
36
- allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat')
37
- allow(Facter).to receive(:value).with(:osfamily).and_return('redhat')
38
- allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s)
39
- expect(described_class).not_to be_default
40
- end
41
- end
42
- end
43
-
44
- describe "handling dnf versions" do
45
- before(:each) do
46
- expect(Puppet::Type::Package::ProviderDnfmodule).to receive(:execute)
47
- .with(["/usr/bin/dnf", "--version"])
48
- .and_return(dnf_version).at_most(:once)
49
- expect(Puppet::Util::Execution).to receive(:execute)
50
- .with(["/usr/bin/dnf", "--version"], execute_options)
51
- .and_return(Puppet::Util::Execution::ProcessOutput.new(dnf_version, 0))
52
- end
53
-
54
- describe "with a supported dnf version" do
55
- it "correctly parses the version" do
56
- expect(described_class.current_version).to eq('4.0.9')
57
- end
58
- end
59
-
60
- describe "with an unsupported dnf version" do
61
- let(:dnf_version) do
62
- <<-DNF_OUTPUT
63
- 2.7.5
64
- Installed: dnf-0:2.7.5-12.fc28.noarch at Mon 13 Aug 2018 11:05:27 PM GMT
65
- Built : Fedora Project at Wed 18 Apr 2018 02:29:51 PM GMT
66
-
67
- Installed: rpm-0:4.14.1-7.fc28.x86_64 at Mon 13 Aug 2018 11:05:25 PM GMT
68
- Built : Fedora Project at Mon 19 Feb 2018 09:29:01 AM GMT
69
- DNF_OUTPUT
70
- end
71
-
72
- before(:each) { described_class.instance_variable_set("@current_version", nil) }
73
-
74
- it "correctly parses the version" do
75
- expect(described_class.current_version).to eq('2.7.5')
76
- end
77
-
78
- it "raises an error when attempting prefetch" do
79
- expect { described_class.prefetch('anything') }.to raise_error(Puppet::Error, "Modules are not supported on DNF versions lower than 3.0.1")
80
- end
81
- end
82
- end
83
-
84
- describe "when installing a module" do
85
- let(:name) { 'baz' }
86
-
87
- let(:resource) do
88
- Puppet::Type.type(:package).new(
89
- :name => name,
90
- :provider => 'dnfmodule',
91
- )
92
- end
93
-
94
- let(:provider) do
95
- provider = described_class.new
96
- provider.resource = resource
97
- provider
98
- end
99
-
100
- describe 'provider features' do
101
- it { is_expected.to be_versionable }
102
- it { is_expected.to be_installable }
103
- it { is_expected.to be_uninstallable }
104
- end
105
-
106
- context "when installing a new module" do
107
- before do
108
- provider.instance_variable_get('@property_hash')[:ensure] = :absent
109
- end
110
-
111
- it "should not reset the module stream when package is absent" do
112
- resource[:ensure] = :present
113
- expect(provider).not_to receive(:uninstall)
114
- expect(provider).to receive(:execute)
115
- provider.install
116
- end
117
-
118
- it "should not reset the module stream when package is purged" do
119
- provider.instance_variable_get('@property_hash')[:ensure] = :purged
120
- resource[:ensure] = :present
121
- expect(provider).not_to receive(:uninstall)
122
- expect(provider).to receive(:execute)
123
- provider.install
124
- end
125
-
126
- it "should install the default stream and flavor" do
127
- resource[:ensure] = :present
128
- expect(provider).to receive(:execute).with(array_including('baz'))
129
- provider.install
130
- end
131
-
132
- it "should install a specific stream" do
133
- resource[:ensure] = '9.6'
134
- expect(provider).to receive(:execute).with(array_including('baz:9.6'))
135
- provider.install
136
- end
137
-
138
- it "should install a specific flavor" do
139
- resource[:ensure] = :present
140
- resource[:flavor] = 'minimal'
141
- expect(provider).to receive(:execute).with(array_including('baz/minimal'))
142
- provider.install
143
- end
144
-
145
- it "should install a specific flavor and stream" do
146
- resource[:ensure] = '9.6'
147
- resource[:flavor] = 'minimal'
148
- expect(provider).to receive(:execute).with(array_including('baz:9.6/minimal'))
149
- provider.install
150
- end
151
- end
152
-
153
- context "when ensuring a specific version on top of another stream" do
154
- before do
155
- provider.instance_variable_get('@property_hash')[:ensure] = '9.6'
156
- end
157
-
158
- it "should remove existing packages and reset the module stream before installing" do
159
- resource[:ensure] = '10'
160
- expect(provider).to receive(:execute).thrice.with(array_including(/remove|reset|install/))
161
- provider.install
162
- end
163
- end
164
- end
165
-
166
- context "parsing the output of module list --installed" do
167
- before { allow(described_class).to receive(:command).with(:dnf).and_return(dnf_path) }
168
-
169
- it "returns an array of installed modules" do
170
- allow(Puppet::Util::Execution).to receive(:execute)
171
- .with("/usr/bin/dnf module list --installed -d 0 -e 1")
172
- .and_return(packages)
173
-
174
- installed_packages = described_class.instances.map { |package| package.properties }
175
- expected_packages = [{name: "gimp", ensure: "2.8", flavor: "devel", :provider => :dnfmodule},
176
- {name: "mariadb", ensure: "10.3", flavor: "client", :provider => :dnfmodule},
177
- {name: "nodejs", ensure: "10", flavor: "minimal", :provider => :dnfmodule},
178
- {name: "perl", ensure: "5.26", flavor: "minimal", :provider => :dnfmodule},
179
- {name: "postgresql", ensure: "10", flavor: "server", :provider => :dnfmodule},
180
- {name: "rust-toolset", ensure: "rhel8", flavor: "common", :provider => :dnfmodule},
181
- {name: "subversion", ensure: "1.10", flavor: "server", :provider => :dnfmodule}]
182
-
183
- expect(installed_packages).to eql(expected_packages)
184
- end
185
- end
186
- end