puppet 7.23.0-x64-mingw32 → 7.24.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +36 -33
  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/pops/evaluator/relationship_operator.rb +1 -1
  20. data/lib/puppet/pops/functions/function.rb +1 -3
  21. data/lib/puppet/pops/loader/dependency_loader.rb +1 -4
  22. data/lib/puppet/pops/loader/loader_paths.rb +1 -3
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loaders.rb +6 -2
  25. data/lib/puppet/pops/lookup/context.rb +3 -4
  26. data/lib/puppet/pops/lookup/hiera_config.rb +1 -1
  27. data/lib/puppet/resource.rb +4 -0
  28. data/lib/puppet/settings/base_setting.rb +3 -2
  29. data/lib/puppet/settings.rb +0 -1
  30. data/lib/puppet/type/file/ctime.rb +1 -1
  31. data/lib/puppet/type/file/mtime.rb +1 -1
  32. data/lib/puppet/util/log.rb +2 -2
  33. data/lib/puppet/version.rb +1 -1
  34. data/man/man5/puppet.conf.5 +13 -2
  35. data/man/man8/puppet-agent.8 +1 -1
  36. data/man/man8/puppet-apply.8 +1 -1
  37. data/man/man8/puppet-catalog.8 +1 -1
  38. data/man/man8/puppet-config.8 +1 -1
  39. data/man/man8/puppet-describe.8 +1 -1
  40. data/man/man8/puppet-device.8 +1 -1
  41. data/man/man8/puppet-doc.8 +1 -1
  42. data/man/man8/puppet-epp.8 +1 -1
  43. data/man/man8/puppet-facts.8 +1 -1
  44. data/man/man8/puppet-filebucket.8 +1 -1
  45. data/man/man8/puppet-generate.8 +1 -1
  46. data/man/man8/puppet-help.8 +1 -1
  47. data/man/man8/puppet-lookup.8 +1 -1
  48. data/man/man8/puppet-module.8 +1 -1
  49. data/man/man8/puppet-node.8 +1 -1
  50. data/man/man8/puppet-parser.8 +1 -1
  51. data/man/man8/puppet-plugin.8 +1 -1
  52. data/man/man8/puppet-report.8 +1 -1
  53. data/man/man8/puppet-resource.8 +1 -1
  54. data/man/man8/puppet-script.8 +1 -1
  55. data/man/man8/puppet-ssl.8 +1 -1
  56. data/man/man8/puppet.8 +2 -2
  57. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README +3 -0
  58. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp +17 -0
  59. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json +20 -0
  60. data/spec/integration/application/module_spec.rb +141 -0
  61. data/spec/unit/environments_spec.rb +9 -0
  62. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -0
  63. data/spec/unit/node/environment_spec.rb +41 -0
  64. data/spec/unit/parser/resource_spec.rb +9 -0
  65. data/spec/unit/type/file/ctime_spec.rb +1 -1
  66. data/spec/unit/type/file/mtime_spec.rb +1 -1
  67. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b0b18863e679b26df47605a7ce5bf00748130833e423894a5e08b90029cad27
4
- data.tar.gz: feb5ec780ef14ab47c4b9d2cef6e94500b9e7e060a73488953628d269fe0e37d
3
+ metadata.gz: b0af45e2daec58cdefed8c697bb5f0811f097854562b285eca94cba84872be77
4
+ data.tar.gz: eb491dfb35043c67937b809e6971d4d90b5e1bed94bd6a0502ef337644bafd6f
5
5
  SHA512:
6
- metadata.gz: b2d51d68cecf5b7fc0ebaa515d9bf78d2e11b037e065be887d2ad69690d4512f60a7e5c9df8555eaf6f085f3ebfe08f9035429740a411bfd78cafbfd2352982a
7
- data.tar.gz: e0769d478bfd77310eefc6d66fbaf65332498a4b84ace9b02eefc10373073c324129d78c8a9d3d223f776e701809b6406992510a434c5960937da1f9dfd6322c
6
+ metadata.gz: e8ac4a24183857396815b6db8e19b82ca4ed61a4989148cc71e98ce6c31ae7742627d307a69a6f833a1ffc3b6d33e0a84e2c390e69402ecce7af95427a15958d
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,12 +1,12 @@
1
1
  GIT
2
2
  remote: https://github.com/puppetlabs/packaging
3
- revision: f723ffb6df1216eb6cec0c81c0bec349b4fad506
3
+ revision: f1c483d29ce1ff6d7ca7be42014eab998f499625
4
4
  branch: 1.0.x
5
5
  specs:
6
- packaging (0.108.1.6.gf723ffb)
6
+ packaging (0.109.5)
7
7
  apt_stage_artifacts
8
8
  artifactory (~> 3)
9
- csv (= 3.1.5)
9
+ csv (>= 3.1.5)
10
10
  google-cloud-storage
11
11
  googleauth
12
12
  rake (>= 12.3)
@@ -15,7 +15,7 @@ GIT
15
15
  PATH
16
16
  remote: .
17
17
  specs:
18
- puppet (7.23.0)
18
+ puppet (7.24.0)
19
19
  CFPropertyList (~> 2.2)
20
20
  concurrent-ruby (~> 1.0, < 1.2.0)
21
21
  deep_merge (~> 1.0)
@@ -31,7 +31,7 @@ GEM
31
31
  remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
32
32
  specs:
33
33
  CFPropertyList (2.3.6)
34
- addressable (2.8.1)
34
+ addressable (2.8.3)
35
35
  public_suffix (>= 2.0.2, < 6.0)
36
36
  apt_stage_artifacts (0.11.0)
37
37
  docopt
@@ -41,14 +41,14 @@ GEM
41
41
  concurrent-ruby (1.1.10)
42
42
  crack (0.4.5)
43
43
  rexml
44
- csv (3.1.5)
44
+ csv (3.2.6)
45
45
  declarative (0.0.20)
46
46
  deep_merge (1.2.2)
47
47
  diff-lcs (1.5.0)
48
48
  digest-crc (0.6.4)
49
49
  rake (>= 12.0.0, < 14.0.0)
50
50
  docopt (0.6.1)
51
- facter (4.2.14)
51
+ facter (4.3.0)
52
52
  hocon (~> 1.3)
53
53
  thor (>= 1.0.1, < 2.0)
54
54
  faraday (2.7.4)
@@ -64,7 +64,7 @@ GEM
64
64
  fast_gettext (~> 1.1.0)
65
65
  gettext (>= 3.0.2, < 3.3.0)
66
66
  locale
67
- google-apis-core (0.10.0)
67
+ google-apis-core (0.11.0)
68
68
  addressable (~> 2.5, >= 2.5.1)
69
69
  googleauth (>= 0.16.2, < 2.a)
70
70
  httpclient (>= 2.8.1, < 3.a)
@@ -73,8 +73,8 @@ GEM
73
73
  retriable (>= 2.0, < 4.a)
74
74
  rexml
75
75
  webrick
76
- google-apis-iamcredentials_v1 (0.16.0)
77
- 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)
78
78
  google-apis-storage_v1 (0.19.0)
79
79
  google-apis-core (>= 0.9.0, < 2.a)
80
80
  google-cloud-core (1.6.0)
@@ -82,7 +82,7 @@ GEM
82
82
  google-cloud-errors (~> 1.0)
83
83
  google-cloud-env (1.6.0)
84
84
  faraday (>= 0.17.3, < 3.0)
85
- google-cloud-errors (1.3.0)
85
+ google-cloud-errors (1.3.1)
86
86
  google-cloud-storage (1.44.0)
87
87
  addressable (~> 2.8)
88
88
  digest-crc (~> 0.4)
@@ -91,7 +91,7 @@ GEM
91
91
  google-cloud-core (~> 1.6)
92
92
  googleauth (>= 0.16.2, < 2.a)
93
93
  mini_mime (~> 1.0)
94
- googleauth (1.3.0)
94
+ googleauth (1.5.0)
95
95
  faraday (>= 0.17.3, < 3.a)
96
96
  jwt (>= 1.4, < 3.0)
97
97
  memoist (~> 0.16)
@@ -99,12 +99,12 @@ GEM
99
99
  os (>= 0.9, < 2.0)
100
100
  signet (>= 0.16, < 2.a)
101
101
  hashdiff (1.0.1)
102
- hiera (3.11.0)
102
+ hiera (3.12.0)
103
103
  hiera-eyaml (3.3.0)
104
104
  highline
105
105
  optimist
106
106
  highline (2.1.0)
107
- hocon (1.3.1)
107
+ hocon (1.4.0)
108
108
  hpricot (0.8.6)
109
109
  httpclient (2.8.3)
110
110
  json-schema (2.8.1)
@@ -116,29 +116,28 @@ GEM
116
116
  method_source (1.0.0)
117
117
  mini_mime (1.1.2)
118
118
  minitar (0.9)
119
- msgpack (1.6.0)
119
+ msgpack (1.7.0)
120
120
  multi_json (1.15.0)
121
121
  mustache (1.1.1)
122
122
  optimist (3.0.1)
123
123
  os (1.1.4)
124
124
  parallel (1.22.1)
125
- parser (2.7.2.0)
125
+ parser (3.2.2.0)
126
126
  ast (~> 2.4.1)
127
- powerpack (0.1.3)
128
127
  pry (0.14.2)
129
128
  coderay (~> 1.1)
130
129
  method_source (~> 1.0)
131
130
  public_suffix (5.0.1)
132
131
  puppet-resource_api (1.8.14)
133
132
  hocon (>= 1.0)
134
- puppetserver-ca (2.4.0)
133
+ puppetserver-ca (2.5.0)
135
134
  facter (>= 2.0.1, < 5)
136
135
  racc (1.5.2)
137
- rainbow (2.2.2)
138
- rake
136
+ rainbow (3.1.1)
139
137
  rake (13.0.6)
140
138
  rdiscount (2.2.7)
141
139
  rdoc (6.3.3)
140
+ regexp_parser (2.7.0)
142
141
  release-metrics (1.1.0)
143
142
  csv
144
143
  docopt
@@ -164,21 +163,25 @@ GEM
164
163
  rspec-its (1.3.0)
165
164
  rspec-core (>= 3.0.0)
166
165
  rspec-expectations (>= 3.0.0)
167
- rspec-mocks (3.12.3)
166
+ rspec-mocks (3.12.5)
168
167
  diff-lcs (>= 1.2.0, < 2.0)
169
168
  rspec-support (~> 3.12.0)
170
169
  rspec-support (3.12.0)
171
- rubocop (0.49.1)
170
+ rubocop (1.28.0)
172
171
  parallel (~> 1.10)
173
- parser (>= 2.3.3.1, < 3.0)
174
- powerpack (~> 0.1)
175
- 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)
176
177
  ruby-progressbar (~> 1.7)
177
- unicode-display_width (~> 1.0, >= 1.0.1)
178
- rubocop-i18n (1.2.0)
179
- rubocop (~> 0.49.0)
180
- ruby-prof (1.5.0)
181
- 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)
182
185
  ruby2_keywords (0.0.5)
183
186
  scanf (1.0.0)
184
187
  semantic_puppet (1.0.4)
@@ -191,7 +194,7 @@ GEM
191
194
  thor (1.2.1)
192
195
  trailblazer-option (0.1.2)
193
196
  uber (0.1.0)
194
- unicode-display_width (1.8.0)
197
+ unicode-display_width (2.4.2)
195
198
  vcr (5.1.0)
196
199
  webmock (3.18.1)
197
200
  addressable (>= 2.8.0)
@@ -226,8 +229,8 @@ DEPENDENCIES
226
229
  rspec (~> 3.1)
227
230
  rspec-expectations (~> 3.9, != 3.9.3)
228
231
  rspec-its (~> 1.1)
229
- rubocop (~> 0.49)
230
- rubocop-i18n (~> 1.2.0)
232
+ rubocop (= 1.28.0)
233
+ rubocop-i18n (~> 3.0)
231
234
  ruby-prof (>= 0.16.0)
232
235
  semantic_puppet (~> 1.0)
233
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
 
@@ -119,7 +119,7 @@ class RelationshipOperator
119
119
  # To implement this, the general evaluator needs to be able to track each evaluation result and associate
120
120
  # it with a corresponding expression. This structure should then be passed to the relationship operator.
121
121
  #
122
- def evaluate (left_right_evaluated, relationship_expression, scope)
122
+ def evaluate(left_right_evaluated, relationship_expression, scope)
123
123
  # assert operator (should have been validated, but this logic makes assumptions which would
124
124
  # screw things up royally). Better safe than sorry.
125
125
  unless RELATIONSHIP_OPERATORS.include?(relationship_expression.operator)
@@ -11,9 +11,6 @@
11
11
  #
12
12
  # @api public
13
13
  class Puppet::Pops::Functions::Function
14
- # The scope where the function was defined
15
- attr_reader :closure_scope
16
-
17
14
  # The loader that loaded this function.
18
15
  # Should be used if function wants to load other things.
19
16
  #
@@ -74,6 +71,7 @@ class Puppet::Pops::Functions::Function
74
71
  internal_call_function(closure_scope, function_name, args, &block)
75
72
  end
76
73
 
74
+ # The scope where the function was defined
77
75
  def closure_scope
78
76
  # If closure scope is explicitly set to not nil, if there is a global scope, otherwise an empty hash
79
77
  @closure_scope || Puppet.lookup(:global_scope) { {} }
@@ -8,10 +8,6 @@
8
8
  # @api private
9
9
  #
10
10
  class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader
11
-
12
- # An index of module_name to module loader used to speed up lookup of qualified names
13
- attr_reader :index
14
-
15
11
  # Creates a DependencyLoader for one parent loader
16
12
  #
17
13
  # @param parent_loader [Puppet::Pops::Loader] typically a module loader for the root
@@ -88,6 +84,7 @@ class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader
88
84
  end
89
85
  end
90
86
 
87
+ # An index of module_name to module loader used to speed up lookup of qualified names
91
88
  def index
92
89
  @index ||= @dependency_loaders.reduce({}) { |index, loader| index[loader.module_name] = loader; index }
93
90
  end
@@ -54,14 +54,12 @@ module LoaderPaths
54
54
  # end
55
55
 
56
56
  class SmartPath
57
- # Generic path, in the sense of "if there are any entities of this kind to load, where are they?"
58
- attr_reader :generic_path
59
-
60
57
  # Creates SmartPath for the given loader (loader knows how to check for existence etc.)
61
58
  def initialize(loader)
62
59
  @loader = loader
63
60
  end
64
61
 
62
+ # Generic path, in the sense of "if there are any entities of this kind to load, where are they?"
65
63
  def generic_path
66
64
  return @generic_path unless @generic_path.nil?
67
65
 
@@ -115,7 +115,7 @@ module ModuleLoaders
115
115
  # created a different way, this loader can be set explicitly by the loaders bootstrap logic.
116
116
  #
117
117
  # @api private
118
- attr_accessor :private_loader
118
+ attr_writer :private_loader
119
119
 
120
120
  # Initialize a kind of ModuleLoader for one module
121
121
  # @param parent_loader [Loader] loader with higher priority