puppet 7.1.0-universal-darwin → 7.6.1-universal-darwin

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 (198) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +38 -30
  3. data/ext/build_defaults.yaml +0 -1
  4. data/lib/puppet/application.rb +10 -6
  5. data/lib/puppet/application/agent.rb +1 -0
  6. data/lib/puppet/application/apply.rb +3 -2
  7. data/lib/puppet/application/device.rb +1 -0
  8. data/lib/puppet/application/script.rb +1 -0
  9. data/lib/puppet/application/ssl.rb +11 -0
  10. data/lib/puppet/configurer.rb +16 -3
  11. data/lib/puppet/defaults.rb +14 -19
  12. data/lib/puppet/environments.rb +16 -1
  13. data/lib/puppet/face/facts.rb +26 -2
  14. data/lib/puppet/ffi/windows/api_types.rb +1 -1
  15. data/lib/puppet/ffi/windows/constants.rb +1 -1
  16. data/lib/puppet/file_serving/configuration/parser.rb +5 -2
  17. data/lib/puppet/file_system/memory_file.rb +8 -1
  18. data/lib/puppet/file_system/windows.rb +2 -0
  19. data/lib/puppet/functions.rb +1 -1
  20. data/lib/puppet/functions/partition.rb +8 -0
  21. data/lib/puppet/http/factory.rb +4 -0
  22. data/lib/puppet/indirector/facts/facter.rb +1 -0
  23. data/lib/puppet/loaders.rb +0 -4
  24. data/lib/puppet/module.rb +1 -0
  25. data/lib/puppet/module_tool/applications/installer.rb +48 -2
  26. data/lib/puppet/module_tool/errors/shared.rb +17 -2
  27. data/lib/puppet/network/formats.rb +67 -0
  28. data/lib/puppet/network/http.rb +5 -2
  29. data/lib/puppet/network/http/api.rb +10 -6
  30. data/lib/puppet/network/http/api/master.rb +3 -2
  31. data/lib/puppet/network/http/api/master/v3.rb +2 -25
  32. data/lib/puppet/network/http/api/master/v3/environments.rb +2 -33
  33. data/lib/puppet/network/http/api/server.rb +10 -0
  34. data/lib/puppet/network/http/api/server/v3.rb +39 -0
  35. data/lib/puppet/network/http/api/server/v3/environments.rb +48 -0
  36. data/lib/puppet/node/environment.rb +12 -5
  37. data/lib/puppet/parser/ast/leaf.rb +3 -2
  38. data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
  39. data/lib/puppet/pops/loader/base_loader.rb +42 -32
  40. data/lib/puppet/pops/loader/dependency_loader.rb +2 -2
  41. data/lib/puppet/pops/loader/loader.rb +15 -5
  42. data/lib/puppet/pops/loader/module_loaders.rb +8 -8
  43. data/lib/puppet/pops/loader/predefined_loader.rb +4 -0
  44. data/lib/puppet/pops/loader/runtime3_type_loader.rb +1 -1
  45. data/lib/puppet/pops/loader/static_loader.rb +4 -0
  46. data/lib/puppet/pops/loaders.rb +4 -4
  47. data/lib/puppet/pops/model/ast_transformer.rb +1 -1
  48. data/lib/puppet/pops/parser/lexer2.rb +0 -4
  49. data/lib/puppet/pops/types/p_type_set_type.rb +1 -1
  50. data/lib/puppet/pops/validation/checker4_0.rb +0 -1
  51. data/lib/puppet/property/list.rb +1 -1
  52. data/lib/puppet/provider/group/groupadd.rb +13 -8
  53. data/lib/puppet/provider/package/apt.rb +34 -2
  54. data/lib/puppet/provider/package/aptitude.rb +6 -0
  55. data/lib/puppet/provider/package/dnfmodule.rb +1 -1
  56. data/lib/puppet/provider/package/puppet_gem.rb +12 -1
  57. data/lib/puppet/provider/service/debian.rb +2 -0
  58. data/lib/puppet/provider/service/systemd.rb +1 -1
  59. data/lib/puppet/provider/user/useradd.rb +62 -8
  60. data/lib/puppet/reference/configuration.rb +6 -5
  61. data/lib/puppet/settings.rb +36 -30
  62. data/lib/puppet/settings/alias_setting.rb +37 -0
  63. data/lib/puppet/settings/environment_conf.rb +1 -0
  64. data/lib/puppet/type/package.rb +3 -3
  65. data/lib/puppet/util/autoload.rb +1 -8
  66. data/lib/puppet/util/monkey_patches.rb +7 -0
  67. data/lib/puppet/util/posix.rb +1 -1
  68. data/lib/puppet/util/windows/adsi.rb +46 -0
  69. data/lib/puppet/util/windows/principal.rb +9 -2
  70. data/lib/puppet/util/windows/sid.rb +4 -2
  71. data/lib/puppet/version.rb +1 -1
  72. data/locales/puppet.pot +166 -146
  73. data/man/man5/puppet.conf.5 +14 -6
  74. data/man/man8/puppet-agent.8 +2 -2
  75. data/man/man8/puppet-apply.8 +2 -2
  76. data/man/man8/puppet-catalog.8 +1 -1
  77. data/man/man8/puppet-config.8 +1 -1
  78. data/man/man8/puppet-describe.8 +1 -1
  79. data/man/man8/puppet-device.8 +2 -2
  80. data/man/man8/puppet-doc.8 +1 -1
  81. data/man/man8/puppet-epp.8 +1 -1
  82. data/man/man8/puppet-facts.8 +8 -2
  83. data/man/man8/puppet-filebucket.8 +1 -1
  84. data/man/man8/puppet-generate.8 +1 -1
  85. data/man/man8/puppet-help.8 +1 -1
  86. data/man/man8/puppet-lookup.8 +1 -1
  87. data/man/man8/puppet-module.8 +1 -1
  88. data/man/man8/puppet-node.8 +1 -1
  89. data/man/man8/puppet-parser.8 +1 -1
  90. data/man/man8/puppet-plugin.8 +1 -1
  91. data/man/man8/puppet-report.8 +1 -1
  92. data/man/man8/puppet-resource.8 +1 -1
  93. data/man/man8/puppet-script.8 +2 -2
  94. data/man/man8/puppet-ssl.8 +5 -1
  95. data/man/man8/puppet.8 +2 -2
  96. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
  97. data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services_vendor_preset +9 -0
  98. data/spec/integration/application/agent_spec.rb +160 -3
  99. data/spec/integration/application/apply_spec.rb +19 -0
  100. data/spec/integration/application/plugin_spec.rb +1 -1
  101. data/spec/integration/defaults_spec.rb +0 -7
  102. data/spec/integration/http/client_spec.rb +12 -0
  103. data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
  104. data/spec/integration/indirector/file_content/file_server_spec.rb +0 -2
  105. data/spec/integration/indirector/file_metadata/file_server_spec.rb +0 -2
  106. data/spec/integration/parser/collection_spec.rb +10 -0
  107. data/spec/integration/resource/type_collection_spec.rb +2 -6
  108. data/spec/integration/transaction_spec.rb +4 -9
  109. data/spec/integration/util/windows/adsi_spec.rb +21 -1
  110. data/spec/integration/util/windows/principal_spec.rb +21 -0
  111. data/spec/integration/util/windows/registry_spec.rb +6 -10
  112. data/spec/spec_helper.rb +12 -5
  113. data/spec/unit/agent_spec.rb +8 -6
  114. data/spec/unit/application/agent_spec.rb +0 -1
  115. data/spec/unit/application/facts_spec.rb +58 -7
  116. data/spec/unit/application/filebucket_spec.rb +0 -2
  117. data/spec/unit/application/ssl_spec.rb +23 -0
  118. data/spec/unit/application_spec.rb +17 -9
  119. data/spec/unit/confine/feature_spec.rb +1 -1
  120. data/spec/unit/confine_spec.rb +8 -2
  121. data/spec/unit/environments_spec.rb +164 -88
  122. data/spec/unit/face/node_spec.rb +0 -11
  123. data/spec/unit/file_serving/configuration/parser_spec.rb +8 -1
  124. data/spec/unit/file_serving/metadata_spec.rb +3 -3
  125. data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
  126. data/spec/unit/file_system_spec.rb +9 -0
  127. data/spec/unit/forge/module_release_spec.rb +2 -7
  128. data/spec/unit/http/factory_spec.rb +19 -0
  129. data/spec/unit/indirector/face_spec.rb +0 -1
  130. data/spec/unit/indirector/facts/facter_spec.rb +20 -5
  131. data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
  132. data/spec/unit/indirector/indirection_spec.rb +8 -12
  133. data/spec/unit/indirector_spec.rb +2 -2
  134. data/spec/unit/module_spec.rb +1 -1
  135. data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
  136. data/spec/unit/network/formats_spec.rb +41 -0
  137. data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -4
  138. data/spec/unit/network/http/api/master_spec.rb +38 -0
  139. data/spec/unit/network/http/api/{master → server}/v3/environments_spec.rb +2 -2
  140. data/spec/unit/network/http/api/{master → server}/v3_spec.rb +19 -19
  141. data/spec/unit/network/http/api_spec.rb +11 -11
  142. data/spec/unit/parser/compiler_spec.rb +3 -19
  143. data/spec/unit/parser/resource_spec.rb +14 -8
  144. data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
  145. data/spec/unit/pops/loaders/dependency_loader_spec.rb +1 -1
  146. data/spec/unit/pops/parser/lexer2_spec.rb +0 -4
  147. data/spec/unit/pops/types/type_parser_spec.rb +2 -1
  148. data/spec/unit/pops/validator/validator_spec.rb +20 -43
  149. data/spec/unit/property_spec.rb +1 -0
  150. data/spec/unit/provider/group/groupadd_spec.rb +5 -2
  151. data/spec/unit/provider/nameservice_spec.rb +66 -65
  152. data/spec/unit/provider/package/apt_spec.rb +28 -23
  153. data/spec/unit/provider/package/aptitude_spec.rb +1 -1
  154. data/spec/unit/provider/package/base_spec.rb +6 -5
  155. data/spec/unit/provider/package/dnfmodule_spec.rb +10 -1
  156. data/spec/unit/provider/package/pacman_spec.rb +18 -12
  157. data/spec/unit/provider/package/pip_spec.rb +6 -11
  158. data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
  159. data/spec/unit/provider/package/puppet_gem_spec.rb +28 -0
  160. data/spec/unit/provider/service/systemd_spec.rb +11 -0
  161. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  162. data/spec/unit/provider/user/useradd_spec.rb +70 -3
  163. data/spec/unit/provider_spec.rb +6 -8
  164. data/spec/unit/resource/type_spec.rb +1 -1
  165. data/spec/unit/resource_spec.rb +11 -10
  166. data/spec/unit/settings_spec.rb +13 -6
  167. data/spec/unit/ssl/base_spec.rb +0 -1
  168. data/spec/unit/ssl/certificate_request_spec.rb +4 -10
  169. data/spec/unit/ssl/ssl_provider_spec.rb +5 -2
  170. data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
  171. data/spec/unit/transaction/event_manager_spec.rb +14 -11
  172. data/spec/unit/transaction_spec.rb +13 -4
  173. data/spec/unit/type/file/content_spec.rb +0 -1
  174. data/spec/unit/type/file/selinux_spec.rb +0 -2
  175. data/spec/unit/type/file_spec.rb +0 -6
  176. data/spec/unit/type/group_spec.rb +13 -6
  177. data/spec/unit/type/resources_spec.rb +7 -7
  178. data/spec/unit/type/service_spec.rb +1 -1
  179. data/spec/unit/type/tidy_spec.rb +0 -1
  180. data/spec/unit/type_spec.rb +2 -2
  181. data/spec/unit/util/at_fork_spec.rb +2 -2
  182. data/spec/unit/util/autoload_spec.rb +5 -1
  183. data/spec/unit/util/backups_spec.rb +1 -2
  184. data/spec/unit/util/execution_spec.rb +15 -11
  185. data/spec/unit/util/inifile_spec.rb +6 -14
  186. data/spec/unit/util/log_spec.rb +8 -7
  187. data/spec/unit/util/logging_spec.rb +3 -3
  188. data/spec/unit/util/posix_spec.rb +16 -10
  189. data/spec/unit/util/selinux_spec.rb +76 -52
  190. data/spec/unit/util/suidmanager_spec.rb +44 -41
  191. data/spec/unit/util/windows/sid_spec.rb +6 -0
  192. data/spec/unit/util_spec.rb +13 -6
  193. metadata +18 -16
  194. data/spec/lib/matchers/include.rb +0 -27
  195. data/spec/lib/matchers/include_spec.rb +0 -32
  196. data/spec/unit/pops/parser/parse_application_spec.rb +0 -13
  197. data/spec/unit/pops/parser/parse_capabilities_spec.rb +0 -23
  198. data/spec/unit/pops/parser/parse_site_spec.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8afb272223e687ce56ec91331e526bbd4cf2980ea54f4998cdc72e118bd29b1a
4
- data.tar.gz: 6b511af44bd6a19076c9ac4438a4c10258c9dd29b58210cc91e0d9a47325c910
3
+ metadata.gz: 514f3fadfa66166b9c775d7eb3174de00962b47f564f6f2d7b711690a8eb7722
4
+ data.tar.gz: 337becc1fc42d4c24ae1d66bf9bb1370ec0cd5298dffd2a111a9dc4514199a1b
5
5
  SHA512:
6
- metadata.gz: 9181d3f3f642b2d631333f472476a67b2571a52d40d148a770c0312bd9b7fc5ce116974601330ec8c0336b4c1b3b7a5cc5dc7d87eedfb177a71bdccc1c7024a0
7
- data.tar.gz: ed1b0651709dd93f39a4abae6ca30d1ff8444fbcb781bd07ebd197c700d5259899b11d8fe4caaa0b8e29a1a7cc8a1c2c957aa80cfc9d8965989c2560781f30ee
6
+ metadata.gz: 852dc4711c6bf66dad7fddcf0970aae89481b0c023bfa51873b96052a09c585e923633c0f50a25690fcdfbe5c88cef2f4b2c81aa8229923ba160a53e428fd0e1
7
+ data.tar.gz: 1b602d1e7c5fa4f5e29d64bd929b8111bc897db4d2358a9fecd4b836018c3f3188efe1174c0f239c8de305d0d348c61c6fd6652e6a29fedacd214245d68fcaf8
data/Gemfile.lock CHANGED
@@ -1,7 +1,18 @@
1
+ GIT
2
+ remote: git://github.com/ciprianbadescu/packaging
3
+ revision: 5f8d2bda941abfeeb8fb1731c9b1dd4d108f5d33
4
+ branch: maint/windows-signing
5
+ specs:
6
+ packaging (0.99.49.171.g5f8d2bd)
7
+ artifactory (~> 2)
8
+ csv (= 3.1.5)
9
+ rake (>= 12.3)
10
+ release-metrics
11
+
1
12
  PATH
2
13
  remote: .
3
14
  specs:
4
- puppet (7.1.0)
15
+ puppet (7.6.1)
5
16
  CFPropertyList (~> 2.2)
6
17
  concurrent-ruby (~> 1.0)
7
18
  deep_merge (~> 1.0)
@@ -20,19 +31,20 @@ GEM
20
31
  addressable (2.7.0)
21
32
  public_suffix (>= 2.0.2, < 5.0)
22
33
  artifactory (2.8.2)
23
- ast (2.4.1)
34
+ ast (2.4.2)
24
35
  coderay (1.1.3)
25
- concurrent-ruby (1.1.7)
26
- crack (0.4.4)
36
+ concurrent-ruby (1.1.8)
37
+ crack (0.4.5)
38
+ rexml
27
39
  csv (3.1.5)
28
40
  deep_merge (1.2.1)
29
41
  diff-lcs (1.4.4)
30
42
  docopt (0.6.1)
31
- facter (4.0.46)
43
+ facter (4.1.1)
32
44
  hocon (~> 1.3)
33
45
  thor (>= 1.0.1, < 2.0)
34
46
  fast_gettext (1.1.2)
35
- ffi (1.13.1)
47
+ ffi (1.15.0)
36
48
  gettext (3.2.9)
37
49
  locale (>= 2.0.5)
38
50
  text (>= 1.3.0)
@@ -41,11 +53,11 @@ GEM
41
53
  gettext (>= 3.0.2, < 3.3.0)
42
54
  locale
43
55
  hashdiff (1.0.1)
44
- hiera (3.6.0)
45
- hiera-eyaml (3.2.0)
46
- highline (~> 1.6.19)
56
+ hiera (3.7.0)
57
+ hiera-eyaml (3.2.1)
58
+ highline
47
59
  optimist
48
- highline (1.6.21)
60
+ highline (2.0.3)
49
61
  hocon (1.3.1)
50
62
  hpricot (0.8.6)
51
63
  json-schema (2.8.1)
@@ -54,36 +66,32 @@ GEM
54
66
  memory_profiler (1.0.0)
55
67
  method_source (1.0.0)
56
68
  minitar (0.9)
57
- msgpack (1.3.3)
69
+ msgpack (1.4.2)
58
70
  multi_json (1.15.0)
59
71
  mustache (1.1.1)
60
72
  optimist (3.0.1)
61
- packaging (0.99.75)
62
- artifactory (~> 2)
63
- csv (= 3.1.5)
64
- rake (>= 12.3)
65
- release-metrics
66
73
  parallel (1.20.1)
67
74
  parser (2.7.2.0)
68
75
  ast (~> 2.4.1)
69
76
  powerpack (0.1.3)
70
- pry (0.13.1)
77
+ pry (0.14.1)
71
78
  coderay (~> 1.1)
72
79
  method_source (~> 1.0)
73
80
  public_suffix (4.0.6)
74
81
  puppet-resource_api (1.8.13)
75
82
  hocon (>= 1.0)
76
- puppetserver-ca (2.0.1)
83
+ puppetserver-ca (2.1.0)
77
84
  facter (>= 2.0.1, < 5)
78
85
  racc (1.4.9)
79
86
  rainbow (2.2.2)
80
87
  rake
81
88
  rake (12.3.3)
82
89
  rdiscount (2.2.0.2)
83
- rdoc (6.2.1)
90
+ rdoc (6.3.0)
84
91
  release-metrics (1.1.0)
85
92
  csv
86
93
  docopt
94
+ rexml (3.2.5)
87
95
  ronn (0.7.3)
88
96
  hpricot (>= 0.8.2)
89
97
  mustache (>= 0.7.0)
@@ -92,18 +100,18 @@ GEM
92
100
  rspec-core (~> 3.10.0)
93
101
  rspec-expectations (~> 3.10.0)
94
102
  rspec-mocks (~> 3.10.0)
95
- rspec-core (3.10.0)
103
+ rspec-core (3.10.1)
96
104
  rspec-support (~> 3.10.0)
97
- rspec-expectations (3.10.0)
105
+ rspec-expectations (3.10.1)
98
106
  diff-lcs (>= 1.2.0, < 2.0)
99
107
  rspec-support (~> 3.10.0)
100
108
  rspec-its (1.3.0)
101
109
  rspec-core (>= 3.0.0)
102
110
  rspec-expectations (>= 3.0.0)
103
- rspec-mocks (3.10.0)
111
+ rspec-mocks (3.10.2)
104
112
  diff-lcs (>= 1.2.0, < 2.0)
105
113
  rspec-support (~> 3.10.0)
106
- rspec-support (3.10.0)
114
+ rspec-support (3.10.2)
107
115
  rubocop (0.49.1)
108
116
  parallel (~> 1.10)
109
117
  parser (>= 2.3.3.1, < 3.0)
@@ -113,19 +121,19 @@ GEM
113
121
  unicode-display_width (~> 1.0, >= 1.0.1)
114
122
  rubocop-i18n (1.2.0)
115
123
  rubocop (~> 0.49.0)
116
- ruby-prof (1.4.2)
117
- ruby-progressbar (1.10.1)
124
+ ruby-prof (1.4.3)
125
+ ruby-progressbar (1.11.0)
118
126
  scanf (1.0.0)
119
- semantic_puppet (1.0.2)
127
+ semantic_puppet (1.0.3)
120
128
  text (1.3.1)
121
- thor (1.0.1)
129
+ thor (1.1.0)
122
130
  unicode-display_width (1.7.0)
123
131
  vcr (5.1.0)
124
- webmock (3.10.0)
132
+ webmock (3.12.2)
125
133
  addressable (>= 2.3.6)
126
134
  crack (>= 0.3.2)
127
135
  hashdiff (>= 0.4.0, < 2.0.0)
128
- yard (0.9.25)
136
+ yard (0.9.26)
129
137
 
130
138
  PLATFORMS
131
139
  ruby
@@ -140,7 +148,7 @@ DEPENDENCIES
140
148
  memory_profiler
141
149
  minitar (~> 0.9)
142
150
  msgpack (~> 1.2)
143
- packaging (~> 0.99)
151
+ packaging!
144
152
  pry
145
153
  puppet!
146
154
  puppet-resource_api (~> 1.5)
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  packager: 'puppetlabs'
3
- gpg_key: '7F438280EF8D349F'
4
3
 
5
4
  # These are the build targets used by the packaging repo. Uncomment to allow use.
6
5
  #final_mocks: 'pl-el-5-i386 pl-el-6-i386 pl-el-7-x86_64'
@@ -475,12 +475,16 @@ class Application
475
475
  def handle_logdest_arg(arg)
476
476
  return if arg.nil?
477
477
 
478
- begin
479
- Puppet[:logdest] = arg
480
- Puppet::Util::Log.newdestination(arg)
481
- options[:setdest] = true
482
- rescue => detail
483
- Puppet.log_and_raise(detail, _("Could not set logdest to %{dest}.") % { dest: arg })
478
+ logdest = arg.split(',').map!(&:strip)
479
+ Puppet[:logdest] = arg
480
+
481
+ logdest.each do |dest|
482
+ begin
483
+ Puppet::Util::Log.newdestination(dest)
484
+ options[:setdest] = true
485
+ rescue => detail
486
+ Puppet.log_and_raise(detail, _("Could not set logdest to %{dest}.") % { dest: arg })
487
+ end
484
488
  end
485
489
  end
486
490
 
@@ -267,6 +267,7 @@ generated by running puppet agent with '--genconfig'.
267
267
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
268
268
  file. If debugging or verbosity is enabled, this defaults to 'console'.
269
269
  Otherwise, it defaults to 'syslog' on POSIX systems and 'eventlog' on Windows.
270
+ Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
270
271
 
271
272
  A path ending with '.json' will receive structured output in JSON format. The
272
273
  log file will not have an ending ']' automatically written to it due to the
@@ -113,6 +113,7 @@ configuration options by running puppet with
113
113
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
114
114
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
115
115
  file. Defaults to 'console'.
116
+ Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
116
117
 
117
118
  A path ending with '.json' will receive structured output in JSON format. The
118
119
  log file will not have an ending ']' automatically written to it due to the
@@ -236,7 +237,7 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
236
237
  end
237
238
 
238
239
  # Resolve all deferred values and replace them / mutate the catalog
239
- Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog)
240
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog, apply_environment)
240
241
 
241
242
  # Translate it to a RAL catalog
242
243
  catalog = catalog.to_ral
@@ -330,7 +331,7 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
330
331
  raise Puppet::Error, _("Could not deserialize catalog from %{format}: %{detail}") % { format: format, detail: detail }, detail.backtrace
331
332
  end
332
333
  # Resolve all deferred values and replace them / mutate the catalog
333
- Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog)
334
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(node.facts, catalog, configured_environment)
334
335
 
335
336
  catalog.to_ral
336
337
  end
@@ -155,6 +155,7 @@ you can specify '--server <servername>' as an argument.
155
155
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
156
156
  service), 'console', or the path to a log file. If debugging or verbosity is
157
157
  enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
158
+ Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
158
159
 
159
160
  A path ending with '.json' will receive structured output in JSON format. The
160
161
  log file will not have an ending ']' automatically written to it due to the
@@ -71,6 +71,7 @@ configuration options can also be generated by running puppet with
71
71
  Where to send log messages. Choose between 'syslog' (the POSIX syslog
72
72
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
73
73
  file. Defaults to 'console'.
74
+ Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
74
75
 
75
76
  A path ending with '.json' will receive structured output in JSON format. The
76
77
  log file will not have an ending ']' automatically written to it due to the
@@ -74,6 +74,9 @@ ACTIONS
74
74
  `--localca` is specified, then also remove this host's local copy of the
75
75
  CA certificate(s) and CRL bundle. if `--target CERTNAME` is specified, then
76
76
  remove the files for the specified device on this host instead of this host.
77
+
78
+ * show:
79
+ Print the full-text version of this host's certificate.
77
80
  HELP
78
81
  end
79
82
 
@@ -142,11 +145,19 @@ HELP
142
145
  end
143
146
  @machine.ensure_client_certificate
144
147
  Puppet.notice(_("Completed SSL initialization"))
148
+ when 'show'
149
+ show(certname)
145
150
  else
146
151
  raise Puppet::Error, _("Unknown action '%{action}'") % { action: action }
147
152
  end
148
153
  end
149
154
 
155
+ def show(certname)
156
+ password = @cert_provider.load_private_key_password
157
+ ssl_context = @ssl_provider.load_context(certname: certname, password: password)
158
+ puts ssl_context.client_cert.to_text
159
+ end
160
+
150
161
  def submit_request(ssl_context)
151
162
  key = @cert_provider.load_private_key(Puppet[:certname])
152
163
  unless key
@@ -112,7 +112,7 @@ class Puppet::Configurer
112
112
  catalog_conversion_time = thinmark do
113
113
  # Will mutate the result and replace all Deferred values with resolved values
114
114
  if facts
115
- Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(facts, result)
115
+ Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(facts, result, Puppet.lookup(:current_environment))
116
116
  end
117
117
 
118
118
  catalog = result.to_ral
@@ -395,16 +395,29 @@ class Puppet::Configurer
395
395
  if !cached_catalog && options[:catalog]
396
396
  ral_catalog = options[:catalog]
397
397
  else
398
+ # Ordering here matters. We have to resolve deferred resources in the
399
+ # resource catalog, convert the resource catalog to a RAL catalog (which
400
+ # triggers type/provider validation), and only if that is successful,
401
+ # should we cache the *original* resource catalog. However, deferred
402
+ # evaluation mutates the resource catalog, so we need to make a copy of
403
+ # it here. If PUP-9323 is ever implemented so that we resolve deferred
404
+ # resources in the RAL catalog as they are needed, then we could eliminate
405
+ # this step.
406
+ catalog_to_cache = Puppet.override(:rich_data => Puppet[:rich_data]) do
407
+ Puppet::Resource::Catalog.from_data_hash(catalog.to_data_hash)
408
+ end
409
+
398
410
  # REMIND @duration is the time spent loading the last catalog, and doesn't
399
411
  # account for things like we failed to download and fell back to the cache
400
412
  ral_catalog = convert_catalog(catalog, @duration, facts, options)
401
413
 
402
- # If not noop, commit the cached resource catalog (not ral catalog). Ideally
414
+ # Validation succeeded, so commit the `catalog_to_cache` for non-noop runs. Don't
415
+ # commit `catalog` since it contains the result of deferred evaluation. Ideally
403
416
  # we'd just copy the downloaded response body, instead of serializing the
404
417
  # in-memory catalog, but that's hard due to the indirector.
405
418
  indirection = Puppet::Resource::Catalog.indirection
406
419
  if !Puppet[:noop] && indirection.cache?
407
- request = indirection.request(:save, nil, catalog, environment: Puppet::Node::Environment.remote(catalog.environment))
420
+ request = indirection.request(:save, nil, catalog_to_cache, environment: Puppet::Node::Environment.remote(catalog_to_cache.environment))
408
421
  Puppet.info("Caching catalog for #{request.key}")
409
422
  indirection.cache.save(request)
410
423
  end
@@ -1033,6 +1033,14 @@ EOT
1033
1033
  certificate revocation checking and does not attempt to download the CRL.
1034
1034
  EOT
1035
1035
  },
1036
+ :ciphers => {
1037
+ :default => 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256',
1038
+ :type => :string,
1039
+ :desc => "The list of ciphersuites for TLS connections initiated by puppet. The
1040
+ default value is chosen to support TLS 1.0 and up, but can be made
1041
+ more restrictive if needed. The ciphersuites must be specified in OpenSSL
1042
+ format, not IANA."
1043
+ },
1036
1044
  :key_type => {
1037
1045
  :default => 'rsa',
1038
1046
  :type => :enum,
@@ -1076,7 +1084,7 @@ EOT
1076
1084
  :type => :string,
1077
1085
  :desc => "Where to send log messages. Choose between 'syslog' (the POSIX syslog
1078
1086
  service), 'eventlog' (the Windows Event Log), 'console', or the path to a log
1079
- file."
1087
+ file. Multiple destinations can be set using a comma separated list (eg: `/path/file1,console,/path/file2`)"
1080
1088
  # Sure would be nice to set the Puppet::Util::Log destination here in an :on_initialize_and_write hook,
1081
1089
  # unfortunately we have a large number of tests that rely on the logging not resetting itself when the
1082
1090
  # settings are initialized as they test what gets logged during settings initialization.
@@ -1319,25 +1327,16 @@ EOT
1319
1327
  by `puppet`, and should only be set if you're writing your own Puppet
1320
1328
  executable.",
1321
1329
  },
1322
- :serverport => {
1330
+ :masterport => {
1323
1331
  :default => 8140,
1324
1332
  :type => :port,
1325
1333
  :desc => "The default port puppet subcommands use to communicate
1326
1334
  with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be
1327
1335
  overridden by more specific settings (see `ca_port`, `report_port`).",
1328
- :hook => proc do |value|
1329
- Puppet[:masterport] = value unless Puppet.settings.set_by_config?(:masterport)
1330
- end
1331
1336
  },
1332
- :masterport => {
1333
- :default => "$serverport",
1334
- :type => :port,
1335
- :desc => "The default port puppet subcommands use to communicate
1336
- with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be
1337
- overridden by more specific settings (see `ca_port`, `report_port`).",
1338
- :hook => proc do |value|
1339
- Puppet[:serverport] = value unless Puppet.settings.set_by_config?(:serverport)
1340
- end
1337
+ :serverport => {
1338
+ :type => :alias,
1339
+ :alias_for => :masterport
1341
1340
  },
1342
1341
  :bucketdir => {
1343
1342
  :default => "$vardir/bucket",
@@ -1673,7 +1672,7 @@ EOT
1673
1672
  },
1674
1673
  :agent_disabled_lockfile => {
1675
1674
  :default => "$statedir/agent_disabled.lock",
1676
- :type => :file,
1675
+ :type => :string,
1677
1676
  :desc => "A lock file to indicate that puppet agent runs have been administratively
1678
1677
  disabled. File contains a JSON object with state information.",
1679
1678
  },
@@ -2158,10 +2157,6 @@ EOT
2158
2157
  :rich_data => {
2159
2158
  :default => true,
2160
2159
  :type => :boolean,
2161
- :hook => proc do |value|
2162
- envs = Puppet.lookup(:environments) { nil }
2163
- envs.clear_all unless envs.nil?
2164
- end,
2165
2160
  :desc => <<-'EOT'
2166
2161
  Enables having extended data in the catalog by storing them as a hash with the special key
2167
2162
  `__ptype`. When enabled, resource containing values of the data types `Binary`, `Regexp`,
@@ -225,6 +225,9 @@ module Puppet::Environments
225
225
  private
226
226
 
227
227
  def create_environment(name)
228
+ # interpolated modulepaths may be cached from prior environment instances
229
+ Puppet.settings.clear_environment_settings(name)
230
+
228
231
  env_symbol = name.intern
229
232
  setting_values = Puppet.settings.values(env_symbol, Puppet.settings.preferred_run_mode)
230
233
  env = Puppet::Node::Environment.create(
@@ -350,7 +353,19 @@ module Puppet::Environments
350
353
 
351
354
  # @!macro loader_list
352
355
  def list
353
- @loader.list
356
+ # Evict all that have expired, in the same way as `get`
357
+ clear_all_expired
358
+
359
+ @loader.list.map do |env|
360
+ name = env.name
361
+ old_entry = @cache[name]
362
+ if old_entry
363
+ old_entry.value
364
+ else
365
+ add_entry(name, entry(env))
366
+ env
367
+ end
368
+ end
354
369
  end
355
370
 
356
371
  # @!macro loader_search_paths
@@ -128,22 +128,46 @@ Puppet::Indirector::Face.define(:facts, '0.0.1') do
128
128
  summary _("Show legacy facts when querying all facts.")
129
129
  end
130
130
 
131
+ option("--value-only") do
132
+ summary _("Show only the value when the action is called with a single query")
133
+ end
134
+
135
+ option("--timing") do
136
+ summary _("Show how much time it took to resolve each fact.")
137
+ end
138
+
131
139
  when_invoked do |*args|
132
140
  options = args.pop
133
141
 
134
142
  Puppet.settings.preferred_run_mode = :agent
135
143
  Puppet::Node::Facts.indirection.terminus_class = :facter
136
144
 
145
+ if options[:value_only] && !args.count.eql?(1)
146
+ options[:value_only] = nil
147
+ Puppet.warning("Incorrect use of --value-only argument; it can only be used when querying for a single fact!")
148
+ end
137
149
 
138
150
  options[:user_query] = args
139
151
  options[:resolve_options] = true
140
152
  result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname], options)
141
153
 
142
- result.values
154
+ if options[:value_only]
155
+ result.values.values.first
156
+ else
157
+ result.values
158
+ end
143
159
  end
144
160
 
145
161
  when_rendering :console do |result|
146
- Puppet::Util::Json.dump(result, :pretty => true)
162
+ # VALID_TYPES = [Integer, Float, TrueClass, FalseClass, NilClass, Symbol, String, Array, Hash].freeze
163
+ # from https://github.com/puppetlabs/facter/blob/4.0.49/lib/facter/custom_facts/util/normalization.rb#L8
164
+
165
+ case result
166
+ when Array, Hash
167
+ Puppet::Util::Json.dump(result, :pretty => true)
168
+ else # one of VALID_TYPES above
169
+ result
170
+ end
147
171
  end
148
172
  end
149
173
  end