puppet 7.22.0-universal-darwin → 7.24.0-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +57 -68
  4. data/lib/puppet/application/face_base.rb +2 -1
  5. data/lib/puppet/defaults.rb +13 -0
  6. data/lib/puppet/environments.rb +9 -0
  7. data/lib/puppet/functions/each.rb +11 -13
  8. data/lib/puppet/functions/filter.rb +5 -13
  9. data/lib/puppet/functions/map.rb +7 -8
  10. data/lib/puppet/interface/action.rb +3 -3
  11. data/lib/puppet/interface/documentation.rb +2 -2
  12. data/lib/puppet/interface/option.rb +3 -4
  13. data/lib/puppet/module/plan.rb +1 -1
  14. data/lib/puppet/module/task.rb +1 -1
  15. data/lib/puppet/module.rb +1 -1
  16. data/lib/puppet/network/http/api/indirected_routes.rb +5 -4
  17. data/lib/puppet/node/environment.rb +38 -0
  18. data/lib/puppet/node.rb +2 -2
  19. data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
  20. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  21. data/lib/puppet/pops/functions/function.rb +1 -3
  22. data/lib/puppet/pops/loader/dependency_loader.rb +1 -4
  23. data/lib/puppet/pops/loader/loader_paths.rb +1 -3
  24. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  25. data/lib/puppet/pops/loaders.rb +6 -2
  26. data/lib/puppet/pops/lookup/context.rb +3 -4
  27. data/lib/puppet/pops/lookup/hiera_config.rb +1 -1
  28. data/lib/puppet/resource.rb +4 -0
  29. data/lib/puppet/settings/base_setting.rb +3 -2
  30. data/lib/puppet/settings.rb +0 -1
  31. data/lib/puppet/type/file/ctime.rb +1 -1
  32. data/lib/puppet/type/file/mtime.rb +1 -1
  33. data/lib/puppet/util/log.rb +2 -2
  34. data/lib/puppet/version.rb +1 -1
  35. data/man/man5/puppet.conf.5 +13 -2
  36. data/man/man8/puppet-agent.8 +1 -1
  37. data/man/man8/puppet-apply.8 +1 -1
  38. data/man/man8/puppet-catalog.8 +1 -1
  39. data/man/man8/puppet-config.8 +1 -1
  40. data/man/man8/puppet-describe.8 +1 -1
  41. data/man/man8/puppet-device.8 +1 -1
  42. data/man/man8/puppet-doc.8 +1 -1
  43. data/man/man8/puppet-epp.8 +1 -1
  44. data/man/man8/puppet-facts.8 +1 -1
  45. data/man/man8/puppet-filebucket.8 +1 -1
  46. data/man/man8/puppet-generate.8 +1 -1
  47. data/man/man8/puppet-help.8 +1 -1
  48. data/man/man8/puppet-lookup.8 +1 -1
  49. data/man/man8/puppet-module.8 +1 -1
  50. data/man/man8/puppet-node.8 +1 -1
  51. data/man/man8/puppet-parser.8 +1 -1
  52. data/man/man8/puppet-plugin.8 +1 -1
  53. data/man/man8/puppet-report.8 +1 -1
  54. data/man/man8/puppet-resource.8 +1 -1
  55. data/man/man8/puppet-script.8 +1 -1
  56. data/man/man8/puppet-ssl.8 +1 -1
  57. data/man/man8/puppet.8 +2 -2
  58. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README +3 -0
  59. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp +17 -0
  60. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json +20 -0
  61. data/spec/integration/application/module_spec.rb +141 -0
  62. data/spec/unit/environments_spec.rb +9 -0
  63. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -0
  64. data/spec/unit/node/environment_spec.rb +41 -0
  65. data/spec/unit/parser/functions/fqdn_rand_spec.rb +1 -1
  66. data/spec/unit/parser/resource_spec.rb +9 -0
  67. data/spec/unit/type/file/ctime_spec.rb +1 -1
  68. data/spec/unit/type/file/mtime_spec.rb +1 -1
  69. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2cd7e029ce27e48180ecc3432b651ff6a2933c99166f31fd82b498fbadd9dc5
4
- data.tar.gz: a98915aa4db761d30cc7b652179f998cb549382e01caf4cbcc2a0e82c1bd32e5
3
+ metadata.gz: ab4c6da29d5f9495c4a7d4e4459ba458b92d90b72030549d6c173ee5a67188ea
4
+ data.tar.gz: eb491dfb35043c67937b809e6971d4d90b5e1bed94bd6a0502ef337644bafd6f
5
5
  SHA512:
6
- metadata.gz: a59780e3bd62216fe2ee2fb7d77da686663cf55502fdd58a75defe37cd57859a7094d4054180eb33f284f8651488215ceb18ae20bc0844281d9ea20a9f8f368d
7
- data.tar.gz: ff194f4bd0b0c82d90405fbd27e97ec2f0dcd099580cef15f28bedf307b80f25670004c26a54b2feecdf3c7e30856ef4af1917ac11dffee49e62e47ecc2b235c
6
+ metadata.gz: dd4200cfc6f8726c949f12d0fbb2f751645a3e95c17c89a9a7f4f18890264ad1fedf54cf1a2e1677559c010b4ad3dc83d322b0fb18dd96cec11896a573145c58
7
+ data.tar.gz: 1d9c17d7e425e7df934e3fb845e3d66f57d3daa907e087cf7d354a1713fe392ea5bc0c5564782451926752b6520bced76d7dd689afff6d9517cdff3dc7200f09
data/Gemfile CHANGED
@@ -46,8 +46,8 @@ group(:test) do
46
46
  gem 'webrick', '~> 1.7', require: false if RUBY_VERSION.to_f >= 3.0
47
47
  gem 'yard', require: false
48
48
 
49
- gem 'rubocop', '~> 0.49', require: false, platforms: [:ruby]
50
- gem 'rubocop-i18n', '~> 1.2.0', require: false, platforms: [:ruby]
49
+ gem 'rubocop', '1.28.0', require: false, platforms: [:ruby]
50
+ gem 'rubocop-i18n', '~> 3.0', require: false, platforms: [:ruby]
51
51
  end
52
52
 
53
53
  group(:development, optional: true) do
data/Gemfile.lock CHANGED
@@ -1,7 +1,21 @@
1
+ GIT
2
+ remote: https://github.com/puppetlabs/packaging
3
+ revision: f1c483d29ce1ff6d7ca7be42014eab998f499625
4
+ branch: 1.0.x
5
+ specs:
6
+ packaging (0.109.5)
7
+ apt_stage_artifacts
8
+ artifactory (~> 3)
9
+ csv (>= 3.1.5)
10
+ google-cloud-storage
11
+ googleauth
12
+ rake (>= 12.3)
13
+ release-metrics
14
+
1
15
  PATH
2
16
  remote: .
3
17
  specs:
4
- puppet (7.22.0)
18
+ puppet (7.24.0)
5
19
  CFPropertyList (~> 2.2)
6
20
  concurrent-ruby (~> 1.0, < 1.2.0)
7
21
  deep_merge (~> 1.0)
@@ -14,10 +28,10 @@ PATH
14
28
  semantic_puppet (~> 1.0)
15
29
 
16
30
  GEM
17
- remote: https://rubygems.org/
31
+ remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
18
32
  specs:
19
33
  CFPropertyList (2.3.6)
20
- addressable (2.8.1)
34
+ addressable (2.8.3)
21
35
  public_suffix (>= 2.0.2, < 6.0)
22
36
  apt_stage_artifacts (0.11.0)
23
37
  docopt
@@ -27,39 +41,20 @@ GEM
27
41
  concurrent-ruby (1.1.10)
28
42
  crack (0.4.5)
29
43
  rexml
30
- csv (3.1.5)
44
+ csv (3.2.6)
31
45
  declarative (0.0.20)
32
46
  deep_merge (1.2.2)
33
47
  diff-lcs (1.5.0)
34
48
  digest-crc (0.6.4)
35
49
  rake (>= 12.0.0, < 14.0.0)
36
50
  docopt (0.6.1)
37
- facter (4.2.14)
51
+ facter (4.3.0)
38
52
  hocon (~> 1.3)
39
53
  thor (>= 1.0.1, < 2.0)
40
- faraday (1.10.3)
41
- faraday-em_http (~> 1.0)
42
- faraday-em_synchrony (~> 1.0)
43
- faraday-excon (~> 1.1)
44
- faraday-httpclient (~> 1.0)
45
- faraday-multipart (~> 1.0)
46
- faraday-net_http (~> 1.0)
47
- faraday-net_http_persistent (~> 1.0)
48
- faraday-patron (~> 1.0)
49
- faraday-rack (~> 1.0)
50
- faraday-retry (~> 1.0)
54
+ faraday (2.7.4)
55
+ faraday-net_http (>= 2.0, < 3.1)
51
56
  ruby2_keywords (>= 0.0.4)
52
- faraday-em_http (1.0.0)
53
- faraday-em_synchrony (1.0.0)
54
- faraday-excon (1.1.0)
55
- faraday-httpclient (1.0.1)
56
- faraday-multipart (1.0.4)
57
- multipart-post (~> 2)
58
- faraday-net_http (1.0.1)
59
- faraday-net_http_persistent (1.2.0)
60
- faraday-patron (1.0.0)
61
- faraday-rack (1.0.0)
62
- faraday-retry (1.0.3)
57
+ faraday-net_http (3.0.2)
63
58
  fast_gettext (1.1.2)
64
59
  ffi (1.15.5)
65
60
  gettext (3.2.9)
@@ -69,7 +64,7 @@ GEM
69
64
  fast_gettext (~> 1.1.0)
70
65
  gettext (>= 3.0.2, < 3.3.0)
71
66
  locale
72
- google-apis-core (0.9.5)
67
+ google-apis-core (0.11.0)
73
68
  addressable (~> 2.5, >= 2.5.1)
74
69
  googleauth (>= 0.16.2, < 2.a)
75
70
  httpclient (>= 2.8.1, < 3.a)
@@ -78,8 +73,8 @@ GEM
78
73
  retriable (>= 2.0, < 4.a)
79
74
  rexml
80
75
  webrick
81
- google-apis-iamcredentials_v1 (0.16.0)
82
- google-apis-core (>= 0.9.1, < 2.a)
76
+ google-apis-iamcredentials_v1 (0.17.0)
77
+ google-apis-core (>= 0.11.0, < 2.a)
83
78
  google-apis-storage_v1 (0.19.0)
84
79
  google-apis-core (>= 0.9.0, < 2.a)
85
80
  google-cloud-core (1.6.0)
@@ -87,7 +82,7 @@ GEM
87
82
  google-cloud-errors (~> 1.0)
88
83
  google-cloud-env (1.6.0)
89
84
  faraday (>= 0.17.3, < 3.0)
90
- google-cloud-errors (1.3.0)
85
+ google-cloud-errors (1.3.1)
91
86
  google-cloud-storage (1.44.0)
92
87
  addressable (~> 2.8)
93
88
  digest-crc (~> 0.4)
@@ -96,7 +91,7 @@ GEM
96
91
  google-cloud-core (~> 1.6)
97
92
  googleauth (>= 0.16.2, < 2.a)
98
93
  mini_mime (~> 1.0)
99
- googleauth (1.1.3)
94
+ googleauth (1.5.0)
100
95
  faraday (>= 0.17.3, < 3.a)
101
96
  jwt (>= 1.4, < 3.0)
102
97
  memoist (~> 0.16)
@@ -104,55 +99,45 @@ GEM
104
99
  os (>= 0.9, < 2.0)
105
100
  signet (>= 0.16, < 2.a)
106
101
  hashdiff (1.0.1)
107
- hiera (3.11.0)
102
+ hiera (3.12.0)
108
103
  hiera-eyaml (3.3.0)
109
104
  highline
110
105
  optimist
111
106
  highline (2.1.0)
112
- hocon (1.3.1)
107
+ hocon (1.4.0)
113
108
  hpricot (0.8.6)
114
109
  httpclient (2.8.3)
115
110
  json-schema (2.8.1)
116
111
  addressable (>= 2.4)
117
- jwt (2.6.0)
112
+ jwt (2.7.0)
118
113
  locale (2.1.3)
119
114
  memoist (0.16.2)
120
115
  memory_profiler (1.0.1)
121
116
  method_source (1.0.0)
122
117
  mini_mime (1.1.2)
123
118
  minitar (0.9)
124
- msgpack (1.6.0)
119
+ msgpack (1.7.0)
125
120
  multi_json (1.15.0)
126
- multipart-post (2.2.3)
127
121
  mustache (1.1.1)
128
122
  optimist (3.0.1)
129
123
  os (1.1.4)
130
- packaging (0.108.1)
131
- apt_stage_artifacts
132
- artifactory (~> 3)
133
- csv (= 3.1.5)
134
- google-cloud-storage
135
- googleauth
136
- rake (>= 12.3)
137
- release-metrics
138
124
  parallel (1.22.1)
139
- parser (2.7.2.0)
125
+ parser (3.2.2.0)
140
126
  ast (~> 2.4.1)
141
- powerpack (0.1.3)
142
127
  pry (0.14.2)
143
128
  coderay (~> 1.1)
144
129
  method_source (~> 1.0)
145
- public_suffix (4.0.7)
130
+ public_suffix (5.0.1)
146
131
  puppet-resource_api (1.8.14)
147
132
  hocon (>= 1.0)
148
- puppetserver-ca (2.4.0)
133
+ puppetserver-ca (2.5.0)
149
134
  facter (>= 2.0.1, < 5)
150
135
  racc (1.5.2)
151
- rainbow (2.2.2)
152
- rake
136
+ rainbow (3.1.1)
153
137
  rake (13.0.6)
154
138
  rdiscount (2.2.7)
155
139
  rdoc (6.3.3)
140
+ regexp_parser (2.7.0)
156
141
  release-metrics (1.1.0)
157
142
  csv
158
143
  docopt
@@ -170,7 +155,7 @@ GEM
170
155
  rspec-core (~> 3.12.0)
171
156
  rspec-expectations (~> 3.12.0)
172
157
  rspec-mocks (~> 3.12.0)
173
- rspec-core (3.12.0)
158
+ rspec-core (3.12.1)
174
159
  rspec-support (~> 3.12.0)
175
160
  rspec-expectations (3.12.2)
176
161
  diff-lcs (>= 1.2.0, < 2.0)
@@ -178,34 +163,38 @@ GEM
178
163
  rspec-its (1.3.0)
179
164
  rspec-core (>= 3.0.0)
180
165
  rspec-expectations (>= 3.0.0)
181
- rspec-mocks (3.12.3)
166
+ rspec-mocks (3.12.5)
182
167
  diff-lcs (>= 1.2.0, < 2.0)
183
168
  rspec-support (~> 3.12.0)
184
169
  rspec-support (3.12.0)
185
- rubocop (0.49.1)
170
+ rubocop (1.28.0)
186
171
  parallel (~> 1.10)
187
- parser (>= 2.3.3.1, < 3.0)
188
- powerpack (~> 0.1)
189
- rainbow (>= 1.99.1, < 3.0)
172
+ parser (>= 3.1.0.0)
173
+ rainbow (>= 2.2.2, < 4.0)
174
+ regexp_parser (>= 1.8, < 3.0)
175
+ rexml
176
+ rubocop-ast (>= 1.17.0, < 2.0)
190
177
  ruby-progressbar (~> 1.7)
191
- unicode-display_width (~> 1.0, >= 1.0.1)
192
- rubocop-i18n (1.2.0)
193
- rubocop (~> 0.49.0)
194
- ruby-prof (1.4.3)
195
- ruby-progressbar (1.11.0)
178
+ unicode-display_width (>= 1.4.0, < 3.0)
179
+ rubocop-ast (1.28.0)
180
+ parser (>= 3.2.1.0)
181
+ rubocop-i18n (3.0.0)
182
+ rubocop (~> 1.0)
183
+ ruby-prof (1.6.1)
184
+ ruby-progressbar (1.13.0)
196
185
  ruby2_keywords (0.0.5)
197
186
  scanf (1.0.0)
198
187
  semantic_puppet (1.0.4)
199
- signet (0.16.1)
188
+ signet (0.17.0)
200
189
  addressable (~> 2.8)
201
- faraday (>= 0.17.5, < 3.0)
190
+ faraday (>= 0.17.5, < 3.a)
202
191
  jwt (>= 1.5, < 3.0)
203
192
  multi_json (~> 1.10)
204
193
  text (1.3.1)
205
194
  thor (1.2.1)
206
195
  trailblazer-option (0.1.2)
207
196
  uber (0.1.0)
208
- unicode-display_width (1.8.0)
197
+ unicode-display_width (2.4.2)
209
198
  vcr (5.1.0)
210
199
  webmock (3.18.1)
211
200
  addressable (>= 2.8.0)
@@ -228,7 +217,7 @@ DEPENDENCIES
228
217
  memory_profiler
229
218
  minitar (~> 0.9)
230
219
  msgpack (~> 1.2)
231
- packaging (~> 0.99)
220
+ packaging!
232
221
  pry
233
222
  puppet!
234
223
  puppet-resource_api (~> 1.5)
@@ -240,8 +229,8 @@ DEPENDENCIES
240
229
  rspec (~> 3.1)
241
230
  rspec-expectations (~> 3.9, != 3.9.3)
242
231
  rspec-its (~> 1.1)
243
- rubocop (~> 0.49)
244
- rubocop-i18n (~> 1.2.0)
232
+ rubocop (= 1.28.0)
233
+ rubocop-i18n (~> 3.0)
245
234
  ruby-prof (>= 0.16.0)
246
235
  semantic_puppet (~> 1.0)
247
236
  vcr (~> 5.0)
@@ -27,7 +27,8 @@ class Puppet::Application::FaceBase < Puppet::Application
27
27
  exit(0)
28
28
  end
29
29
 
30
- attr_accessor :face, :action, :type, :arguments, :render_as
30
+ attr_reader :render_as
31
+ attr_accessor :face, :action, :type, :arguments
31
32
 
32
33
  def render_as=(format)
33
34
  @render_as = Puppet::Network::FormatHandler.format(format)
@@ -421,6 +421,19 @@ module Puppet
421
421
  <https://puppet.com/docs/puppet/latest/environments_about.html>",
422
422
  :type => :path,
423
423
  },
424
+ :report_configured_environmentpath => {
425
+ :type => :boolean,
426
+ :default => true,
427
+ :desc => <<-'EOT'
428
+ When versioned_environment_dirs is `true` Puppet will readlink the environmentpath
429
+ when constructing the environment's modulepath. The full readlinked path is referred
430
+ to as the "resolved path" and the configured path potentially containing symlinks is
431
+ the "configured path". When reporting where resources come from users may choose
432
+ between the configured or resolved path.
433
+
434
+ When set to false, the resolved paths are reported instead of the configured paths.
435
+ EOT
436
+ },
424
437
  :use_last_environment => {
425
438
  :type => :boolean,
426
439
  :default => true,
@@ -243,6 +243,15 @@ module Puppet::Environments
243
243
  setting_values.interpolate(:manifest),
244
244
  setting_values.interpolate(:config_version)
245
245
  )
246
+
247
+ configured_path = File.join(@environment_dir, name.to_s)
248
+ env.configured_path = configured_path
249
+ if Puppet.settings[:report_configured_environmentpath]
250
+ env.resolved_path = validated_directory(configured_path)
251
+ else
252
+ env.resolved_path = configured_path
253
+ end
254
+
246
255
  env
247
256
  end
248
257
 
@@ -116,10 +116,9 @@ Puppet::Functions.create_function(:each) do
116
116
  end
117
117
 
118
118
  def foreach_Hash_1(hash)
119
- enumerator = hash.each_pair
120
119
  begin
121
- hash.size.times do
122
- yield(enumerator.next)
120
+ hash.each_pair do |pair|
121
+ yield(pair)
123
122
  end
124
123
  rescue StopIteration
125
124
  end
@@ -128,10 +127,9 @@ Puppet::Functions.create_function(:each) do
128
127
  end
129
128
 
130
129
  def foreach_Hash_2(hash)
131
- enumerator = hash.each_pair
132
130
  begin
133
- hash.size.times do
134
- yield(*enumerator.next)
131
+ hash.each_pair do |pair|
132
+ yield(*pair)
135
133
  end
136
134
  rescue StopIteration
137
135
  end
@@ -141,10 +139,12 @@ Puppet::Functions.create_function(:each) do
141
139
 
142
140
  def foreach_Enumerable_1(enumerable)
143
141
  enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
144
- begin
145
- loop { yield(enum.next) }
146
- rescue StopIteration
142
+ begin
143
+ enum.each do |value|
144
+ yield value
147
145
  end
146
+ rescue StopIteration
147
+ end
148
148
  # produces the receiver
149
149
  enumerable
150
150
  end
@@ -155,10 +155,8 @@ Puppet::Functions.create_function(:each) do
155
155
  enum.each { |entry| yield(*entry) }
156
156
  else
157
157
  begin
158
- index = 0
159
- loop do
160
- yield(index, enum.next)
161
- index += 1
158
+ enum.each_with_index do |value, index|
159
+ yield(index, value)
162
160
  end
163
161
  rescue StopIteration
164
162
  end
@@ -109,11 +109,8 @@ Puppet::Functions.create_function(:filter) do
109
109
  result = []
110
110
  enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
111
111
  begin
112
- loop do
113
- it = enum.next
114
- if yield(it)
115
- result << it
116
- end
112
+ enum.each do |value|
113
+ result << value if yield(value)
117
114
  end
118
115
  rescue StopIteration
119
116
  end
@@ -124,18 +121,13 @@ Puppet::Functions.create_function(:filter) do
124
121
  enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
125
122
  if enum.hash_style?
126
123
  result = {}
127
- enum.each { |k, v| result[k] = v if yield(k, v) }
124
+ enum.each {| k, v| result[k] = v if yield(k, v) }
128
125
  result
129
126
  else
130
127
  result = []
131
128
  begin
132
- index = 0
133
- loop do
134
- it = enum.next
135
- if yield(index, it)
136
- result << it
137
- end
138
- index += 1
129
+ enum.each_with_index do |value, index|
130
+ result << value if yield(index, value)
139
131
  end
140
132
  rescue StopIteration
141
133
  end
@@ -90,7 +90,7 @@ Puppet::Functions.create_function(:map) do
90
90
  def map_Hash_1(hash)
91
91
  result = []
92
92
  begin
93
- hash.map {|x, y| result << yield([x, y]) }
93
+ hash.each {|x, y| result << yield([x, y]) }
94
94
  rescue StopIteration
95
95
  end
96
96
  result
@@ -99,7 +99,7 @@ Puppet::Functions.create_function(:map) do
99
99
  def map_Hash_2(hash)
100
100
  result = []
101
101
  begin
102
- hash.map {|x, y| result << yield(x, y) }
102
+ hash.each {|x, y| result << yield(x, y) }
103
103
  rescue StopIteration
104
104
  end
105
105
  result
@@ -109,7 +109,9 @@ Puppet::Functions.create_function(:map) do
109
109
  result = []
110
110
  enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
111
111
  begin
112
- loop { result << yield(enum.next) }
112
+ enum.each do |val|
113
+ result << yield(val)
114
+ end
113
115
  rescue StopIteration
114
116
  end
115
117
  result
@@ -122,14 +124,11 @@ Puppet::Functions.create_function(:map) do
122
124
  else
123
125
  result = []
124
126
  begin
125
- index = 0
126
- loop do
127
- result << yield(index, enum.next)
128
- index = index + 1
127
+ enum.each_with_index do |val, index|
128
+ result << yield(index, val)
129
129
  end
130
130
  rescue StopIteration
131
131
  end
132
-
133
132
  result
134
133
  end
135
134
  end
@@ -141,7 +141,7 @@ class Puppet::Interface::Action
141
141
 
142
142
  # @api private
143
143
  # @return [Symbol]
144
- attr_accessor :render_as
144
+ attr_reader :render_as
145
145
  def render_as=(value)
146
146
  @render_as = value.to_sym
147
147
  end
@@ -216,11 +216,11 @@ class Puppet::Interface::Action
216
216
 
217
217
  # The arity of the action
218
218
  # @return [Integer]
219
- attr_reader :positional_arg_count
219
+ attr_reader :positional_arg_count
220
220
 
221
221
  # The block that is executed when the action is invoked
222
222
  # @return [block]
223
- attr_accessor :when_invoked
223
+ attr_reader :when_invoked
224
224
  def when_invoked=(block)
225
225
 
226
226
  internal_name = "#{@name} implementation, required on Ruby 1.8".to_sym
@@ -266,7 +266,7 @@ class Puppet::Interface
266
266
  # owners.
267
267
  # @return [String] Comma-separated list of copyright owners
268
268
  # @api private
269
- attr_accessor :copyright_owner
269
+ attr_reader :copyright_owner
270
270
  def copyright_owner=(value)
271
271
  case value
272
272
  when String then @copyright_owner = value
@@ -283,7 +283,7 @@ class Puppet::Interface
283
283
  # copyright year or years.
284
284
  # @return [String]
285
285
  # @api private
286
- attr_accessor :copyright_years
286
+ attr_reader :copyright_years
287
287
  def copyright_years=(value)
288
288
  years = munge_copyright_year value
289
289
  years = (years.is_a?(Array) ? years : [years]).
@@ -132,8 +132,7 @@ class Puppet::Interface::Option
132
132
  @default and @default.call
133
133
  end
134
134
 
135
- attr_reader :parent, :name, :aliases, :optparse
136
- attr_accessor :required
135
+ attr_reader :parent, :name, :aliases, :optparse, :required
137
136
  def required=(value)
138
137
  if has_default?
139
138
  raise ArgumentError, _("%{name} can't be optional and have a default value") % { name: self }
@@ -141,7 +140,7 @@ class Puppet::Interface::Option
141
140
  @required = value
142
141
  end
143
142
 
144
- attr_accessor :before_action
143
+ attr_reader :before_action
145
144
  def before_action=(proc)
146
145
  unless proc.is_a? Proc
147
146
  #TRANSLATORS 'proc' is a Ruby block of code
@@ -152,7 +151,7 @@ class Puppet::Interface::Option
152
151
  @parent.__send__(:__add_method, __decoration_name(:before), proc)
153
152
  end
154
153
 
155
- attr_accessor :after_action
154
+ attr_reader :after_action
156
155
  def after_action=(proc)
157
156
  unless proc.is_a? Proc
158
157
  #TRANSLATORS 'proc' is a Ruby block of code
@@ -104,7 +104,7 @@ class Puppet::Module
104
104
  end
105
105
  end
106
106
 
107
- attr_reader :name, :module, :metadata_file, :metadata
107
+ attr_reader :name, :module, :metadata_file
108
108
 
109
109
  # file paths must be relative to the modules plan directory
110
110
  def initialize(pup_module, plan_name, plan_files)
@@ -215,7 +215,7 @@ class Puppet::Module
215
215
  end
216
216
  end
217
217
 
218
- attr_reader :name, :module, :metadata_file, :metadata
218
+ attr_reader :name, :module, :metadata_file
219
219
 
220
220
  # file paths must be relative to the modules task directory
221
221
  def initialize(pup_module, task_name, module_executables, metadata_file = nil)
data/lib/puppet/module.rb CHANGED
@@ -62,7 +62,7 @@ class Puppet::Module
62
62
  SemanticPuppet::VersionRange.parse(range)
63
63
  end
64
64
 
65
- attr_reader :name, :environment, :path, :metadata, :tasks, :plans
65
+ attr_reader :name, :environment, :path, :metadata
66
66
  attr_writer :environment
67
67
 
68
68
  attr_accessor :dependencies, :forge_name
@@ -124,7 +124,7 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
124
124
 
125
125
  rendered_result = result
126
126
 
127
- rendered_format = first_response_formatter_for(indirection.model, request) do |format|
127
+ rendered_format = first_response_formatter_for(indirection.model, request, key) do |format|
128
128
  if result.respond_to?(:render)
129
129
  Puppet::Util::Profiler.profile(_("Rendered result in %{format}") % { format: format }, [:http, :v3_render, format]) do
130
130
  rendered_result = result.render(format)
@@ -157,7 +157,7 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
157
157
 
158
158
  rendered_result = nil
159
159
 
160
- rendered_format = first_response_formatter_for(indirection.model, request) do |format|
160
+ rendered_format = first_response_formatter_for(indirection.model, request, key) do |format|
161
161
  rendered_result = indirection.model.render_multiple(format, result)
162
162
  end
163
163
 
@@ -185,14 +185,15 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
185
185
 
186
186
  # Return the first response formatter that didn't cause the yielded
187
187
  # block to raise a FormatError.
188
- def first_response_formatter_for(model, request, &block)
188
+ def first_response_formatter_for(model, request, key, &block)
189
189
  formats = accepted_response_formatters_for(model, request)
190
190
  formatter = formats.find do |format|
191
191
  begin
192
192
  yield format
193
193
  true
194
194
  rescue Puppet::Network::FormatHandler::FormatError => err
195
- Puppet.log_exception(err, err.message, level: :debug)
195
+ Puppet.warning(_("Failed to serialize %{model} for '%{key}': %{detail}") %
196
+ {model: model, key: key, detail: err})
196
197
  false
197
198
  end
198
199
  end
@@ -166,6 +166,44 @@ class Puppet::Node::Environment
166
166
  # @api private
167
167
  attr_reader :lock
168
168
 
169
+ # For use with versioned dirs
170
+ # our environment path may contain symlinks, while we want to resolve the
171
+ # path while reading the manifests we may want to report the resources as
172
+ # coming from the configured path.
173
+ attr_accessor :configured_path
174
+
175
+ # See :configured_path above
176
+ attr_accessor :resolved_path
177
+
178
+ # Ensure the path given is of the format we want in the catalog/report.
179
+ #
180
+ # Intended for use with versioned symlinked environments. If this
181
+ # environment is configured with "/etc/puppetlabs/code/environments/production"
182
+ # but the resolved path is
183
+ #
184
+ # "/opt/puppetlabs/server/puppetserver/filesync/client/puppet-code/production_abcdef1234"
185
+ #
186
+ # this changes the filepath
187
+ #
188
+ # "/opt/puppetlabs/server/puppetserver/filesync/client/puppet-code/production_abcdef1234/modules/foo/manifests/init.pp"
189
+ #
190
+ # to
191
+ #
192
+ # "/etc/puppetlabs/code/environments/production/modules/foo/manifests/init.pp"
193
+ def externalize_path(filepath)
194
+ paths_set = configured_path && resolved_path
195
+ munging_possible = paths_set && configured_path != resolved_path
196
+ munging_desired = munging_possible &&
197
+ Puppet[:report_configured_environmentpath] &&
198
+ filepath.to_s.start_with?(resolved_path)
199
+
200
+ if munging_desired
201
+ File.join(configured_path, filepath.delete_prefix(resolved_path))
202
+ else
203
+ filepath
204
+ end
205
+ end
206
+
169
207
  # Checks to make sure that this environment did not have a manifest set in
170
208
  # its original environment.conf if Puppet is configured with
171
209
  # +disable_per_environment_manifest+ set true. If it did, the environment's
data/lib/puppet/node.rb CHANGED
@@ -16,8 +16,8 @@ class Puppet::Node
16
16
  indirects :node, :terminus_setting => :node_terminus, :doc => "Where to find node information.
17
17
  A node is composed of its name, its facts, and its environment."
18
18
 
19
- attr_accessor :name, :classes, :source, :ipaddress, :parameters, :trusted_data, :environment_name
20
- attr_reader :time, :facts
19
+ attr_accessor :name, :classes, :source, :ipaddress, :parameters, :environment_name
20
+ attr_reader :time, :facts, :trusted_data
21
21
 
22
22
  attr_reader :server_facts
23
23
 
@@ -23,7 +23,7 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :arity => -2, :type => :rvalu
23
23
  initial_seed = args.shift
24
24
  downcase = !!args.shift
25
25
 
26
- fqdn = self['::fqdn']
26
+ fqdn = self['facts'].dig('networking', 'fqdn')
27
27
  fqdn = fqdn.downcase if downcase
28
28
 
29
29
  # Puppet 5.4's fqdn_rand function produces a different value than earlier versions