puppet 5.3.3-x64-mingw32 → 5.3.4-x64-mingw32
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.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +3 -0
- data/ext/puppet-test +3 -2
- data/lib/hiera/puppet_function.rb +5 -2
- data/lib/hiera_puppet.rb +3 -3
- data/lib/puppet.rb +2 -5
- data/lib/puppet/agent.rb +22 -2
- data/lib/puppet/agent/locker.rb +6 -5
- data/lib/puppet/application.rb +18 -1
- data/lib/puppet/application/agent.rb +9 -2
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/config.rb +1 -0
- data/lib/puppet/application/device.rb +1 -2
- data/lib/puppet/application/filebucket.rb +22 -5
- data/lib/puppet/application/help.rb +1 -0
- data/lib/puppet/application/lookup.rb +1 -3
- data/lib/puppet/application_support.rb +6 -1
- data/lib/puppet/bindings.rb +2 -1
- data/lib/puppet/configurer.rb +9 -4
- data/lib/puppet/configurer/downloader_factory.rb +10 -0
- data/lib/puppet/configurer/plugin_handler.rb +11 -4
- data/lib/puppet/daemon.rb +2 -2
- data/lib/puppet/defaults.rb +99 -27
- data/lib/puppet/environments.rb +2 -0
- data/lib/puppet/error.rb +5 -15
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/config.rb +14 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +12 -14
- data/lib/puppet/face/man.rb +1 -0
- data/lib/puppet/face/module/build.rb +1 -1
- data/lib/puppet/face/module/list.rb +6 -17
- data/lib/puppet/face/module/uninstall.rb +14 -3
- data/lib/puppet/face/node.rb +1 -0
- data/lib/puppet/face/status.rb +1 -0
- data/lib/puppet/file_serving/base.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +3 -0
- data/lib/puppet/file_serving/configuration/parser.rb +23 -9
- data/lib/puppet/file_serving/mount/locales.rb +35 -0
- data/lib/puppet/forge.rb +2 -1
- data/lib/puppet/forge/errors.rb +24 -22
- data/lib/puppet/functions/binary_file.rb +1 -0
- data/lib/puppet/functions/each.rb +10 -4
- data/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/lib/puppet/functions/lookup.rb +2 -2
- data/lib/puppet/functions/map.rb +12 -2
- data/lib/puppet/functions/slice.rb +2 -3
- data/lib/puppet/functions/unique.rb +1 -1
- data/lib/puppet/functions/yaml_data.rb +1 -1
- data/lib/puppet/gettext/config.rb +144 -41
- data/lib/puppet/gettext/module_translations.rb +42 -0
- data/lib/puppet/graph/relationship_graph.rb +1 -1
- data/lib/puppet/graph/simple_graph.rb +3 -3
- data/lib/puppet/indirector/catalog/compiler.rb +40 -25
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +3 -3
- data/lib/puppet/indirector/facts/network_device.rb +2 -2
- data/lib/puppet/indirector/file_bucket_file/file.rb +4 -1
- data/lib/puppet/indirector/indirection.rb +17 -9
- data/lib/puppet/indirector/ldap.rb +2 -2
- data/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
- data/lib/puppet/indirector/rest.rb +8 -5
- data/lib/puppet/indirector/ssl_file.rb +2 -2
- data/lib/puppet/indirector/terminus.rb +3 -3
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +41 -24
- data/lib/puppet/interface/action_builder.rb +14 -5
- data/lib/puppet/interface/action_manager.rb +1 -1
- data/lib/puppet/interface/documentation.rb +21 -10
- data/lib/puppet/interface/face_collection.rb +4 -2
- data/lib/puppet/interface/option.rb +36 -15
- data/lib/puppet/interface/option_builder.rb +23 -9
- data/lib/puppet/interface/option_manager.rb +8 -3
- data/lib/puppet/metatype/manager.rb +7 -3
- data/lib/puppet/module.rb +18 -21
- data/lib/puppet/module_tool/errors/installer.rb +18 -20
- data/lib/puppet/module_tool/errors/shared.rb +20 -15
- data/lib/puppet/module_tool/errors/uninstaller.rb +1 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/tar/mini.rb +57 -4
- data/lib/puppet/network/auth_config_parser.rb +18 -13
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/client_request.rb +1 -1
- data/lib/puppet/network/format.rb +3 -3
- data/lib/puppet/network/http/api/indirection_type.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
- data/lib/puppet/network/http/error.rb +7 -7
- data/lib/puppet/network/http/factory.rb +9 -0
- data/lib/puppet/network/http/rack.rb +2 -2
- data/lib/puppet/network/http/webrick.rb +2 -4
- data/lib/puppet/node.rb +25 -6
- data/lib/puppet/node/environment.rb +14 -0
- data/lib/puppet/node/facts.rb +9 -0
- data/lib/puppet/parameter.rb +3 -3
- data/lib/puppet/parameter/value_collection.rb +9 -9
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/ast/node.rb +2 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
- data/lib/puppet/parser/compiler.rb +6 -5
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +2 -4
- data/lib/puppet/parser/functions/inline_template.rb +1 -2
- data/lib/puppet/parser/functions/sprintf.rb +17 -3
- data/lib/puppet/parser/functions/template.rb +6 -2
- data/lib/puppet/parser/resource.rb +30 -31
- data/lib/puppet/parser/scope.rb +20 -11
- data/lib/puppet/parser/templatewrapper.rb +4 -3
- data/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/lib/puppet/pops/functions/function.rb +8 -2
- data/lib/puppet/pops/issue_reporter.rb +7 -2
- data/lib/puppet/pops/issues.rb +10 -4
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/loader/module_loaders.rb +5 -2
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/loaders.rb +7 -3
- data/lib/puppet/pops/lookup/explainer.rb +2 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
- data/lib/puppet/pops/lookup/lookup_adapter.rb +4 -4
- data/lib/puppet/pops/merge_strategy.rb +6 -3
- data/lib/puppet/pops/migration/migration_checker.rb +8 -8
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
- data/lib/puppet/pops/types/iterable.rb +2 -0
- data/lib/puppet/pops/types/p_object_type.rb +36 -15
- data/lib/puppet/pops/types/type_calculator.rb +2 -1
- data/lib/puppet/pops/types/type_factory.rb +3 -1
- data/lib/puppet/pops/types/type_mismatch_describer.rb +19 -6
- data/lib/puppet/pops/types/type_parser.rb +7 -7
- data/lib/puppet/pops/types/types.rb +10 -4
- data/lib/puppet/pops/validation.rb +14 -12
- data/lib/puppet/property.rb +14 -6
- data/lib/puppet/property/ensure.rb +2 -2
- data/lib/puppet/provider.rb +4 -4
- data/lib/puppet/provider/group/aix.rb +4 -2
- data/lib/puppet/provider/ldap.rb +2 -2
- data/lib/puppet/provider/naginator.rb +1 -1
- data/lib/puppet/provider/nameservice.rb +7 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +7 -8
- data/lib/puppet/provider/package/opkg.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +9 -6
- data/lib/puppet/provider/package/pkgutil.rb +3 -3
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/parsedfile.rb +4 -4
- data/lib/puppet/provider/selmodule/semodule.rb +5 -3
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/init.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +1 -0
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +13 -6
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -1
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +4 -2
- data/lib/puppet/relationship.rb +2 -1
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/resource.rb +7 -5
- data/lib/puppet/resource/capability_finder.rb +14 -11
- data/lib/puppet/resource/catalog.rb +33 -18
- data/lib/puppet/resource/type.rb +5 -5
- data/lib/puppet/settings.rb +19 -13
- data/lib/puppet/settings/base_setting.rb +23 -8
- data/lib/puppet/settings/config_file.rb +14 -4
- data/lib/puppet/settings/environment_conf.rb +19 -9
- data/lib/puppet/ssl/base.rb +9 -4
- data/lib/puppet/ssl/oids.rb +8 -2
- data/lib/puppet/syntax_checkers/base64.rb +5 -6
- data/lib/puppet/transaction.rb +7 -3
- data/lib/puppet/transaction/persistence.rb +16 -1
- data/lib/puppet/transaction/report.rb +6 -0
- data/lib/puppet/type.rb +27 -35
- data/lib/puppet/type/file.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/group.rb +1 -1
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/schedule.rb +26 -14
- data/lib/puppet/type/user.rb +9 -3
- data/lib/puppet/type/zone.rb +1 -1
- data/lib/puppet/util.rb +27 -21
- data/lib/puppet/util/at_fork/solaris.rb +6 -4
- data/lib/puppet/util/command_line.rb +5 -0
- data/lib/puppet/util/command_line/trollop.rb +6 -5
- data/lib/puppet/util/errors.rb +61 -8
- data/lib/puppet/util/fileparsing.rb +3 -5
- data/lib/puppet/util/http_proxy.rb +14 -6
- data/lib/puppet/util/instance_loader.rb +1 -3
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +19 -24
- data/lib/puppet/util/logging.rb +21 -28
- data/lib/puppet/util/methodhelper.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +21 -13
- data/lib/puppet/util/plist.rb +3 -1
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/lib/puppet/util/reference.rb +2 -3
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/storage.rb +2 -2
- data/lib/puppet/util/windows/eventlog.rb +10 -5
- data/lib/puppet/util/windows/file.rb +61 -9
- data/lib/puppet/util/windows/process.rb +1 -1
- data/lib/puppet/util/windows/taskscheduler.rb +2 -2
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/en/puppet.po +19 -0
- data/locales/ja/puppet.po +2739 -809
- data/locales/puppet.pot +2367 -734
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
- data/spec/integration/agent/logging_spec.rb +2 -0
- data/spec/integration/faces/plugin_spec.rb +1 -0
- data/spec/integration/network/authconfig_spec.rb +2 -2
- data/spec/integration/parser/collection_spec.rb +2 -2
- data/spec/integration/parser/scope_spec.rb +16 -3
- data/spec/integration/provider/cron/crontab_spec.rb +1 -0
- data/spec/integration/transaction/report_spec.rb +5 -0
- data/spec/lib/matchers/json.rb +14 -13
- data/spec/unit/agent_spec.rb +33 -0
- data/spec/unit/application/config_spec.rb +4 -0
- data/spec/unit/application/lookup_spec.rb +30 -0
- data/spec/unit/application_spec.rb +18 -0
- data/spec/unit/configurer/downloader_factory_spec.rb +33 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +71 -16
- data/spec/unit/environments_spec.rb +15 -0
- data/spec/unit/face/config_spec.rb +8 -9
- data/spec/unit/face/epp_face_spec.rb +2 -2
- data/spec/unit/face/plugin_spec.rb +50 -4
- data/spec/unit/file_serving/configuration/parser_spec.rb +2 -2
- data/spec/unit/file_serving/mount/locales_spec.rb +73 -0
- data/spec/unit/functions/break_spec.rb +108 -50
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/hiera_spec.rb +0 -1
- data/spec/unit/functions/lookup_spec.rb +85 -19
- data/spec/unit/functions/next_spec.rb +1 -1
- data/spec/unit/functions/return_spec.rb +2 -2
- data/spec/unit/gettext/config_spec.rb +125 -0
- data/spec/unit/gettext/module_loading_spec.rb +53 -0
- data/spec/unit/indirector/json_spec.rb +0 -11
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +1 -1
- data/spec/unit/interface_spec.rb +12 -0
- data/spec/unit/module_spec.rb +0 -28
- data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
- data/spec/unit/network/http/factory_spec.rb +22 -0
- data/spec/unit/network/http/webrick_spec.rb +30 -29
- data/spec/unit/node/environment_spec.rb +16 -0
- data/spec/unit/node_spec.rb +102 -16
- data/spec/unit/parser/environment_compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
- data/spec/unit/parser/resource/param_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +9 -9
- data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_containers_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
- data/spec/unit/provider/selmodule_spec.rb +6 -0
- data/spec/unit/provider/service/init_spec.rb +1 -1
- data/spec/unit/provider/service/smf_spec.rb +2 -0
- data/spec/unit/provider/service/systemd_spec.rb +14 -0
- data/spec/unit/resource/catalog_spec.rb +12 -2
- data/spec/unit/settings/config_file_spec.rb +1 -1
- data/spec/unit/transaction/persistence_spec.rb +42 -0
- data/spec/unit/transaction/report_spec.rb +19 -4
- data/spec/unit/transaction_spec.rb +27 -0
- data/spec/unit/type/schedule_spec.rb +14 -0
- data/spec/unit/type_spec.rb +3 -3
- data/spec/unit/util/errors_spec.rb +1 -1
- data/spec/unit/util/http_proxy_spec.rb +37 -0
- data/spec/unit/util/log_spec.rb +3 -3
- data/spec/unit/util/logging_spec.rb +7 -7
- data/spec/unit/util/monkey_patches_spec.rb +6 -2
- metadata +3445 -3416
- checksums.yaml +0 -7
- data/spec/unit/gettext_config_spec.rb +0 -57
@@ -268,11 +268,11 @@ describe "the 'defined' function" do
|
|
268
268
|
end
|
269
269
|
|
270
270
|
it 'raises error if referencing undef' do
|
271
|
-
expect{func.call(@scope, nil)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String or Type, got Undef/)
|
271
|
+
expect{func.call(@scope, nil)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String, Type\[CatalogEntry\], or Type\[Type\], got Undef/)
|
272
272
|
end
|
273
273
|
|
274
274
|
it 'raises error if referencing a number' do
|
275
|
-
expect{func.call(@scope, 42)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String or Type, got Integer/)
|
275
|
+
expect{func.call(@scope, 42)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String, Type\[CatalogEntry\], or Type\[Type\], got Integer/)
|
276
276
|
end
|
277
277
|
|
278
278
|
it 'is false if referencing empty string' do
|
@@ -182,7 +182,6 @@ describe 'when calling' do
|
|
182
182
|
result = nil
|
183
183
|
Puppet[:code] = 'undef'
|
184
184
|
Puppet::Util::Log.with_destination(Puppet::Test::LogCollector.new(logs)) do
|
185
|
-
compiler.topscope['environment'] = 'test'
|
186
185
|
compiler.compile do |catalog|
|
187
186
|
result = yield(compiler.topscope)
|
188
187
|
catalog
|
@@ -96,7 +96,6 @@ describe "The lookup function" do
|
|
96
96
|
Puppet[:code] = code
|
97
97
|
Puppet::Util::Log.with_destination(Puppet::Test::LogCollector.new(logs)) do
|
98
98
|
scope = compiler.topscope
|
99
|
-
scope['environment'] = env_name
|
100
99
|
scope['domain'] = 'example.com'
|
101
100
|
scope_additions.each_pair { |k, v| scope[k] = v }
|
102
101
|
if explain
|
@@ -168,7 +167,7 @@ describe "The lookup function" do
|
|
168
167
|
YAML
|
169
168
|
|
170
169
|
it 'fails and reports error' do
|
171
|
-
expect { lookup('a') }.to raise_error("This runtime does not support hiera.yaml version 6
|
170
|
+
expect { lookup('a') }.to raise_error("This runtime does not support hiera.yaml version 6 (file: #{code_dir}/hiera.yaml)")
|
172
171
|
end
|
173
172
|
end
|
174
173
|
|
@@ -183,7 +182,7 @@ describe "The lookup function" do
|
|
183
182
|
|
184
183
|
it 'fails and reports error' do
|
185
184
|
expect { lookup('a') }.to raise_error(
|
186
|
-
"Backend 'yaml' is defined more than once. First defined at line 3
|
185
|
+
"Backend 'yaml' is defined more than once. First defined at (line: 3) (file: #{code_dir}/hiera.yaml, line: 5)")
|
187
186
|
end
|
188
187
|
end
|
189
188
|
|
@@ -194,7 +193,7 @@ describe "The lookup function" do
|
|
194
193
|
|
195
194
|
it 'fails and reports error' do
|
196
195
|
expect { lookup('a') }.to raise_error(
|
197
|
-
"hiera.yaml version 4 cannot be used in the global layer
|
196
|
+
"hiera.yaml version 4 cannot be used in the global layer (file: #{code_dir}/hiera.yaml)")
|
198
197
|
end
|
199
198
|
end
|
200
199
|
|
@@ -213,7 +212,7 @@ describe "The lookup function" do
|
|
213
212
|
|
214
213
|
it 'fails and reports error' do
|
215
214
|
expect { lookup('a') }.to raise_error(
|
216
|
-
"Hierarchy name 'Common' defined more than once. First defined at line 3
|
215
|
+
"Hierarchy name 'Common' defined more than once. First defined at (line: 3) (file: #{code_dir}/hiera.yaml, line: 7)")
|
217
216
|
end
|
218
217
|
end
|
219
218
|
|
@@ -228,7 +227,7 @@ describe "The lookup function" do
|
|
228
227
|
|
229
228
|
it 'fails and reports error' do
|
230
229
|
expect { lookup('a') }.to raise_error(
|
231
|
-
"Use \"data_hash: hocon_data\" instead of \"hiera3_backend: hocon\"
|
230
|
+
"Use \"data_hash: hocon_data\" instead of \"hiera3_backend: hocon\" (file: #{code_dir}/hiera.yaml, line: 4)")
|
232
231
|
end
|
233
232
|
end
|
234
233
|
|
@@ -244,7 +243,7 @@ describe "The lookup function" do
|
|
244
243
|
|
245
244
|
it 'fails and reports error' do
|
246
245
|
expect { lookup('a') }.to raise_error(
|
247
|
-
"One of data_hash, lookup_key, data_dig, or hiera3_backend must be defined in hierarchy 'Common'
|
246
|
+
"One of data_hash, lookup_key, data_dig, or hiera3_backend must be defined in hierarchy 'Common' (file: #{code_dir}/hiera.yaml)")
|
248
247
|
end
|
249
248
|
end
|
250
249
|
|
@@ -262,7 +261,7 @@ describe "The lookup function" do
|
|
262
261
|
|
263
262
|
it 'fails and reports error' do
|
264
263
|
expect { lookup('a') }.to raise_error(
|
265
|
-
"Only one of data_hash, lookup_key, data_dig, or hiera3_backend can be defined in defaults
|
264
|
+
"Only one of data_hash, lookup_key, data_dig, or hiera3_backend can be defined in defaults (file: #{code_dir}/hiera.yaml)")
|
266
265
|
end
|
267
266
|
end
|
268
267
|
|
@@ -278,7 +277,7 @@ describe "The lookup function" do
|
|
278
277
|
it 'fails and reports error' do
|
279
278
|
Puppet[:strict] = :error
|
280
279
|
expect { lookup('a') }.to raise_error(
|
281
|
-
"Unable to find 'data_hash' function named 'nonesuch_txt_data'
|
280
|
+
"Unable to find 'data_hash' function named 'nonesuch_txt_data' (file: #{code_dir}/hiera.yaml)")
|
282
281
|
end
|
283
282
|
end
|
284
283
|
|
@@ -296,7 +295,7 @@ describe "The lookup function" do
|
|
296
295
|
it 'fails and reports error' do
|
297
296
|
Puppet[:strict] = :error
|
298
297
|
expect { lookup('a') }.to raise_error(
|
299
|
-
"'default_hierarchy' is only allowed in the module layer
|
298
|
+
"'default_hierarchy' is only allowed in the module layer (file: #{code_dir}/hiera.yaml, line: 5)")
|
300
299
|
end
|
301
300
|
end
|
302
301
|
|
@@ -311,7 +310,7 @@ describe "The lookup function" do
|
|
311
310
|
|
312
311
|
it 'fails and reports errors when strict == error' do
|
313
312
|
Puppet[:strict] = :error
|
314
|
-
expect { lookup('a') }.to raise_error("Undefined variable '::nonesuch'
|
313
|
+
expect { lookup('a') }.to raise_error("Undefined variable '::nonesuch' (file: #{code_dir}/hiera.yaml, line: 4)")
|
315
314
|
end
|
316
315
|
end
|
317
316
|
|
@@ -325,7 +324,7 @@ describe "The lookup function" do
|
|
325
324
|
|
326
325
|
it 'fails and reports errors when strict == error' do
|
327
326
|
Puppet[:strict] = :error
|
328
|
-
expect { lookup('a') }.to raise_error("Interpolation using method syntax is not allowed in this context
|
327
|
+
expect { lookup('a') }.to raise_error("Interpolation using method syntax is not allowed in this context (file: #{code_dir}/hiera.yaml)")
|
329
328
|
end
|
330
329
|
end
|
331
330
|
end
|
@@ -344,7 +343,7 @@ describe "The lookup function" do
|
|
344
343
|
|
345
344
|
it 'fails and reports error' do
|
346
345
|
expect { lookup('a') }.to raise_error(
|
347
|
-
"No data provider is registered for backend 'nonesuch'
|
346
|
+
"No data provider is registered for backend 'nonesuch' (file: #{env_dir}/spec/hiera.yaml, line: 4)")
|
348
347
|
end
|
349
348
|
end
|
350
349
|
|
@@ -365,7 +364,7 @@ describe "The lookup function" do
|
|
365
364
|
|
366
365
|
it 'fails and reports error' do
|
367
366
|
expect { lookup('a') }.to raise_error(
|
368
|
-
"Hierarchy name 'Common' defined more than once. First defined at line 3
|
367
|
+
"Hierarchy name 'Common' defined more than once. First defined at (line: 3) (file: #{env_dir}/spec/hiera.yaml, line: 9)")
|
369
368
|
end
|
370
369
|
end
|
371
370
|
end
|
@@ -381,7 +380,7 @@ describe "The lookup function" do
|
|
381
380
|
|
382
381
|
it 'fails and reports error' do
|
383
382
|
expect { lookup('a') }.to raise_error(
|
384
|
-
"'hiera3_backend' is only allowed in the global layer
|
383
|
+
"'hiera3_backend' is only allowed in the global layer (file: #{env_dir}/spec/hiera.yaml, line: 4)")
|
385
384
|
end
|
386
385
|
end
|
387
386
|
|
@@ -399,7 +398,7 @@ describe "The lookup function" do
|
|
399
398
|
it 'fails and reports error' do
|
400
399
|
Puppet[:strict] = :error
|
401
400
|
expect { lookup('a') }.to raise_error(
|
402
|
-
"'default_hierarchy' is only allowed in the module layer
|
401
|
+
"'default_hierarchy' is only allowed in the module layer (file: #{env_dir}/spec/hiera.yaml, line: 5)")
|
403
402
|
end
|
404
403
|
end
|
405
404
|
end
|
@@ -1102,14 +1101,81 @@ describe "The lookup function" do
|
|
1102
1101
|
glob_c: value glob_a
|
1103
1102
|
YAML
|
1104
1103
|
'b.yaml' => <<-YAML.unindent
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1104
|
+
glob_d:
|
1105
|
+
a: value glob_d.a
|
1106
|
+
b: value glob_d.b
|
1108
1107
|
YAML
|
1109
1108
|
|
1110
1109
|
}
|
1111
1110
|
}
|
1112
1111
|
end
|
1112
|
+
|
1113
|
+
it 'finds environment data using globs' do
|
1114
|
+
expect(lookup('glob_a')).to eql('value glob_a')
|
1115
|
+
expect(warnings).to be_empty
|
1116
|
+
end
|
1117
|
+
|
1118
|
+
it 'finds environment data using interpolated globs' do
|
1119
|
+
expect(lookup('glob_d.a')).to eql('value glob_d.a')
|
1120
|
+
expect(warnings).to be_empty
|
1121
|
+
end
|
1122
|
+
end
|
1123
|
+
|
1124
|
+
context 'and an environment Hiera v5 configuration using uris' do
|
1125
|
+
let(:env_hiera_yaml) do
|
1126
|
+
<<-YAML.unindent
|
1127
|
+
---
|
1128
|
+
version: 5
|
1129
|
+
hierarchy:
|
1130
|
+
- name: Uris
|
1131
|
+
uris:
|
1132
|
+
- "http://test.example.com"
|
1133
|
+
- "/some/arbitrary/path"
|
1134
|
+
- "urn:with:opaque:path"
|
1135
|
+
- "dothis%20-f%20bar"
|
1136
|
+
data_hash: mod::uri_test_func
|
1137
|
+
YAML
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
let(:env_modules) do
|
1141
|
+
{
|
1142
|
+
'mod' => { 'lib' => { 'puppet' => { 'functions' => { 'mod' => { 'uri_test_func.rb' => <<-RUBY } } } } }
|
1143
|
+
Puppet::Functions.create_function(:'mod::uri_test_func') do
|
1144
|
+
dispatch :uri_test_func do
|
1145
|
+
param 'Hash', :options
|
1146
|
+
param 'Puppet::LookupContext', :context
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
def uri_test_func(options, context)
|
1150
|
+
{ 'uri' => [ options['uri'] ] }
|
1151
|
+
end
|
1152
|
+
end
|
1153
|
+
RUBY
|
1154
|
+
}
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
it 'The uris are propagated in the options hash' do
|
1158
|
+
expect(lookup('uri', 'merge' => 'unique')).to eql(
|
1159
|
+
%w(http://test.example.com /some/arbitrary/path urn:with:opaque:path dothis%20-f%20bar))
|
1160
|
+
expect(warnings).to be_empty
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
context 'and a uri uses bad syntax' do
|
1164
|
+
let(:env_hiera_yaml) do
|
1165
|
+
<<-YAML.unindent
|
1166
|
+
---
|
1167
|
+
version: 5
|
1168
|
+
hierarchy:
|
1169
|
+
- name: Uris
|
1170
|
+
uri: "dothis -f bar"
|
1171
|
+
data_hash: mod::uri_test_func
|
1172
|
+
YAML
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
it 'an attempt to lookup raises InvalidURIError' do
|
1176
|
+
expect{ lookup('uri', 'merge' => 'unique') }.to raise_error(/bad URI/)
|
1177
|
+
end
|
1178
|
+
end
|
1113
1179
|
end
|
1114
1180
|
|
1115
1181
|
context 'and an environment Hiera v5 configuration using mapped_paths' do
|
@@ -88,6 +88,6 @@ describe 'the next function' do
|
|
88
88
|
# line 2
|
89
89
|
next()
|
90
90
|
CODE
|
91
|
-
end.to raise_error(/next\(\) from context where this is illegal
|
91
|
+
end.to raise_error(/next\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/)
|
92
92
|
end
|
93
93
|
end
|
@@ -90,7 +90,7 @@ describe 'the return function' do
|
|
90
90
|
$result = with(1) |$x| { with($x) |$x| {return(100) }}
|
91
91
|
notice $result
|
92
92
|
CODE
|
93
|
-
end.to raise_error(/return\(\) from context where this is illegal
|
93
|
+
end.to raise_error(/return\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/)
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'can not be called from top scope' do
|
@@ -100,6 +100,6 @@ describe 'the return function' do
|
|
100
100
|
# line 2
|
101
101
|
return()
|
102
102
|
CODE
|
103
|
-
end.to raise_error(/return\(\) from context where this is illegal
|
103
|
+
end.to raise_error(/return\(\) from context where this is illegal \(file: unknown, line: 3\) on node.*/)
|
104
104
|
end
|
105
105
|
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'puppet/gettext/config'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Puppet::GettextConfig do
|
5
|
+
require 'puppet_spec/files'
|
6
|
+
include PuppetSpec::Files
|
7
|
+
include Puppet::GettextConfig
|
8
|
+
|
9
|
+
let(:local_path) do
|
10
|
+
local_path ||= Puppet::GettextConfig::LOCAL_PATH
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:windows_path) do
|
14
|
+
windows_path ||= Puppet::GettextConfig::WINDOWS_PATH
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:posix_path) do
|
18
|
+
windows_path ||= Puppet::GettextConfig::POSIX_PATH
|
19
|
+
end
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
Puppet::GettextConfig.stubs(:gettext_loaded?).returns true
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
Puppet::GettextConfig.set_locale('en')
|
27
|
+
Puppet::GettextConfig.delete_all_text_domains
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'setting and getting the locale' do
|
31
|
+
it 'should return "en" when gettext is unavailable' do
|
32
|
+
Puppet::GettextConfig.stubs(:gettext_loaded?).returns(false)
|
33
|
+
|
34
|
+
expect(Puppet::GettextConfig.current_locale).to eq('en')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should allow the locale to be set' do
|
38
|
+
Puppet::GettextConfig.set_locale('hu')
|
39
|
+
expect(Puppet::GettextConfig.current_locale).to eq('hu')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'translation mode selection' do
|
44
|
+
it 'should select PO mode when given a local config path' do
|
45
|
+
expect(Puppet::GettextConfig.translation_mode(local_path)).to eq(:po)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should select PO mode when given a non-package config path' do
|
49
|
+
expect(Puppet::GettextConfig.translation_mode('../fake/path')).to eq(:po)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should select MO mode when given a Windows package config path' do
|
53
|
+
expect(Puppet::GettextConfig.translation_mode(windows_path)).to eq(:mo)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should select MO mode when given a POSIX package config path' do
|
57
|
+
expect(Puppet::GettextConfig.translation_mode(posix_path)).to eq(:mo)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'loading translations' do
|
62
|
+
context 'when given a nil locale path' do
|
63
|
+
it 'should return false' do
|
64
|
+
expect(Puppet::GettextConfig.load_translations('puppet', nil, :po)).to be false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when given a valid locale file location' do
|
69
|
+
it 'should return true' do
|
70
|
+
Puppet::GettextConfig.expects(:add_repository_to_domain).with('puppet', local_path, :po, anything)
|
71
|
+
|
72
|
+
expect(Puppet::GettextConfig.load_translations('puppet', local_path, :po)).to be true
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'when given a bad file format' do
|
77
|
+
it 'should raise an exception' do
|
78
|
+
expect { Puppet::GettextConfig.load_translations('puppet', local_path, :bad_format) }.to raise_error(Puppet::Error)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "setting up text domains" do
|
84
|
+
it 'can create the default text domain after another is set' do
|
85
|
+
Puppet::GettextConfig.delete_all_text_domains
|
86
|
+
FastGettext.text_domain = 'other'
|
87
|
+
Puppet::GettextConfig.create_default_text_domain
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should add puppet translations to the default text domain' do
|
91
|
+
Puppet::GettextConfig.expects(:load_translations).with('puppet', local_path, :po, Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN).returns(true)
|
92
|
+
|
93
|
+
Puppet::GettextConfig.create_default_text_domain
|
94
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should copy default translations when creating a non-default text domain' do
|
98
|
+
Puppet::GettextConfig.reset_text_domain('test')
|
99
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "deleting text domains" do
|
104
|
+
it 'can delete a text domain by name' do
|
105
|
+
Puppet::GettextConfig.reset_text_domain('test')
|
106
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
|
107
|
+
Puppet::GettextConfig.delete_text_domain(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
|
108
|
+
expect(Puppet::GettextConfig.loaded_text_domains).not_to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'can delete all non-default text domains' do
|
112
|
+
Puppet::GettextConfig.reset_text_domain('test')
|
113
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
|
114
|
+
Puppet::GettextConfig.delete_environment_text_domains
|
115
|
+
expect(Puppet::GettextConfig.loaded_text_domains).not_to include('test')
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'can delete all text domains' do
|
119
|
+
Puppet::GettextConfig.reset_text_domain('test')
|
120
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
|
121
|
+
Puppet::GettextConfig.delete_all_text_domains
|
122
|
+
expect(Puppet::GettextConfig.loaded_text_domains).to be_empty
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet_spec/modules'
|
3
|
+
require 'puppet_spec/files'
|
4
|
+
|
5
|
+
require 'puppet/gettext/module_translations'
|
6
|
+
|
7
|
+
describe Puppet::ModuleTranslations do
|
8
|
+
include PuppetSpec::Files
|
9
|
+
|
10
|
+
describe "loading translations from the module path" do
|
11
|
+
let(:modpath) { tmpdir('modpath') }
|
12
|
+
|
13
|
+
let(:module_a) { PuppetSpec::Modules.create(
|
14
|
+
"mod_a",
|
15
|
+
modpath,
|
16
|
+
:metadata => {
|
17
|
+
:author => 'foo'
|
18
|
+
},
|
19
|
+
:environment => mock("environment"))
|
20
|
+
}
|
21
|
+
|
22
|
+
let(:module_b) { PuppetSpec::Modules.create(
|
23
|
+
"mod_b",
|
24
|
+
modpath,
|
25
|
+
:metadata => {
|
26
|
+
:author => 'foo'
|
27
|
+
},
|
28
|
+
:environment => mock("environment"))
|
29
|
+
}
|
30
|
+
|
31
|
+
it "should attempt to load translations only for modules that have them" do
|
32
|
+
module_a.expects(:has_translations?).returns(false)
|
33
|
+
module_b.expects(:has_translations?).returns(true)
|
34
|
+
Puppet::GettextConfig.expects(:load_translations).with("foo-mod_b", File.join(modpath, "mod_b", "locales"), :po).returns(true)
|
35
|
+
|
36
|
+
Puppet::ModuleTranslations.load_from_modulepath([module_a, module_b])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "loading translations from $vardir" do
|
41
|
+
let(:vardir) {
|
42
|
+
dir_containing("vardir",
|
43
|
+
{ "locales" => { "ja" => { "foo-mod_a.po" => "" } } })
|
44
|
+
}
|
45
|
+
|
46
|
+
it "should attempt to load translations for the current locale" do
|
47
|
+
Puppet::GettextConfig.expects(:current_locale).returns("ja")
|
48
|
+
Puppet::GettextConfig.expects(:load_translations).with("foo-mod_a", File.join(vardir, "locales"), :po).returns(true)
|
49
|
+
|
50
|
+
Puppet::ModuleTranslations.load_from_vardir(vardir)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|