puppet 6.10.1 → 6.11.0

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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/Gemfile.lock +20 -12
  4. data/ext/project_data.yaml +3 -2
  5. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  6. data/ext/windows/service/daemon.rb +33 -8
  7. data/install.rb +6 -6
  8. data/lib/puppet.rb +8 -0
  9. data/lib/puppet/application.rb +1 -1
  10. data/lib/puppet/application/agent.rb +3 -0
  11. data/lib/puppet/application/apply.rb +2 -2
  12. data/lib/puppet/application/describe.rb +3 -9
  13. data/lib/puppet/application/device.rb +3 -0
  14. data/lib/puppet/application/doc.rb +1 -1
  15. data/lib/puppet/application/lookup.rb +1 -1
  16. data/lib/puppet/application/script.rb +2 -2
  17. data/lib/puppet/application/ssl.rb +25 -21
  18. data/lib/puppet/configurer.rb +42 -0
  19. data/lib/puppet/configurer/downloader.rb +2 -6
  20. data/lib/puppet/context/trusted_information.rb +42 -4
  21. data/lib/puppet/defaults.rb +19 -4
  22. data/lib/puppet/face/module/list.rb +5 -5
  23. data/lib/puppet/face/module/search.rb +1 -1
  24. data/lib/puppet/face/module/uninstall.rb +1 -1
  25. data/lib/puppet/face/module/upgrade.rb +1 -1
  26. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  27. data/lib/puppet/file_system.rb +0 -8
  28. data/lib/puppet/file_system/memory_file.rb +1 -1
  29. data/lib/puppet/file_system/posix.rb +3 -2
  30. data/lib/puppet/forge.rb +3 -3
  31. data/lib/puppet/functions.rb +1 -2
  32. data/lib/puppet/gettext/module_translations.rb +1 -1
  33. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  34. data/lib/puppet/graph/simple_graph.rb +4 -3
  35. data/lib/puppet/http.rb +29 -0
  36. data/lib/puppet/http/client.rb +156 -0
  37. data/lib/puppet/http/errors.rb +30 -0
  38. data/lib/puppet/http/redirector.rb +48 -0
  39. data/lib/puppet/http/resolver.rb +5 -0
  40. data/lib/puppet/http/resolver/settings.rb +5 -0
  41. data/lib/puppet/http/resolver/srv.rb +13 -0
  42. data/lib/puppet/http/response.rb +34 -0
  43. data/lib/puppet/http/retry_after_handler.rb +47 -0
  44. data/lib/puppet/http/service.rb +18 -0
  45. data/lib/puppet/http/service/ca.rb +49 -0
  46. data/lib/puppet/http/session.rb +55 -0
  47. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  48. data/lib/puppet/indirector/hiera.rb +2 -0
  49. data/lib/puppet/indirector/request.rb +1 -1
  50. data/lib/puppet/indirector/resource/ral.rb +1 -3
  51. data/lib/puppet/indirector/resource/validator.rb +1 -1
  52. data/lib/puppet/interface.rb +2 -1
  53. data/lib/puppet/interface/documentation.rb +1 -1
  54. data/lib/puppet/loaders.rb +0 -1
  55. data/lib/puppet/metatype/manager.rb +1 -1
  56. data/lib/puppet/module.rb +1 -1
  57. data/lib/puppet/module/task.rb +20 -4
  58. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  59. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  60. data/lib/puppet/module_tool/metadata.rb +1 -1
  61. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  62. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  63. data/lib/puppet/network/http.rb +2 -6
  64. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  65. data/lib/puppet/network/http/connection.rb +10 -12
  66. data/lib/puppet/network/http/pool.rb +2 -0
  67. data/lib/puppet/network/http/site.rb +5 -1
  68. data/lib/puppet/network/resolver.rb +4 -4
  69. data/lib/puppet/node/environment.rb +4 -2
  70. data/lib/puppet/pal/pal_impl.rb +2 -2
  71. data/lib/puppet/parser/ast.rb +1 -1
  72. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  73. data/lib/puppet/parser/functions.rb +1 -1
  74. data/lib/puppet/parser/scope.rb +8 -7
  75. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  76. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  77. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  78. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -7
  79. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  80. data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
  81. data/lib/puppet/pops/loaders.rb +1 -1
  82. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  83. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  84. data/lib/puppet/pops/merge_strategy.rb +22 -18
  85. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  86. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  87. data/lib/puppet/pops/parser/locator.rb +1 -1
  88. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  89. data/lib/puppet/pops/puppet_stack.rb +52 -48
  90. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  91. data/lib/puppet/pops/types/p_uri_type.rb +1 -1
  92. data/lib/puppet/pops/types/string_converter.rb +10 -10
  93. data/lib/puppet/pops/types/types.rb +3 -3
  94. data/lib/puppet/property.rb +1 -1
  95. data/lib/puppet/property/ensure.rb +1 -1
  96. data/lib/puppet/provider/exec.rb +6 -2
  97. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  98. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  99. data/lib/puppet/provider/package/apt.rb +5 -1
  100. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  101. data/lib/puppet/provider/package/dpkg.rb +31 -17
  102. data/lib/puppet/provider/package/openbsd.rb +1 -1
  103. data/lib/puppet/provider/package/pip.rb +34 -9
  104. data/lib/puppet/provider/package/portage.rb +1 -1
  105. data/lib/puppet/provider/package/rpm.rb +5 -5
  106. data/lib/puppet/provider/package/windows/package.rb +1 -1
  107. data/lib/puppet/provider/package/yum.rb +1 -1
  108. data/lib/puppet/provider/parsedfile.rb +1 -1
  109. data/lib/puppet/provider/service/daemontools.rb +9 -9
  110. data/lib/puppet/provider/service/openbsd.rb +1 -1
  111. data/lib/puppet/provider/service/rcng.rb +2 -2
  112. data/lib/puppet/provider/service/runit.rb +2 -8
  113. data/lib/puppet/provider/service/systemd.rb +10 -10
  114. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  115. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  116. data/lib/puppet/provider/user/useradd.rb +22 -13
  117. data/lib/puppet/provider/user/windows_adsi.rb +4 -5
  118. data/lib/puppet/reference/indirection.rb +2 -2
  119. data/lib/puppet/reference/metaparameter.rb +1 -3
  120. data/lib/puppet/reference/providers.rb +1 -1
  121. data/lib/puppet/reference/type.rb +3 -9
  122. data/lib/puppet/reports.rb +1 -1
  123. data/lib/puppet/resource.rb +1 -1
  124. data/lib/puppet/resource/catalog.rb +1 -1
  125. data/lib/puppet/rest/errors.rb +1 -0
  126. data/lib/puppet/rest/response.rb +1 -0
  127. data/lib/puppet/rest/route.rb +1 -0
  128. data/lib/puppet/rest/routes.rb +3 -0
  129. data/lib/puppet/runtime.rb +25 -0
  130. data/lib/puppet/settings.rb +3 -3
  131. data/lib/puppet/settings/environment_conf.rb +1 -0
  132. data/lib/puppet/ssl/host.rb +1 -1
  133. data/lib/puppet/ssl/oids.rb +1 -1
  134. data/lib/puppet/ssl/state_machine.rb +23 -15
  135. data/lib/puppet/test/test_helper.rb +1 -1
  136. data/lib/puppet/transaction/report.rb +1 -1
  137. data/lib/puppet/trusted_external.rb +13 -0
  138. data/lib/puppet/type.rb +1 -3
  139. data/lib/puppet/type/exec.rb +7 -3
  140. data/lib/puppet/type/file.rb +1 -2
  141. data/lib/puppet/type/file/source.rb +2 -2
  142. data/lib/puppet/type/package.rb +10 -3
  143. data/lib/puppet/type/schedule.rb +1 -1
  144. data/lib/puppet/type/service.rb +1 -1
  145. data/lib/puppet/util.rb +2 -2
  146. data/lib/puppet/util/command_line/trollop.rb +1 -1
  147. data/lib/puppet/util/http_proxy.rb +2 -10
  148. data/lib/puppet/util/log.rb +2 -2
  149. data/lib/puppet/util/log/destinations.rb +2 -2
  150. data/lib/puppet/util/logging.rb +2 -2
  151. data/lib/puppet/util/metric.rb +2 -2
  152. data/lib/puppet/util/platform.rb +15 -4
  153. data/lib/puppet/util/provider_features.rb +2 -4
  154. data/lib/puppet/util/rdoc.rb +1 -1
  155. data/lib/puppet/util/reference.rb +1 -1
  156. data/lib/puppet/util/resource_template.rb +1 -1
  157. data/lib/puppet/util/selinux.rb +3 -1
  158. data/lib/puppet/util/windows/registry.rb +7 -5
  159. data/lib/puppet/vendor.rb +1 -1
  160. data/lib/puppet/vendor/require_vendored.rb +0 -1
  161. data/lib/puppet/version.rb +1 -1
  162. data/lib/puppet/x509/cert_provider.rb +4 -1
  163. data/locales/puppet.pot +279 -203
  164. data/man/man5/puppet.conf.5 +30 -8
  165. data/man/man8/puppet-agent.8 +4 -1
  166. data/man/man8/puppet-apply.8 +1 -1
  167. data/man/man8/puppet-catalog.8 +1 -1
  168. data/man/man8/puppet-config.8 +1 -1
  169. data/man/man8/puppet-describe.8 +1 -1
  170. data/man/man8/puppet-device.8 +1 -1
  171. data/man/man8/puppet-doc.8 +1 -1
  172. data/man/man8/puppet-epp.8 +1 -1
  173. data/man/man8/puppet-facts.8 +1 -1
  174. data/man/man8/puppet-filebucket.8 +1 -1
  175. data/man/man8/puppet-generate.8 +1 -1
  176. data/man/man8/puppet-help.8 +1 -1
  177. data/man/man8/puppet-key.8 +1 -1
  178. data/man/man8/puppet-lookup.8 +1 -1
  179. data/man/man8/puppet-man.8 +1 -1
  180. data/man/man8/puppet-module.8 +1 -1
  181. data/man/man8/puppet-node.8 +1 -1
  182. data/man/man8/puppet-parser.8 +1 -1
  183. data/man/man8/puppet-plugin.8 +1 -1
  184. data/man/man8/puppet-report.8 +1 -1
  185. data/man/man8/puppet-resource.8 +1 -1
  186. data/man/man8/puppet-script.8 +1 -1
  187. data/man/man8/puppet-ssl.8 +1 -1
  188. data/man/man8/puppet-status.8 +1 -1
  189. data/man/man8/puppet.8 +2 -2
  190. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  191. data/spec/integration/configurer_spec.rb +52 -0
  192. data/spec/lib/puppet/certificate_factory.rb +2 -2
  193. data/spec/spec_helper.rb +24 -0
  194. data/spec/unit/application/device_spec.rb +6 -0
  195. data/spec/unit/application/ssl_spec.rb +4 -7
  196. data/spec/unit/configurer_spec.rb +1 -0
  197. data/spec/unit/context/trusted_information_spec.rb +41 -2
  198. data/spec/unit/http/client_spec.rb +440 -0
  199. data/spec/unit/http/resolver_spec.rb +45 -0
  200. data/spec/unit/http/service/ca_spec.rb +106 -0
  201. data/spec/unit/http/service_spec.rb +32 -0
  202. data/spec/unit/http/session_spec.rb +102 -0
  203. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  204. data/spec/unit/network/http/connection_spec.rb +119 -145
  205. data/spec/unit/network/http/site_spec.rb +7 -0
  206. data/spec/unit/parser/scope_spec.rb +10 -0
  207. data/spec/unit/pops/loaders/loaders_spec.rb +13 -2
  208. data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
  209. data/spec/unit/provider/exec_spec.rb +209 -0
  210. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  211. data/spec/unit/provider/package/dpkg_spec.rb +238 -78
  212. data/spec/unit/provider/package/pip_spec.rb +51 -6
  213. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  214. data/spec/unit/provider/service/runit_spec.rb +24 -0
  215. data/spec/unit/provider/service/systemd_spec.rb +25 -25
  216. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  217. data/spec/unit/ssl/host_spec.rb +0 -5
  218. data/spec/unit/ssl/state_machine_spec.rb +16 -10
  219. data/spec/unit/type/exec_spec.rb +6 -12
  220. data/spec/unit/type/file_spec.rb +9 -4
  221. data/spec/unit/type/package_spec.rb +5 -0
  222. data/spec/unit/util/execution_spec.rb +16 -0
  223. data/spec/unit/util/http_proxy_spec.rb +79 -27
  224. data/spec/unit/util/log/destinations_spec.rb +7 -3
  225. metadata +45 -22
  226. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  227. data/lib/puppet/vendor/deep_merge/CHANGELOG +0 -45
  228. data/lib/puppet/vendor/deep_merge/Gemfile +0 -3
  229. data/lib/puppet/vendor/deep_merge/LICENSE +0 -21
  230. data/lib/puppet/vendor/deep_merge/PUPPET_README.md +0 -6
  231. data/lib/puppet/vendor/deep_merge/README.md +0 -113
  232. data/lib/puppet/vendor/deep_merge/Rakefile +0 -19
  233. data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +0 -35
  234. data/lib/puppet/vendor/deep_merge/lib/deep_merge.rb +0 -2
  235. data/lib/puppet/vendor/deep_merge/lib/deep_merge/core.rb +0 -210
  236. data/lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb +0 -28
  237. data/lib/puppet/vendor/deep_merge/lib/deep_merge/rails_compat.rb +0 -27
  238. data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +0 -608
  239. data/lib/puppet/vendor/load_deep_merge.rb +0 -1
  240. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
  241. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
  242. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 428bcd2ac83546e3a664b136e4cc2c0009da9ed3d2f3e34106ab34e72059622f
4
- data.tar.gz: 8a65ce1247102bee99541b5aad563819ea627ef9ff980f38c34821175c908d5b
3
+ metadata.gz: c9c78b91c0c5bcc7c31e47239c9dd73a9f64630eed25caf800c36a770dabdc8a
4
+ data.tar.gz: 221e916941b66c0355aa14b1271b96a6f10778189fa7ff93cf718c5f710ae55c
5
5
  SHA512:
6
- metadata.gz: 572d25a4582ec7e5e89e930f6a420fc42938b901d737b9b797adbb9a21196f1286557c4ba55ee067089cf678392a1d7a6e4bdc96a6affa312fde56400dd16f7c
7
- data.tar.gz: 25ab2853f59cad59e23f277ee7a99cddd9336ee70d27be1ebe40c96b94446937fca34e97754a7d5c7f86bcc831b83a0876851b2a930a267793350ec3f0dd608b
6
+ metadata.gz: cde9c9209c8a8e338177d16ecdc412f6737dd7b6f4457e3fcdd43b5d264136872f754e939c6d75002a57244ae0f6f90418dc842deb06f12e59c665396ed92519
7
+ data.tar.gz: 7a27be17e1bab2e6e74767634d5612276e2c86d8352ef05ea7dded32c372d891d6a513a7feddfd63e67333edb1b85988767448862fddb7516384850a893a80d6
data/Gemfile CHANGED
@@ -20,7 +20,7 @@ gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 1.
20
20
 
21
21
  group(:features) do
22
22
  gem 'diff-lcs', '~> 1.3', require: false
23
- gem 'hiera-eyaml', require: false
23
+ gem 'hiera-eyaml', *location_for(ENV['HIERA_EYAML_LOCATION'])
24
24
  gem 'hocon', '~> 1.0', require: false
25
25
  # requires native libshadow headers/libs
26
26
  #gem 'ruby-shadow', '~> 2.5', require: false, platforms: [:ruby]
@@ -39,8 +39,8 @@ group(:test) do
39
39
  gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 12.2')
40
40
  gem "rspec", "~> 3.1", require: false
41
41
  gem "rspec-its", "~> 1.1", require: false
42
- gem 'vcr', '~> 2.9', require: false
43
- gem 'webmock', '~> 1.24', require: false
42
+ gem 'vcr', '~> 5.0', require: false
43
+ gem 'webmock', '~> 3.0', require: false
44
44
  gem 'yard', require: false
45
45
 
46
46
  gem 'rubocop', '~> 0.49', require: false, platforms: [:ruby]
@@ -65,7 +65,7 @@ group(:documentation) do
65
65
  gem 'ronn', '~> 0.7.3', require: false, platforms: [:ruby]
66
66
  end
67
67
 
68
- if File.exists? "#{__FILE__}.local"
68
+ if File.exist? "#{__FILE__}.local"
69
69
  eval(File.read("#{__FILE__}.local"), binding)
70
70
  end
71
71
 
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.10.1)
4
+ puppet (6.11.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  concurrent-ruby (~> 1.0)
7
+ deep_merge (~> 1.0)
7
8
  facter (>= 2.4.0, < 4)
8
9
  fast_gettext (~> 1.1)
9
10
  hiera (>= 3.2.1, < 4)
@@ -24,7 +25,10 @@ GEM
24
25
  concurrent-ruby (1.1.5)
25
26
  crack (0.4.3)
26
27
  safe_yaml (~> 1.0.0)
28
+ csv (3.1.2)
29
+ deep_merge (1.2.1)
27
30
  diff-lcs (1.3)
31
+ docopt (0.6.1)
28
32
  facter (2.5.6)
29
33
  fast_gettext (1.1.2)
30
34
  gettext (3.2.9)
@@ -35,12 +39,12 @@ GEM
35
39
  gettext (>= 3.0.2)
36
40
  locale
37
41
  hashdiff (1.0.0)
38
- hiera (3.5.0)
39
- hiera-eyaml (3.0.0)
42
+ hiera (3.6.0)
43
+ hiera-eyaml (3.1.1)
40
44
  highline (~> 1.6.19)
41
45
  optimist
42
46
  highline (1.6.21)
43
- hocon (1.2.5)
47
+ hocon (1.3.0)
44
48
  hpricot (0.8.6)
45
49
  httpclient (2.8.3)
46
50
  json-schema (2.8.1)
@@ -50,13 +54,14 @@ GEM
50
54
  method_source (0.9.2)
51
55
  minitar (0.9)
52
56
  msgpack (1.3.1)
53
- multi_json (1.14.0)
57
+ multi_json (1.14.1)
54
58
  mustache (1.1.0)
55
59
  optimist (3.0.0)
56
- packaging (0.99.45)
60
+ packaging (0.99.48)
57
61
  artifactory (~> 2)
58
62
  rake (>= 12.3)
59
- parallel (1.18.0)
63
+ release-metrics
64
+ parallel (1.19.0)
60
65
  parser (2.6.5.0)
61
66
  ast (~> 2.4.0)
62
67
  powerpack (0.1.2)
@@ -74,6 +79,9 @@ GEM
74
79
  rake (12.3.3)
75
80
  rdiscount (2.2.0.1)
76
81
  rdoc (6.2.0)
82
+ release-metrics (1.1.0)
83
+ csv
84
+ docopt
77
85
  ronn (0.7.3)
78
86
  hpricot (>= 0.8.2)
79
87
  mustache (>= 0.7.0)
@@ -109,11 +117,11 @@ GEM
109
117
  semantic_puppet (1.0.2)
110
118
  text (1.3.1)
111
119
  unicode-display_width (1.6.0)
112
- vcr (2.9.3)
113
- webmock (1.24.6)
120
+ vcr (5.0.0)
121
+ webmock (3.7.6)
114
122
  addressable (>= 2.3.6)
115
123
  crack (>= 0.3.2)
116
- hashdiff
124
+ hashdiff (>= 0.4.0, < 2.0.0)
117
125
  yard (0.9.20)
118
126
 
119
127
  PLATFORMS
@@ -143,8 +151,8 @@ DEPENDENCIES
143
151
  rubocop-i18n (~> 1.2.0)
144
152
  ruby-prof (>= 0.16.0)
145
153
  semantic_puppet (~> 1.0)
146
- vcr (~> 2.9)
147
- webmock (~> 1.24)
154
+ vcr (~> 5.0)
155
+ webmock (~> 3.0)
148
156
  yard
149
157
 
150
158
  BUNDLED WITH
@@ -26,6 +26,7 @@ gem_runtime_dependencies:
26
26
  httpclient: '~> 2.8'
27
27
  puppet-resource_api: '~>1.5'
28
28
  concurrent-ruby: '~> 1.0'
29
+ deep_merge: '~> 1.0'
29
30
  gem_rdoc_options:
30
31
  - --title
31
32
  - "Puppet - Configuration Management"
@@ -38,7 +39,7 @@ gem_platform_dependencies:
38
39
  CFPropertyList: '~> 2.2'
39
40
  x86-mingw32:
40
41
  gem_runtime_dependencies:
41
- ffi: '~> 1.9.25'
42
+ ffi: ['> 1.9.24', '< 2']
42
43
  # win32-xxxx gems are pinned due to PUP-6445
43
44
  win32-dir: '= 0.4.9'
44
45
  win32-process: '= 0.7.5'
@@ -48,7 +49,7 @@ gem_platform_dependencies:
48
49
  minitar: '~> 0.9'
49
50
  x64-mingw32:
50
51
  gem_runtime_dependencies:
51
- ffi: '~> 1.9.25'
52
+ ffi: ['> 1.9.24', '< 2']
52
53
  # win32-xxxx gems are pinned due to PUP-6445
53
54
  win32-dir: '= 0.4.9'
54
55
  win32-process: '= 0.7.5'
@@ -159,7 +159,7 @@ class ExternalNode
159
159
  log("list of patterns for #{filepath}: #{patternlist}")
160
160
 
161
161
  if matchthis =~ Regexp.union(patternlist)
162
- log("matched #{$~.to_s} in #{matchthis}, returning true")
162
+ log("matched #{$~} in #{matchthis}, returning true")
163
163
  return true
164
164
 
165
165
  else # hostname didn't match anything in patternlist
@@ -181,7 +181,7 @@ class ExternalNode
181
181
  log("Attempting to match [#{@hostname}] in [#{filepath}]")
182
182
  if matched_in_patternfile?(filepath,@hostname)
183
183
  @classes << patternfile.to_s
184
- log("Appended #{patternfile.to_s} to classes instance variable")
184
+ log("Appended #{patternfile} to classes instance variable")
185
185
  end
186
186
  end
187
187
  end
@@ -198,7 +198,7 @@ class ExternalNode
198
198
  log("Attempting to match [#{@hostname}] in [#{filepath}]")
199
199
  if matched_in_patternfile?(filepath,@hostname)
200
200
  @environment = patternfile.to_s
201
- log("Wrote #{patternfile.to_s} to environment instance variable")
201
+ log("Wrote #{patternfile} to environment instance variable")
202
202
  end
203
203
  end
204
204
  end
@@ -230,7 +230,7 @@ class ExternalNode
230
230
  log("Attempting to match [#{@hostname}] in [#{secondlevel}]")
231
231
  if matched_in_patternfile?(secondlevel, @hostname)
232
232
  @parameters[ parametername.to_s ] = patternfile.to_s
233
- log("Set @parameters[#{parametername.to_s}] = #{patternfile.to_s}")
233
+ log("Set @parameters[#{parametername}] = #{patternfile}")
234
234
  end
235
235
  end
236
236
  end
@@ -27,6 +27,9 @@ class WindowsDaemon < Win32::Daemon
27
27
  end
28
28
 
29
29
  def service_main(*argsv)
30
+ base_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
31
+ load_env(base_dir)
32
+
30
33
  argsv = (argsv << ARGV).flatten.compact
31
34
  args = argsv.join(' ')
32
35
  @loglevel = LEVELS.index(argsv.index('--debug') ? :debug : :notice)
@@ -37,7 +40,6 @@ class WindowsDaemon < Win32::Daemon
37
40
  FileUtils.mkdir_p(File.dirname(LOG_FILE))
38
41
  args = args.gsub("--logtofile","")
39
42
  end
40
- basedir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
41
43
 
42
44
  # The puppet installer registers a 'Puppet' event source. For the moment events will be logged with this key, but
43
45
  # it may be a good idea to split the Service and Puppet events later so it's easier to read in the windows Event Log.
@@ -54,25 +56,29 @@ class WindowsDaemon < Win32::Daemon
54
56
  # )
55
57
  # end
56
58
 
57
- puppet = File.join(basedir, 'bin', 'puppet.bat')
58
- unless File.exists?(puppet)
59
+ puppet = File.join(base_dir, 'puppet', 'bin', 'puppet')
60
+ ruby = File.join(base_dir, 'puppet', 'bin', 'ruby.exe')
61
+ ruby_puppet_cmd = "\"#{ruby}\" \"#{puppet}\""
62
+
63
+ unless File.exist?(puppet)
59
64
  log_err("File not found: '#{puppet}'")
60
65
  return
61
66
  end
62
67
  log_debug("Using '#{puppet}'")
63
68
 
64
69
  cmdline_debug = argsv.index('--debug') ? :debug : nil
65
- @loglevel = parse_log_level(puppet, cmdline_debug)
70
+ @loglevel = parse_log_level(ruby_puppet_cmd, cmdline_debug)
66
71
  log_notice('Service started')
67
72
 
68
73
  service = self
69
74
  @run_thread = Thread.new do
70
75
  begin
71
76
  while service.running? do
72
- runinterval = service.parse_runinterval(puppet)
77
+ runinterval = service.parse_runinterval(ruby_puppet_cmd)
78
+
73
79
  if service.state == RUNNING or service.state == IDLE
74
80
  service.log_notice("Executing agent with arguments: #{args}")
75
- pid = Process.create(:command_line => "\"#{puppet}\" agent --onetime #{args}", :creation_flags => CREATE_NEW_CONSOLE).process_id
81
+ pid = Process.create(:command_line => "#{ruby_puppet_cmd} agent --onetime #{args}", :creation_flags => CREATE_NEW_CONSOLE).process_id
76
82
  service.log_debug("Process created: #{pid}")
77
83
  else
78
84
  service.log_debug("Service is paused. Not invoking Puppet agent")
@@ -153,7 +159,7 @@ class WindowsDaemon < Win32::Daemon
153
159
 
154
160
  def parse_runinterval(puppet_path)
155
161
  begin
156
- runinterval = %x{ "#{puppet_path}" agent --configprint runinterval }.to_i
162
+ runinterval = %x{ #{puppet_path} agent --configprint runinterval }.to_i
157
163
  if runinterval == 0
158
164
  runinterval = 1800
159
165
  log_err("Failed to determine runinterval, defaulting to #{runinterval} seconds")
@@ -168,7 +174,7 @@ class WindowsDaemon < Win32::Daemon
168
174
 
169
175
  def parse_log_level(puppet_path,cmdline_debug)
170
176
  begin
171
- loglevel = %x{ "#{puppet_path}" agent --configprint log_level}.chomp
177
+ loglevel = %x{ #{puppet_path} agent --configprint log_level}.chomp
172
178
  unless loglevel
173
179
  loglevel = :notice
174
180
  log_err("Failed to determine loglevel, defaulting to #{loglevel}")
@@ -180,6 +186,25 @@ class WindowsDaemon < Win32::Daemon
180
186
 
181
187
  LEVELS.index(cmdline_debug ? cmdline_debug : loglevel.to_sym)
182
188
  end
189
+
190
+ private
191
+
192
+ def load_env(base_dir)
193
+ # ENV that uses backward slashes
194
+ ENV['FACTER_env_windows_installdir'] = base_dir.tr('/', '\\')
195
+ ENV['PL_BASEDIR'] = base_dir.tr('/', '\\')
196
+ ENV['PUPPET_DIR'] = File.join(base_dir, 'puppet').tr('/', '\\')
197
+ ENV['OPENSSL_CONF'] = File.join(base_dir, 'puppet', 'ssl', 'openssl.cnf').tr('/', '\\')
198
+ ENV['SSL_CERT_DIR'] = File.join(base_dir, 'puppet', 'ssl', 'certs').tr('/', '\\')
199
+ ENV['SSL_CERT_FILE'] = File.join(base_dir, 'puppet', 'ssl', 'cert.pem').tr('/', '\\')
200
+ ENV['Path'] = [
201
+ File.join(base_dir, 'puppet', 'bin'),
202
+ File.join(base_dir, 'bin'),
203
+ ].join(';').tr('/', '\\') + ';' + ENV['Path']
204
+
205
+ # ENV that uses forward slashes
206
+ ENV['RUBYLIB'] = "#{File.join(base_dir, 'puppet','lib')};#{ENV['RUBYLIB']}"
207
+ end
183
208
  end
184
209
 
185
210
  if __FILE__ == $0
data/install.rb CHANGED
@@ -122,12 +122,12 @@ def check_prereqs
122
122
  facter_version = Facter.version.to_f
123
123
  if facter_version < MIN_FACTER_VERSION
124
124
  puts "Facter version: #{facter_version}; minimum required: #{MIN_FACTER_VERSION}; cannot install"
125
- exit (-1)
125
+ exit(-1)
126
126
  end
127
127
  end
128
128
  rescue LoadError
129
129
  puts "Could not load #{pre}; cannot install"
130
- exit (-1)
130
+ exit(-1)
131
131
  end
132
132
  }
133
133
  end
@@ -248,7 +248,7 @@ def prepare_installation
248
248
  require 'win32/dir'
249
249
  rescue LoadError => e
250
250
  puts "Cannot run on Microsoft Windows without the win32-process, win32-dir & win32-service gems: #{e}"
251
- exit (-1)
251
+ exit(-1)
252
252
  end
253
253
  end
254
254
 
@@ -437,13 +437,13 @@ def install_binfile(from, op_file, target)
437
437
  if $operatingsystem == "windows" && InstallOptions.batch_files
438
438
  installed_wrapper = false
439
439
 
440
- unless File.extname(from).match(/\.(cmd|bat)/)
441
- if File.exists?("#{from}.bat")
440
+ unless File.extname(from) =~ /\.(cmd|bat)/
441
+ if File.exist?("#{from}.bat")
442
442
  FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
443
443
  installed_wrapper = true
444
444
  end
445
445
 
446
- if File.exists?("#{from}.cmd")
446
+ if File.exist?("#{from}.cmd")
447
447
  FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true)
448
448
  installed_wrapper = true
449
449
  end
@@ -296,10 +296,18 @@ module Puppet
296
296
  @context.rollback(name)
297
297
  end
298
298
 
299
+ def self.runtime
300
+ @runtime
301
+ end
302
+
299
303
  require 'puppet/node'
300
304
 
301
305
  # The single instance used for normal operation
302
306
  @context = Puppet::Context.new(bootstrap_context)
307
+
308
+ require 'puppet/runtime'
309
+ @runtime = Puppet::Runtime.instance
310
+ @runtime['http'] = proc { Puppet::HTTP::Client.new }
303
311
  end
304
312
 
305
313
  # This feels weird to me; I would really like for us to get to a state where there is never a "require" statement
@@ -183,7 +183,7 @@ class Application
183
183
 
184
184
  # used to declare code that handle an option
185
185
  def option(*options, &block)
186
- long = options.find { |opt| opt =~ /^--/ }.gsub(/^--(?:\[no-\])?([^ =]+).*$/, '\1' ).gsub('-','_')
186
+ long = options.find { |opt| opt =~ /^--/ }.gsub(/^--(?:\[no-\])?([^ =]+).*$/, '\1' ).tr('-','_')
187
187
  fname = "handle_#{long}".intern
188
188
  if (block_given?)
189
189
  define_method(fname, &block)
@@ -160,6 +160,9 @@ the master, the certificate request the master received is the same as
160
160
  the one the client sent (to prevent against man-in-the-middle attacks
161
161
  when signing certificates).
162
162
 
163
+ '--skip_tags' is a flag used to filter resources. If this is set, then
164
+ only resources not tagged with the specified tags will be applied.
165
+ Values must be comma-separated.
163
166
 
164
167
  OPTIONS
165
168
  -------
@@ -230,8 +230,8 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
230
230
  catalog =
231
231
  begin
232
232
  Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
233
- rescue Puppet::ParseErrorWithIssue, Puppet::Error
234
- # already logged and handled by the compiler for these two cases
233
+ rescue Puppet::Error
234
+ # already logged and handled by the compiler, including Puppet::ParseErrorWithIssue
235
235
  exit(1)
236
236
  end
237
237
 
@@ -64,9 +64,7 @@ class TypeDoc
64
64
 
65
65
  def list_types
66
66
  puts "These are the types known to puppet:\n"
67
- @types.keys.sort { |a, b|
68
- a.to_s <=> b.to_s
69
- }.each do |name|
67
+ @types.keys.sort_by(&:to_s).each do |name|
70
68
  type = @types[name]
71
69
  s = type.doc.gsub(/\s+/, " ")
72
70
  n = s.index(". ")
@@ -149,18 +147,14 @@ class TypeDoc
149
147
  end
150
148
 
151
149
  def format_providers(type)
152
- type.providers.sort { |a,b|
153
- a.to_s <=> b.to_s
154
- }.each { |prov|
150
+ type.providers.sort_by(&:to_s).each { |prov|
155
151
  puts "\n- **#{prov}**"
156
152
  puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true)
157
153
  }
158
154
  end
159
155
 
160
156
  def list_providers(type)
161
- list = type.providers.sort { |a,b|
162
- a.to_s <=> b.to_s
163
- }.join(", ")
157
+ list = type.providers.sort_by(&:to_s).join(", ")
164
158
  puts @format.wrap(list, :indent => 4)
165
159
  end
166
160
 
@@ -1,6 +1,7 @@
1
1
  require 'puppet/application'
2
2
  require 'puppet/configurer'
3
3
  require 'puppet/util/network_device'
4
+ require 'puppet/ssl/oids'
4
5
 
5
6
  class Puppet::Application::Device < Puppet::Application
6
7
 
@@ -414,6 +415,8 @@ Licensed under the Apache 2.0 License
414
415
  def setup
415
416
  setup_logs
416
417
 
418
+ Puppet::SSL::Oids.register_puppet_oids
419
+
417
420
  # setup global device-specific defaults; creates all necessary directories, etc
418
421
  Puppet.settings.use :main, :agent, :device, :ssl
419
422
 
@@ -155,7 +155,7 @@ HELP
155
155
  with_contents = options[:references].length <= 1
156
156
  exit_code = 0
157
157
  require 'puppet/util/reference'
158
- options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
158
+ options[:references].sort_by(&:to_s).each do |name|
159
159
  section = Puppet::Util::Reference.reference(name)
160
160
  raise _("Could not find reference %{name}") % { name: name } unless section
161
161
 
@@ -283,7 +283,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
283
283
  'merge_hash_arrays' => !options[:merge_hash_arrays].nil?}
284
284
 
285
285
  if options[:prefix]
286
- merge_options.merge!({'knockout_prefix' => options[:prefix]})
286
+ merge_options['knockout_prefix'] = options[:prefix]
287
287
  end
288
288
 
289
289
  else