bolt 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bolt/cli.rb +30 -131
- data/lib/bolt/config.rb +35 -9
- data/lib/bolt/executor.rb +33 -7
- data/lib/bolt/node.rb +19 -2
- data/lib/bolt/node/orch.rb +4 -4
- data/lib/bolt/node/ssh.rb +46 -21
- data/lib/bolt/node/winrm.rb +12 -23
- data/lib/bolt/outputter.rb +9 -0
- data/lib/bolt/outputter/human.rb +33 -4
- data/lib/bolt/outputter/json.rb +6 -1
- data/lib/bolt/pal.rb +87 -20
- data/lib/bolt/version.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_command.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_plan.rb +18 -1
- data/modules/boltlib/lib/puppet/functions/run_script.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_task.rb +2 -1
- data/vendored/facter/lib/facter/virtual.rb +2 -0
- data/vendored/hiera/lib/hiera/config.rb +2 -2
- data/vendored/hiera/lib/hiera/version.rb +1 -1
- data/vendored/puppet/lib/hiera/puppet_function.rb +5 -2
- data/vendored/puppet/lib/hiera_puppet.rb +3 -3
- data/vendored/puppet/lib/puppet/agent/locker.rb +6 -5
- data/vendored/puppet/lib/puppet/application/filebucket.rb +23 -6
- data/vendored/puppet/lib/puppet/daemon.rb +2 -2
- data/vendored/puppet/lib/puppet/defaults.rb +42 -10
- data/vendored/puppet/lib/puppet/error.rb +5 -15
- data/vendored/puppet/lib/puppet/external/pson/common.rb +2 -2
- data/vendored/puppet/lib/puppet/face/module/build.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/install.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/search.rb +2 -1
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/upgrade.rb +1 -0
- data/vendored/puppet/lib/puppet/file_bucket/dipper.rb +1 -1
- data/vendored/puppet/lib/puppet/file_serving/base.rb +2 -1
- data/vendored/puppet/lib/puppet/file_serving/configuration/parser.rb +21 -9
- data/vendored/puppet/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/vendored/puppet/lib/puppet/forge.rb +2 -1
- data/vendored/puppet/lib/puppet/functions/binary_file.rb +1 -0
- data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/vendored/puppet/lib/puppet/functions/module_directory.rb +41 -0
- data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/unique.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/yaml_data.rb +1 -1
- data/vendored/puppet/lib/puppet/gettext/config.rb +10 -5
- data/vendored/puppet/lib/puppet/graph/relationship_graph.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +3 -3
- data/vendored/puppet/lib/puppet/indirector/facts/network_device.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/file_bucket_file/file.rb +10 -3
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +17 -9
- data/vendored/puppet/lib/puppet/indirector/ldap.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
- data/vendored/puppet/lib/puppet/indirector/rest.rb +2 -1
- data/vendored/puppet/lib/puppet/indirector/ssl_file.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/terminus.rb +3 -3
- data/vendored/puppet/lib/puppet/interface.rb +1 -1
- data/vendored/puppet/lib/puppet/interface/action.rb +41 -24
- data/vendored/puppet/lib/puppet/interface/action_builder.rb +14 -5
- data/vendored/puppet/lib/puppet/interface/action_manager.rb +1 -1
- data/vendored/puppet/lib/puppet/interface/documentation.rb +21 -10
- data/vendored/puppet/lib/puppet/interface/face_collection.rb +4 -2
- data/vendored/puppet/lib/puppet/interface/option.rb +36 -15
- data/vendored/puppet/lib/puppet/interface/option_builder.rb +23 -9
- data/vendored/puppet/lib/puppet/interface/option_manager.rb +8 -3
- data/vendored/puppet/lib/puppet/metatype/manager.rb +7 -3
- data/vendored/puppet/lib/puppet/module.rb +2 -1
- data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +4 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +3 -3
- data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +10 -5
- data/vendored/puppet/lib/puppet/network/authstore.rb +2 -2
- data/vendored/puppet/lib/puppet/network/client_request.rb +1 -1
- data/vendored/puppet/lib/puppet/network/format.rb +3 -3
- data/vendored/puppet/lib/puppet/network/http/api/indirection_type.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +1 -3
- data/vendored/puppet/lib/puppet/node.rb +16 -7
- data/vendored/puppet/lib/puppet/parameter.rb +3 -3
- data/vendored/puppet/lib/puppet/parameter/value_collection.rb +5 -2
- data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/ast/node.rb +2 -2
- data/vendored/puppet/lib/puppet/parser/compiler.rb +6 -5
- data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
- data/vendored/puppet/lib/puppet/parser/functions/generate.rb +2 -4
- data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -2
- data/vendored/puppet/lib/puppet/parser/functions/sha256.rb +5 -0
- data/vendored/puppet/lib/puppet/parser/functions/template.rb +6 -2
- data/vendored/puppet/lib/puppet/parser/resource.rb +18 -91
- data/vendored/puppet/lib/puppet/parser/scope.rb +12 -11
- data/vendored/puppet/lib/puppet/parser/templatewrapper.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -6
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/functions/function.rb +8 -2
- data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +7 -2
- data/vendored/puppet/lib/puppet/pops/issues.rb +14 -4
- data/vendored/puppet/lib/puppet/pops/label_provider.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/loader/base_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/dependency_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/loader.rb +6 -1
- data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +27 -6
- data/vendored/puppet/lib/puppet/pops/loader/runtime3_type_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/loaders.rb +7 -3
- data/vendored/puppet/lib/puppet/pops/lookup/explainer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/merge_strategy.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/migration/migration_checker.rb +8 -8
- data/vendored/puppet/lib/puppet/pops/model/factory.rb +4 -2
- data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +6 -2
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +36 -15
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +75 -7
- data/vendored/puppet/lib/puppet/pops/types/types.rb +9 -5
- data/vendored/puppet/lib/puppet/pops/validation.rb +14 -12
- data/vendored/puppet/lib/puppet/property.rb +14 -6
- data/vendored/puppet/lib/puppet/property/ensure.rb +2 -2
- data/vendored/puppet/lib/puppet/provider.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/group/aix.rb +4 -2
- data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +25 -1
- data/vendored/puppet/lib/puppet/provider/ldap.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/naginator.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/nameservice.rb +7 -4
- data/vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
- data/vendored/puppet/lib/puppet/provider/nameservice/objectadd.rb +13 -24
- data/vendored/puppet/lib/puppet/provider/nameservice/pw.rb +14 -14
- data/vendored/puppet/lib/puppet/provider/package/aix.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pkg.rb +3 -2
- data/vendored/puppet/lib/puppet/provider/package/yum.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/parsedfile.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/service/launchd.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/service/runit.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/upstart.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/user/aix.rb +13 -6
- data/vendored/puppet/lib/puppet/provider/user/openbsd.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/user/useradd.rb +33 -4
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/zone/solaris.rb +2 -2
- data/vendored/puppet/lib/puppet/relationship.rb +2 -1
- data/vendored/puppet/lib/puppet/reports/store.rb +1 -1
- data/vendored/puppet/lib/puppet/resource.rb +7 -5
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +14 -11
- data/vendored/puppet/lib/puppet/resource/catalog.rb +33 -18
- data/vendored/puppet/lib/puppet/resource/type.rb +5 -5
- data/vendored/puppet/lib/puppet/settings.rb +19 -13
- data/vendored/puppet/lib/puppet/settings/base_setting.rb +23 -8
- data/vendored/puppet/lib/puppet/settings/config_file.rb +14 -4
- data/vendored/puppet/lib/puppet/settings/environment_conf.rb +5 -7
- data/vendored/puppet/lib/puppet/settings/ini_file.rb +4 -0
- data/vendored/puppet/lib/puppet/ssl/base.rb +9 -4
- data/vendored/puppet/lib/puppet/ssl/oids.rb +8 -2
- data/vendored/puppet/lib/puppet/transaction.rb +6 -2
- data/vendored/puppet/lib/puppet/transaction/persistence.rb +15 -0
- data/vendored/puppet/lib/puppet/transaction/report.rb +9 -1
- data/vendored/puppet/lib/puppet/type.rb +26 -26
- data/vendored/puppet/lib/puppet/type/file.rb +2 -1
- data/vendored/puppet/lib/puppet/type/file/data_sync.rb +2 -1
- data/vendored/puppet/lib/puppet/type/file/source.rb +1 -1
- data/vendored/puppet/lib/puppet/type/group.rb +4 -1
- data/vendored/puppet/lib/puppet/type/mount.rb +1 -1
- data/vendored/puppet/lib/puppet/type/resources.rb +1 -1
- data/vendored/puppet/lib/puppet/type/user.rb +12 -7
- data/vendored/puppet/lib/puppet/type/zone.rb +1 -1
- data/vendored/puppet/lib/puppet/util.rb +15 -21
- data/vendored/puppet/lib/puppet/util/at_fork/solaris.rb +6 -4
- data/vendored/puppet/lib/puppet/util/command_line/trollop.rb +6 -5
- data/vendored/puppet/lib/puppet/util/errors.rb +59 -8
- data/vendored/puppet/lib/puppet/util/fileparsing.rb +3 -5
- data/vendored/puppet/lib/puppet/util/http_proxy.rb +14 -6
- data/vendored/puppet/lib/puppet/util/instance_loader.rb +1 -3
- data/vendored/puppet/lib/puppet/util/ldap/manager.rb +6 -3
- data/vendored/puppet/lib/puppet/util/log.rb +15 -21
- data/vendored/puppet/lib/puppet/util/logging.rb +21 -28
- data/vendored/puppet/lib/puppet/util/methodhelper.rb +1 -1
- data/vendored/puppet/lib/puppet/util/nagios_maker.rb +1 -1
- data/vendored/puppet/lib/puppet/util/network_device/config.rb +20 -13
- data/vendored/puppet/lib/puppet/util/platform.rb +13 -0
- data/vendored/puppet/lib/puppet/util/posix.rb +1 -1
- data/vendored/puppet/lib/puppet/util/provider_features.rb +1 -1
- data/vendored/puppet/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/vendored/puppet/lib/puppet/util/selinux.rb +1 -1
- data/vendored/puppet/lib/puppet/util/windows/eventlog.rb +10 -5
- data/vendored/puppet/lib/puppet/util/windows/file.rb +61 -9
- data/vendored/puppet/lib/puppet/util/windows/process.rb +1 -1
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +2 -2
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- data/vendored/puppet/lib/puppet_pal.rb +23 -22
- metadata +4 -2
@@ -738,7 +738,8 @@ class EvaluatorImpl
|
|
738
738
|
#evaluate(o.body, scope)
|
739
739
|
rescue Puppet::Pops::Evaluator::PuppetStopIteration => ex
|
740
740
|
# breaking out of a file level program is not allowed
|
741
|
-
|
741
|
+
#TRANSLATOR break() is a method that should not be translated
|
742
|
+
raise Puppet::ParseError.new(_("break() from context where this is illegal"), ex.file, ex.line)
|
742
743
|
end
|
743
744
|
end
|
744
745
|
|
@@ -19,7 +19,7 @@ module Puppet::Pops::Evaluator::ExternalSyntaxSupport
|
|
19
19
|
if acceptor.error_count > 0
|
20
20
|
checker_message = "Invalid produced text having syntax: '#{syntax}'."
|
21
21
|
Puppet::Pops::IssueReporter.assert_and_report(acceptor, :message => checker_message)
|
22
|
-
raise ArgumentError, "Internal Error: Configuration of runtime error handling wrong: should have raised exception"
|
22
|
+
raise ArgumentError, _("Internal Error: Configuration of runtime error handling wrong: should have raised exception")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -143,7 +143,9 @@ class Runtime3Converter
|
|
143
143
|
[type_name.nil? ? nil : type_name.sub(/^::/, '').downcase, title.nil? ? '' : title]
|
144
144
|
end
|
145
145
|
else
|
146
|
-
|
146
|
+
#TRANSLATORS 'PClassType' and 'PResourceType' are Puppet types and should not be translated
|
147
|
+
raise ArgumentError, _("Cannot split the type %{class_name}, it represents neither a PClassType, nor a PResourceType.") %
|
148
|
+
{ class_name: catalog_type.class }
|
147
149
|
end
|
148
150
|
end
|
149
151
|
|
@@ -28,7 +28,7 @@ module Runtime3ResourceSupport
|
|
28
28
|
# from the raised exception. (It may be good enough).
|
29
29
|
unless resolved_type
|
30
30
|
# TODO: do this the right way
|
31
|
-
raise ArgumentError, "Unknown resource type: '
|
31
|
+
raise ArgumentError, _("Unknown resource type: '%{type}'") % { type: type_name }
|
32
32
|
end
|
33
33
|
|
34
34
|
# Build a resource for each title - use the resolved *type* as opposed to a reference
|
@@ -20,7 +20,7 @@ module Runtime3Support
|
|
20
20
|
def fail(issue, semantic, options={}, except=nil)
|
21
21
|
optionally_fail(issue, semantic, options, except)
|
22
22
|
# an error should have been raised since fail always fails
|
23
|
-
raise ArgumentError, "Internal Error: Configuration of runtime error handling wrong: should have raised exception"
|
23
|
+
raise ArgumentError, _("Internal Error: Configuration of runtime error handling wrong: should have raised exception")
|
24
24
|
end
|
25
25
|
|
26
26
|
# Optionally (based on severity) Fails the evaluation of _semantic_ with a given issue
|
@@ -150,7 +150,7 @@ module Runtime3Support
|
|
150
150
|
# case - it is just wrong, the error should be reported by the caller who knows in more detail where it
|
151
151
|
# is in the source.
|
152
152
|
#
|
153
|
-
raise ArgumentError, "Internal error - attempt to create a local scope without a hash" unless hash.is_a?(Hash)
|
153
|
+
raise ArgumentError, _("Internal error - attempt to create a local scope without a hash") unless hash.is_a?(Hash)
|
154
154
|
scope.ephemeral_from(hash)
|
155
155
|
end
|
156
156
|
|
@@ -288,7 +288,7 @@ module Runtime3Support
|
|
288
288
|
end
|
289
289
|
|
290
290
|
# Call via 3x API if function exists there
|
291
|
-
raise ArgumentError, "Unknown function '
|
291
|
+
raise ArgumentError, _("Unknown function '%{name}'") % { name: name } unless Puppet::Parser::Functions.function(name)
|
292
292
|
|
293
293
|
# Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.
|
294
294
|
# NOTE: Passing an empty string last converts nil/:undef to empty string
|
@@ -330,8 +330,7 @@ module Runtime3Support
|
|
330
330
|
end
|
331
331
|
|
332
332
|
def convert(value, scope, undef_value)
|
333
|
-
|
334
|
-
converter.convert(value, scope, undef_value)
|
333
|
+
Runtime3Converter.instance.convert(value, scope, undef_value)
|
335
334
|
end
|
336
335
|
|
337
336
|
def create_resources(o, scope, virtual, exported, type_name, resource_titles, evaluated_parameters)
|
@@ -526,7 +525,7 @@ module Runtime3Support
|
|
526
525
|
:exception_class => Puppet::PreformattedError
|
527
526
|
})
|
528
527
|
if errors?
|
529
|
-
raise ArgumentError, "Internal Error: Configuration of runtime error handling wrong: should have raised exception"
|
528
|
+
raise ArgumentError, _("Internal Error: Configuration of runtime error handling wrong: should have raised exception")
|
530
529
|
end
|
531
530
|
end
|
532
531
|
end
|
@@ -80,7 +80,7 @@ class Dispatch < Evaluator::CallableSignature
|
|
80
80
|
when :pal_script_compiler
|
81
81
|
Puppet.lookup(:pal_script_compiler)
|
82
82
|
else
|
83
|
-
raise ArgumentError, "Unknown injection
|
83
|
+
raise ArgumentError, _("Unknown injection %{injection_name}") % { injection_name: injection_name }
|
84
84
|
end
|
85
85
|
else
|
86
86
|
# Careful so no new nil arguments are added since they would override default
|
@@ -108,7 +108,10 @@ class Puppet::Pops::Functions::Function
|
|
108
108
|
def internal_call_function(scope, function_name, args, &block)
|
109
109
|
|
110
110
|
the_loader = loader
|
111
|
-
|
111
|
+
unless the_loader
|
112
|
+
raise ArgumentError, _("Function %{class_name}(): cannot call function '%{function_name}' - no loader specified") %
|
113
|
+
{ class_name: self.class.name, function_name: function_name }
|
114
|
+
end
|
112
115
|
|
113
116
|
func = the_loader.load(:function, function_name)
|
114
117
|
if func
|
@@ -121,7 +124,10 @@ class Puppet::Pops::Functions::Function
|
|
121
124
|
# about where in a puppet manifest this error originates. (Such information is not available here).
|
122
125
|
loader_scope = closure_scope
|
123
126
|
func_3x = Puppet::Parser::Functions.function(function_name, loader_scope.environment) if loader_scope.is_a?(Puppet::Parser::Scope)
|
124
|
-
|
127
|
+
unless func_3x
|
128
|
+
raise ArgumentError, _("Function %{class_name}(): Unknown function: '%{function_name}'") %
|
129
|
+
{ class_name: self.class.name, function_name: function_name }
|
130
|
+
end
|
125
131
|
|
126
132
|
# Call via 3x API
|
127
133
|
# Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.
|
@@ -68,8 +68,13 @@ class IssueReporter
|
|
68
68
|
emitted += 1
|
69
69
|
break if emitted >= max_errors
|
70
70
|
end
|
71
|
-
|
72
|
-
|
71
|
+
giving_up_message = if (emit_warnings && warnings.size > 0)
|
72
|
+
_("Language validation logged %{error_count} errors, and %{warning_count} warnings. Giving up") %
|
73
|
+
{ error_count: errors.size, warning_count: warnings.size }
|
74
|
+
else
|
75
|
+
_("Language validation logged %{error_count} errors. Giving up") %
|
76
|
+
{ error_count: errors.size }
|
77
|
+
end
|
73
78
|
exception = emit_exception.new(giving_up_message)
|
74
79
|
exception.file = errors[0].file
|
75
80
|
raise exception
|
@@ -782,9 +782,12 @@ module Issues
|
|
782
782
|
end
|
783
783
|
|
784
784
|
HIERA_BACKEND_MULTIPLY_DEFINED = hard_issue :HIERA_BACKEND_MULTIPLY_DEFINED, :name, :first_line do
|
785
|
-
msg = _("Backend '%{name}' is defined more than once") % { name: name }
|
785
|
+
msg = _("Backend '%{name}' is defined more than once.") % { name: name }
|
786
786
|
fl = first_line
|
787
|
-
|
787
|
+
if fl
|
788
|
+
msg += ' ' + _("First defined at %{error_location}") % { error_location: Puppet::Util::Errors.error_location(nil, fl) }
|
789
|
+
end
|
790
|
+
msg
|
788
791
|
end
|
789
792
|
|
790
793
|
HIERA_NO_PROVIDER_FOR_BACKEND = hard_issue :HIERA_NO_PROVIDER_FOR_BACKEND, :name do
|
@@ -792,9 +795,12 @@ module Issues
|
|
792
795
|
end
|
793
796
|
|
794
797
|
HIERA_HIERARCHY_NAME_MULTIPLY_DEFINED = hard_issue :HIERA_HIERARCHY_NAME_MULTIPLY_DEFINED, :name, :first_line do
|
795
|
-
msg = _("Hierarchy name '%{name}' defined more than once") % { name: name }
|
798
|
+
msg = _("Hierarchy name '%{name}' defined more than once.") % { name: name }
|
796
799
|
fl = first_line
|
797
|
-
|
800
|
+
if fl
|
801
|
+
msg += ' ' + _("First defined at %{error_location}") % { error_location: Puppet::Util::Errors.error_location(nil, fl) }
|
802
|
+
end
|
803
|
+
msg
|
798
804
|
end
|
799
805
|
|
800
806
|
HIERA_V3_BACKEND_NOT_GLOBAL = hard_issue :HIERA_V3_BACKEND_NOT_GLOBAL do
|
@@ -884,5 +890,9 @@ module Issues
|
|
884
890
|
UNKNOWN_TASK = issue :UNKNOWN_TASK, :type_name do
|
885
891
|
_('Task not found: %{type_name}') % { type_name: type_name }
|
886
892
|
end
|
893
|
+
|
894
|
+
LOADER_FAILURE = issue :LOADER_FAILURE, :type do
|
895
|
+
_('Failed to load: %{type_name}') % { type: type }
|
896
|
+
end
|
887
897
|
end
|
888
898
|
end
|
@@ -20,12 +20,12 @@ class BaseLoader < Loader
|
|
20
20
|
@last_result = nil # the value of the last name (optimization)
|
21
21
|
end
|
22
22
|
|
23
|
-
def discover(type, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
23
|
+
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
24
24
|
result = []
|
25
25
|
@named_values.each_pair do |key, entry|
|
26
26
|
result << key unless entry.nil? || entry.value.nil? || key.type != type || (block_given? && !yield(key))
|
27
27
|
end
|
28
|
-
result.concat(parent.discover(type, name_authority, &block))
|
28
|
+
result.concat(parent.discover(type, error_collector, name_authority, &block))
|
29
29
|
result.uniq!
|
30
30
|
result
|
31
31
|
end
|
@@ -23,9 +23,9 @@ class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader
|
|
23
23
|
@dependency_loaders = dependency_loaders
|
24
24
|
end
|
25
25
|
|
26
|
-
def discover(type, name_authority = Puppet::Pops::Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
26
|
+
def discover(type, error_collector = nil, name_authority = Puppet::Pops::Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
27
27
|
result = []
|
28
|
-
@dependency_loaders.each { |loader| result.concat(loader.discover(type, name_authority, &block)) }
|
28
|
+
@dependency_loaders.each { |loader| result.concat(loader.discover(type, error_collector, name_authority, &block)) }
|
29
29
|
result.concat(super)
|
30
30
|
result
|
31
31
|
end
|
@@ -40,13 +40,18 @@ class Loader
|
|
40
40
|
# found values for which the given block returns true. All found entries will be returned if no
|
41
41
|
# block is given.
|
42
42
|
#
|
43
|
+
# Errors that occur function discovery will either be logged as warnings or collected by the optional
|
44
|
+
# `error_collector` array. When provided, it will receive {Puppet::DataTypes::Error} instances describing
|
45
|
+
# each error in detail and no warnings will be logged.
|
46
|
+
#
|
43
47
|
# @param type [Symbol] the type of values to search for
|
48
|
+
# @param error_collector [Array<Puppet::DataTypes::Error>] an optional array that will receive errors during load
|
44
49
|
# @param name_authority [String] the name authority, defaults to the pcore runtime
|
45
50
|
# @yield [typed_name] optional block to filter the results
|
46
51
|
# @yieldparam [TypedName] typed_name the typed name of a found entry
|
47
52
|
# @yieldreturn [Boolean] `true` to keep the entry, `false` to discard it.
|
48
53
|
# @return [Array<TypedName>] the list of names of discovered values
|
49
|
-
def discover(type, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
54
|
+
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
50
55
|
return EMPTY_ARRAY
|
51
56
|
end
|
52
57
|
|
@@ -251,8 +251,8 @@ module LoaderPaths
|
|
251
251
|
n = ''
|
252
252
|
n << module_name unless module_name.nil?
|
253
253
|
|
254
|
-
# Remove
|
255
|
-
relative_path = relative_path.sub(
|
254
|
+
# Remove the file extension, defined as everything after the *last* dot.
|
255
|
+
relative_path = relative_path.sub(%r{\.[^/.]*\z}, '')
|
256
256
|
|
257
257
|
if relative_path == 'init' && !(module_name.nil? || module_name.empty?)
|
258
258
|
TypedName.new(type, module_name, name_authority)
|
@@ -118,7 +118,8 @@ module ModuleLoaders
|
|
118
118
|
@loaders = loaders
|
119
119
|
@loadables = loadables
|
120
120
|
unless (loadables - LOADABLE_KINDS).empty?
|
121
|
-
|
121
|
+
#TRANSLATORS 'loadables' is a variable containing loadable modules and should not be translated
|
122
|
+
raise ArgumentError, _('given loadables are not of supported loadable kind')
|
122
123
|
end
|
123
124
|
loaders.add_loader_by_name(self)
|
124
125
|
end
|
@@ -127,14 +128,27 @@ module ModuleLoaders
|
|
127
128
|
@loadables
|
128
129
|
end
|
129
130
|
|
130
|
-
def discover(type, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
131
|
+
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
131
132
|
global = global?
|
132
133
|
if name_authority == Pcore::RUNTIME_NAME_AUTHORITY
|
133
134
|
smart_paths.effective_paths(type).each do |sp|
|
134
135
|
relative_paths(sp).each do |rp|
|
135
136
|
tp = sp.typed_name(type, name_authority, rp, global ? nil : @module_name)
|
136
137
|
next unless sp.valid_name?(tp)
|
137
|
-
|
138
|
+
begin
|
139
|
+
load_typed(tp) unless block_given? && !block.yield(tp)
|
140
|
+
rescue StandardError => e
|
141
|
+
if error_collector.nil?
|
142
|
+
Puppet.warn_once(:unloadable_entity, tp.to_s, e.message)
|
143
|
+
else
|
144
|
+
err = Puppet::DataTypes::Error.new(
|
145
|
+
Issues::LOADER_FAILURE.format(:type => type),
|
146
|
+
'PUPPET_LOADER_FAILURE',
|
147
|
+
Issues::LOADER_FAILURE.issue_code, nil,
|
148
|
+
{ 'original_error' => e.message })
|
149
|
+
error_collector << err unless error_collector.include?(err)
|
150
|
+
end
|
151
|
+
end
|
138
152
|
end
|
139
153
|
end
|
140
154
|
end
|
@@ -207,7 +221,9 @@ module ModuleLoaders
|
|
207
221
|
return set_entry(typed_name, value, origin)
|
208
222
|
end
|
209
223
|
|
210
|
-
|
224
|
+
#TRANSLATORS 'TypeSet' should not be translated
|
225
|
+
raise ArgumentError, _("The code loaded from %{origin} does not define the TypeSet '%{module_name}'") %
|
226
|
+
{ origin: origin, module_name: module_name.capitalize }
|
211
227
|
end
|
212
228
|
else
|
213
229
|
# anything else cannot possibly be in this module
|
@@ -411,8 +427,13 @@ module ModuleLoaders
|
|
411
427
|
end
|
412
428
|
|
413
429
|
def existing_paths(effective_path)
|
414
|
-
|
415
|
-
|
430
|
+
dirname = File.dirname(effective_path)
|
431
|
+
basename = File.basename(effective_path)
|
432
|
+
# Select all paths matching `effective_path` up until an optional file extension
|
433
|
+
@path_index.select do |path|
|
434
|
+
File.basename(path, '.*') == basename &&
|
435
|
+
File.dirname(path) == dirname
|
436
|
+
end
|
416
437
|
end
|
417
438
|
|
418
439
|
def meaningful_to_search?(smart_path)
|
@@ -13,9 +13,9 @@ class Runtime3TypeLoader < BaseLoader
|
|
13
13
|
@resource_3x_loader = env_path.nil? ? nil : ModuleLoaders.pcore_resource_type_loader_from(parent_loader, loaders, env_path)
|
14
14
|
end
|
15
15
|
|
16
|
-
def discover(type, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
16
|
+
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
|
17
17
|
# TODO: Use generated index of all known types (requires separate utility).
|
18
|
-
parent.discover(type, name_authority, &block)
|
18
|
+
parent.discover(type, error_collector, name_authority, &block)
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_s()
|
@@ -78,7 +78,7 @@ class StaticLoader < Loader
|
|
78
78
|
create_built_in_types
|
79
79
|
end
|
80
80
|
|
81
|
-
def discover(type, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
|
81
|
+
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
|
82
82
|
# Static loader only contains runtime types
|
83
83
|
return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY
|
84
84
|
|
@@ -165,7 +165,7 @@ class Loaders
|
|
165
165
|
# @api private
|
166
166
|
def self.loaders
|
167
167
|
loaders = Puppet.lookup(:loaders) { nil }
|
168
|
-
raise Puppet::ParseError, "Internal Error: Puppet Context ':loaders' missing" if loaders.nil?
|
168
|
+
raise Puppet::ParseError, _("Internal Error: Puppet Context ':loaders' missing") if loaders.nil?
|
169
169
|
loaders
|
170
170
|
end
|
171
171
|
|
@@ -199,7 +199,9 @@ class Loaders
|
|
199
199
|
# TODO : Later check if definition is private, and then add it to private_loader_for_module
|
200
200
|
#
|
201
201
|
loader = public_loader_for_module(module_name)
|
202
|
-
|
202
|
+
if loader.nil?
|
203
|
+
raise Puppet::ParseError, _("Internal Error: did not find public loader for module: '%{module_name}'") % { module_name: module_name }
|
204
|
+
end
|
203
205
|
loader
|
204
206
|
end
|
205
207
|
end
|
@@ -238,7 +240,9 @@ class Loaders
|
|
238
240
|
|
239
241
|
def add_loader_by_name(loader)
|
240
242
|
name = loader.loader_name
|
241
|
-
|
243
|
+
if @loaders_by_name.include?(name)
|
244
|
+
raise Puppet::ParseError, _("Internal Error: Attempt to redefine loader named '%{name}'") % { name: name }
|
245
|
+
end
|
242
246
|
@loaders_by_name[name] = loader
|
243
247
|
end
|
244
248
|
|
@@ -491,7 +491,8 @@ module Lookup
|
|
491
491
|
when :invalid_key
|
492
492
|
ExplainInvalidKey.new(@current, qualifier)
|
493
493
|
else
|
494
|
-
|
494
|
+
#TRANSLATORS 'Explain' is referring to the 'Explainer' class and should not be translated
|
495
|
+
raise ArgumentError, _("Unknown Explain type %{qualifier_type}") % { qualifier_type: qualifier_type }
|
495
496
|
end
|
496
497
|
@current.branches << node
|
497
498
|
@current = node
|
@@ -24,7 +24,8 @@ module Puppet::Pops
|
|
24
24
|
if merge.is_a?(Hash)
|
25
25
|
merge_strategy = merge['strategy']
|
26
26
|
if merge_strategy.nil?
|
27
|
-
|
27
|
+
#TRANSLATORS 'merge' is a variable name and 'strategy' is a key and should not be translated
|
28
|
+
raise ArgumentError, _("The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'")
|
28
29
|
end
|
29
30
|
merge_options = merge.size == 1 ? EMPTY_HASH : merge
|
30
31
|
else
|
@@ -33,7 +34,7 @@ module Puppet::Pops
|
|
33
34
|
end
|
34
35
|
merge_strategy = merge_strategy.to_sym if merge_strategy.is_a?(String)
|
35
36
|
strategy_class = strategies[merge_strategy]
|
36
|
-
raise ArgumentError, "Unknown merge strategy: '
|
37
|
+
raise ArgumentError, _("Unknown merge strategy: '%{strategy}'") % { strategy: merge_strategy } if strategy_class.nil?
|
37
38
|
merge_options == EMPTY_HASH ? strategy_class::INSTANCE : strategy_class.new(merge_options)
|
38
39
|
end
|
39
40
|
|
@@ -51,7 +52,9 @@ module Puppet::Pops
|
|
51
52
|
#
|
52
53
|
def self.add_strategy(strategy_class)
|
53
54
|
unless MergeStrategy > strategy_class
|
54
|
-
|
55
|
+
#TRANSLATORS 'MergeStrategies.add_strategy' is a method, 'stratgey_class' is a variable and 'MergeStrategy' is a class name and should not be translated
|
56
|
+
raise ArgumentError, _("MergeStrategies.add_strategy 'strategy_class' must be a 'MergeStrategy' class. Got %{strategy_class}") %
|
57
|
+
{ strategy_class: strategy_class }
|
55
58
|
end
|
56
59
|
strategies[strategy_class.key] = strategy_class
|
57
60
|
nil
|
@@ -18,41 +18,41 @@ class Puppet::Pops::Migration::MigrationChecker
|
|
18
18
|
|
19
19
|
# For 3.8/4.0
|
20
20
|
def report_ambiguous_integer(o)
|
21
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
21
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
22
22
|
end
|
23
23
|
|
24
24
|
# For 3.8/4.0
|
25
25
|
def report_ambiguous_float(o)
|
26
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
26
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
27
27
|
end
|
28
28
|
|
29
29
|
# For 3.8/4.0
|
30
30
|
def report_empty_string_true(value, o)
|
31
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
31
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
32
32
|
end
|
33
33
|
|
34
34
|
# For 3.8/4.0
|
35
35
|
def report_uc_bareword_type(value, o)
|
36
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
36
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
37
37
|
end
|
38
38
|
|
39
39
|
# For 3.8/4.0
|
40
40
|
def report_equality_type_mismatch(left, right, o)
|
41
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
41
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
42
42
|
end
|
43
43
|
|
44
44
|
# For 3.8/4.0
|
45
45
|
def report_option_type_mismatch(test_value, option_value, option_expr, matching_expr)
|
46
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
46
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
47
47
|
end
|
48
48
|
|
49
49
|
# For 3.8/4.0
|
50
50
|
def report_in_expression(o)
|
51
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
51
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
52
52
|
end
|
53
53
|
|
54
54
|
# For 3.8/4.0
|
55
55
|
def report_array_last_in_block(o)
|
56
|
-
raise Puppet::DevError, "Unsupported migration method called"
|
56
|
+
raise Puppet::DevError, _("Unsupported migration method called")
|
57
57
|
end
|
58
58
|
end
|