puppet 7.23.0 → 7.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODEOWNERS +5 -5
- data/Gemfile +2 -2
- data/Gemfile.lock +50 -47
- data/ext/project_data.yaml +1 -1
- data/lib/puppet/application/face_base.rb +2 -1
- data/lib/puppet/defaults.rb +22 -0
- data/lib/puppet/environments.rb +9 -0
- data/lib/puppet/functions/each.rb +11 -13
- data/lib/puppet/functions/filter.rb +5 -13
- data/lib/puppet/functions/map.rb +7 -8
- data/lib/puppet/indirector/catalog/json.rb +8 -3
- data/lib/puppet/interface/action.rb +3 -3
- data/lib/puppet/interface/documentation.rb +2 -2
- data/lib/puppet/interface/option.rb +3 -4
- data/lib/puppet/module/plan.rb +1 -1
- data/lib/puppet/module/task.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +10 -4
- data/lib/puppet/node/environment.rb +38 -0
- data/lib/puppet/node.rb +2 -2
- data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
- data/lib/puppet/pops/functions/function.rb +1 -3
- data/lib/puppet/pops/loader/dependency_loader.rb +1 -4
- data/lib/puppet/pops/loader/loader_paths.rb +1 -3
- data/lib/puppet/pops/loader/module_loaders.rb +1 -1
- data/lib/puppet/pops/loaders.rb +6 -2
- data/lib/puppet/pops/lookup/context.rb +3 -4
- data/lib/puppet/pops/lookup/hiera_config.rb +1 -1
- data/lib/puppet/resource.rb +4 -0
- data/lib/puppet/settings/base_setting.rb +3 -2
- data/lib/puppet/settings.rb +0 -1
- data/lib/puppet/thread_local.rb +1 -4
- data/lib/puppet/type/file/ctime.rb +1 -1
- data/lib/puppet/type/file/mtime.rb +1 -1
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +21 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README +3 -0
- data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp +17 -0
- data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json +20 -0
- data/spec/integration/application/module_spec.rb +141 -0
- data/spec/unit/environments_spec.rb +9 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +28 -0
- data/spec/unit/node/environment_spec.rb +41 -0
- data/spec/unit/parser/resource_spec.rb +9 -0
- data/spec/unit/type/file/ctime_spec.rb +1 -1
- data/spec/unit/type/file/mtime_spec.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f612935e7227f22090b17a09b8028ebb922a058dc07e178b488d15fc7a4752e
|
4
|
+
data.tar.gz: e40ee61974f8f663f5b0323afc43bd3af34379ea36b1fb5bb5d281ee3ec5ecaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7860cc4f8c678d7665ae576f1bd955fb2a95cc353a8c8881ca09a50dd073832a1060b4e65deac289f8886583a3c702507c7b45de783f9563c7176e12e915b07a
|
7
|
+
data.tar.gz: 46263dbea786c3cc662a16a030a623d037dfaf4da1fde47cb55e1fec7960f8272c79ea3cda1e7cee16e77f776e64c36296f06e092356e1975b5706dbae094be6
|
data/CODEOWNERS
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# defaults
|
2
|
-
* @puppetlabs/phoenix
|
2
|
+
* @puppetlabs/phoenix
|
3
3
|
|
4
4
|
# PAL
|
5
5
|
/lib/puppet/pal @puppetlabs/bolt
|
6
6
|
|
7
7
|
# puppet module
|
8
|
-
/lib/puppet/application/module.rb @puppetlabs/
|
9
|
-
/lib/puppet/face/module @puppetlabs/
|
10
|
-
/lib/puppet/forge @puppetlabs/
|
11
|
-
/lib/puppet/module_tool @puppetlabs/
|
8
|
+
/lib/puppet/application/module.rb @puppetlabs/modules
|
9
|
+
/lib/puppet/face/module @puppetlabs/modules
|
10
|
+
/lib/puppet/forge @puppetlabs/modules
|
11
|
+
/lib/puppet/module_tool @puppetlabs/modules
|
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', '
|
50
|
-
gem 'rubocop-i18n', '~>
|
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:
|
3
|
+
revision: 87a3396077f06e2341ad19e6fcd15f7c14ec02f9
|
4
4
|
branch: 1.0.x
|
5
5
|
specs:
|
6
|
-
packaging (0
|
6
|
+
packaging (0)
|
7
7
|
apt_stage_artifacts
|
8
8
|
artifactory (~> 3)
|
9
|
-
csv (
|
9
|
+
csv (>= 3.1.5)
|
10
10
|
google-cloud-storage
|
11
11
|
googleauth
|
12
12
|
rake (>= 12.3)
|
@@ -15,9 +15,9 @@ GIT
|
|
15
15
|
PATH
|
16
16
|
remote: .
|
17
17
|
specs:
|
18
|
-
puppet (7.
|
18
|
+
puppet (7.25.0)
|
19
19
|
CFPropertyList (~> 2.2)
|
20
|
-
concurrent-ruby (~> 1.0
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
21
|
deep_merge (~> 1.0)
|
22
22
|
facter (>= 2.4.0, < 5)
|
23
23
|
fast_gettext (>= 1.1, < 3)
|
@@ -31,27 +31,27 @@ 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.
|
34
|
+
addressable (2.8.4)
|
35
35
|
public_suffix (>= 2.0.2, < 6.0)
|
36
36
|
apt_stage_artifacts (0.11.0)
|
37
37
|
docopt
|
38
38
|
artifactory (3.0.15)
|
39
39
|
ast (2.4.2)
|
40
40
|
coderay (1.1.3)
|
41
|
-
concurrent-ruby (1.
|
41
|
+
concurrent-ruby (1.2.2)
|
42
42
|
crack (0.4.5)
|
43
43
|
rexml
|
44
|
-
csv (3.
|
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.
|
51
|
+
facter (4.4.0)
|
52
52
|
hocon (~> 1.3)
|
53
53
|
thor (>= 1.0.1, < 2.0)
|
54
|
-
faraday (2.7.
|
54
|
+
faraday (2.7.6)
|
55
55
|
faraday-net_http (>= 2.0, < 3.1)
|
56
56
|
ruby2_keywords (>= 0.0.4)
|
57
57
|
faraday-net_http (3.0.2)
|
@@ -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.
|
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.
|
77
|
-
google-apis-core (>= 0.
|
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.
|
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.
|
94
|
+
googleauth (1.5.2)
|
95
95
|
faraday (>= 0.17.3, < 3.a)
|
96
96
|
jwt (>= 1.4, < 3.0)
|
97
97
|
memoist (~> 0.16)
|
@@ -99,46 +99,46 @@ GEM
|
|
99
99
|
os (>= 0.9, < 2.0)
|
100
100
|
signet (>= 0.16, < 2.a)
|
101
101
|
hashdiff (1.0.1)
|
102
|
-
hiera (3.
|
103
|
-
hiera-eyaml (3.
|
102
|
+
hiera (3.12.0)
|
103
|
+
hiera-eyaml (3.4.0)
|
104
104
|
highline
|
105
105
|
optimist
|
106
106
|
highline (2.1.0)
|
107
|
-
hocon (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)
|
111
111
|
addressable (>= 2.4)
|
112
|
-
jwt (2.7.
|
112
|
+
jwt (2.7.1)
|
113
113
|
locale (2.1.3)
|
114
114
|
memoist (0.16.2)
|
115
115
|
memory_profiler (1.0.1)
|
116
116
|
method_source (1.0.0)
|
117
117
|
mini_mime (1.1.2)
|
118
118
|
minitar (0.9)
|
119
|
-
msgpack (1.
|
119
|
+
msgpack (1.7.1)
|
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
|
-
parallel (1.
|
125
|
-
parser (2.
|
124
|
+
parallel (1.23.0)
|
125
|
+
parser (3.2.2.3)
|
126
126
|
ast (~> 2.4.1)
|
127
|
-
|
127
|
+
racc
|
128
128
|
pry (0.14.2)
|
129
129
|
coderay (~> 1.1)
|
130
130
|
method_source (~> 1.0)
|
131
131
|
public_suffix (5.0.1)
|
132
132
|
puppet-resource_api (1.8.14)
|
133
133
|
hocon (>= 1.0)
|
134
|
-
puppetserver-ca (2.
|
134
|
+
puppetserver-ca (2.6.0)
|
135
135
|
facter (>= 2.0.1, < 5)
|
136
136
|
racc (1.5.2)
|
137
|
-
rainbow (
|
138
|
-
rake
|
137
|
+
rainbow (3.1.1)
|
139
138
|
rake (13.0.6)
|
140
139
|
rdiscount (2.2.7)
|
141
140
|
rdoc (6.3.3)
|
141
|
+
regexp_parser (2.8.1)
|
142
142
|
release-metrics (1.1.0)
|
143
143
|
csv
|
144
144
|
docopt
|
@@ -156,50 +156,53 @@ GEM
|
|
156
156
|
rspec-core (~> 3.12.0)
|
157
157
|
rspec-expectations (~> 3.12.0)
|
158
158
|
rspec-mocks (~> 3.12.0)
|
159
|
-
rspec-core (3.12.
|
159
|
+
rspec-core (3.12.2)
|
160
160
|
rspec-support (~> 3.12.0)
|
161
|
-
rspec-expectations (3.12.
|
161
|
+
rspec-expectations (3.12.3)
|
162
162
|
diff-lcs (>= 1.2.0, < 2.0)
|
163
163
|
rspec-support (~> 3.12.0)
|
164
164
|
rspec-its (1.3.0)
|
165
165
|
rspec-core (>= 3.0.0)
|
166
166
|
rspec-expectations (>= 3.0.0)
|
167
|
-
rspec-mocks (3.12.
|
167
|
+
rspec-mocks (3.12.5)
|
168
168
|
diff-lcs (>= 1.2.0, < 2.0)
|
169
169
|
rspec-support (~> 3.12.0)
|
170
170
|
rspec-support (3.12.0)
|
171
|
-
rubocop (
|
171
|
+
rubocop (1.28.0)
|
172
172
|
parallel (~> 1.10)
|
173
|
-
parser (>=
|
174
|
-
|
175
|
-
|
173
|
+
parser (>= 3.1.0.0)
|
174
|
+
rainbow (>= 2.2.2, < 4.0)
|
175
|
+
regexp_parser (>= 1.8, < 3.0)
|
176
|
+
rexml
|
177
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
176
178
|
ruby-progressbar (~> 1.7)
|
177
|
-
unicode-display_width (
|
178
|
-
rubocop-
|
179
|
-
|
180
|
-
|
181
|
-
|
179
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
180
|
+
rubocop-ast (1.29.0)
|
181
|
+
parser (>= 3.2.1.0)
|
182
|
+
rubocop-i18n (3.0.0)
|
183
|
+
rubocop (~> 1.0)
|
184
|
+
ruby-prof (1.6.3)
|
185
|
+
ruby-progressbar (1.13.0)
|
182
186
|
ruby2_keywords (0.0.5)
|
183
187
|
scanf (1.0.0)
|
184
|
-
semantic_puppet (1.0
|
188
|
+
semantic_puppet (1.1.0)
|
185
189
|
signet (0.17.0)
|
186
190
|
addressable (~> 2.8)
|
187
191
|
faraday (>= 0.17.5, < 3.a)
|
188
192
|
jwt (>= 1.5, < 3.0)
|
189
193
|
multi_json (~> 1.10)
|
190
194
|
text (1.3.1)
|
191
|
-
thor (1.2.
|
195
|
+
thor (1.2.2)
|
192
196
|
trailblazer-option (0.1.2)
|
193
197
|
uber (0.1.0)
|
194
|
-
unicode-display_width (
|
198
|
+
unicode-display_width (2.4.2)
|
195
199
|
vcr (5.1.0)
|
196
200
|
webmock (3.18.1)
|
197
201
|
addressable (>= 2.8.0)
|
198
202
|
crack (>= 0.3.2)
|
199
203
|
hashdiff (>= 0.4.0, < 2.0.0)
|
200
|
-
webrick (1.
|
201
|
-
yard (0.9.
|
202
|
-
webrick (~> 1.7.0)
|
204
|
+
webrick (1.8.1)
|
205
|
+
yard (0.9.34)
|
203
206
|
|
204
207
|
PLATFORMS
|
205
208
|
x86_64-linux
|
@@ -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 (
|
230
|
-
rubocop-i18n (~>
|
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)
|
@@ -235,4 +238,4 @@ DEPENDENCIES
|
|
235
238
|
yard
|
236
239
|
|
237
240
|
BUNDLED WITH
|
238
|
-
2.
|
241
|
+
2.4.12
|
data/ext/project_data.yaml
CHANGED
@@ -27,7 +27,8 @@ class Puppet::Application::FaceBase < Puppet::Application
|
|
27
27
|
exit(0)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
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)
|
data/lib/puppet/defaults.rb
CHANGED
@@ -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,
|
@@ -1698,6 +1711,15 @@ EOT
|
|
1698
1711
|
can be guaranteed to support this format, but it will be used for all
|
1699
1712
|
classes that support it.",
|
1700
1713
|
},
|
1714
|
+
:allow_pson_serialization => {
|
1715
|
+
:default => true,
|
1716
|
+
:type => :boolean,
|
1717
|
+
:desc => "Whether when unable to serialize to JSON or other formats,
|
1718
|
+
Puppet falls back to PSON. This option affects both puppetserver's
|
1719
|
+
configuration management service responses and when the agent saves its
|
1720
|
+
cached catalog. This option is useful in preventing the loss of data because
|
1721
|
+
rich data cannot be serialized via PSON.",
|
1722
|
+
},
|
1701
1723
|
:agent_catalog_run_lockfile => {
|
1702
1724
|
:default => "$statedir/agent_catalog_run.lock",
|
1703
1725
|
:type => :string, # (#2888) Ensure this file is not added to the settings catalog.
|
data/lib/puppet/environments.rb
CHANGED
@@ -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.
|
122
|
-
yield(
|
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.
|
134
|
-
yield(*
|
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
|
-
|
145
|
-
|
146
|
-
|
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
|
-
|
159
|
-
|
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
|
-
|
113
|
-
|
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 {
|
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
|
-
|
133
|
-
|
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
|
data/lib/puppet/functions/map.rb
CHANGED
@@ -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.
|
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.
|
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
|
-
|
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
|
-
|
126
|
-
|
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
|
@@ -18,9 +18,14 @@ class Puppet::Resource::Catalog::Json < Puppet::Indirector::JSON
|
|
18
18
|
def to_json(object)
|
19
19
|
object.render(json_format)
|
20
20
|
rescue Puppet::Network::FormatHandler::FormatError => err
|
21
|
-
Puppet
|
22
|
-
|
23
|
-
|
21
|
+
if Puppet[:allow_pson_serialization]
|
22
|
+
Puppet.info(_("Unable to serialize catalog to json, retrying with pson. PSON is deprecated and will be removed in a future release"))
|
23
|
+
Puppet.log_exception(err, err.message, level: :debug)
|
24
|
+
object.render('pson').force_encoding(Encoding::BINARY)
|
25
|
+
else
|
26
|
+
Puppet.info(_("Unable to serialize catalog to json, no other acceptable format"))
|
27
|
+
Puppet.log_exception(err, err.message, level: :err)
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
private
|
@@ -141,7 +141,7 @@ class Puppet::Interface::Action
|
|
141
141
|
|
142
142
|
# @api private
|
143
143
|
# @return [Symbol]
|
144
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
data/lib/puppet/module/plan.rb
CHANGED
@@ -104,7 +104,7 @@ class Puppet::Module
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
attr_reader :name, :module, :metadata_file
|
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)
|
data/lib/puppet/module/task.rb
CHANGED
@@ -215,7 +215,7 @@ class Puppet::Module
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
attr_reader :name, :module, :metadata_file
|
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
|
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,20 @@ 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
|
-
|
195
|
+
msg = _("Failed to serialize %{model} for '%{key}': %{detail}") %
|
196
|
+
{model: model, key: key, detail: err}
|
197
|
+
if Puppet[:allow_pson_serialization]
|
198
|
+
Puppet.warning(msg)
|
199
|
+
else
|
200
|
+
raise Puppet::Network::FormatHandler::FormatError.new(msg)
|
201
|
+
end
|
196
202
|
false
|
197
203
|
end
|
198
204
|
end
|