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
@@ -28,7 +28,7 @@ class Puppet::Parser::AST::HostName < Puppet::Parser::AST::Leaf
|
|
28
28
|
unless @value.is_a?(Regex)
|
29
29
|
@value = @value.to_s.downcase
|
30
30
|
if @value =~ /[^-\w.]/
|
31
|
-
raise Puppet::DevError, "'
|
31
|
+
raise Puppet::DevError, _("'%{value}' is not a valid hostname") % { value: @value }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -2,9 +2,9 @@ class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
|
|
2
2
|
attr_accessor :names, :context
|
3
3
|
|
4
4
|
def initialize(names, context = {})
|
5
|
-
raise ArgumentError, "names should be an array" unless names.is_a? Array
|
5
|
+
raise ArgumentError, _("names should be an array") unless names.is_a? Array
|
6
6
|
if context[:parent]
|
7
|
-
raise Puppet::DevError, "Node inheritance is removed in Puppet 4.0.0. See http://links.puppet.com/puppet-node-inheritance-deprecation"
|
7
|
+
raise Puppet::DevError, _("Node inheritance is removed in Puppet 4.0.0. See http://links.puppet.com/puppet-node-inheritance-deprecation")
|
8
8
|
end
|
9
9
|
|
10
10
|
@names = names
|
@@ -26,8 +26,8 @@ class Puppet::Parser::Compiler
|
|
26
26
|
if !errors.empty?
|
27
27
|
errors.each { |e| Puppet.err(e) } if errors.size > 1
|
28
28
|
errmsg = [
|
29
|
-
"Compilation has been halted because:
|
30
|
-
"For more information, see https://docs.puppet.com/puppet/latest/reference/environments.html",
|
29
|
+
_("Compilation has been halted because: %{error}") % { error: errors.first },
|
30
|
+
_("For more information, see https://docs.puppet.com/puppet/latest/reference/environments.html"),
|
31
31
|
]
|
32
32
|
raise(Puppet::Error, errmsg.join(' '))
|
33
33
|
end
|
@@ -38,7 +38,7 @@ class Puppet::Parser::Compiler
|
|
38
38
|
Puppet.log_exception(detail)
|
39
39
|
raise
|
40
40
|
rescue => detail
|
41
|
-
message = "
|
41
|
+
message = _("%{message} on node %{node}") % { message: detail, node: node.name }
|
42
42
|
Puppet.log_exception(detail, message)
|
43
43
|
raise Puppet::Error, message, detail.backtrace
|
44
44
|
end
|
@@ -354,7 +354,7 @@ class Puppet::Parser::Compiler
|
|
354
354
|
# evaluated later in the process.
|
355
355
|
#
|
356
356
|
def evaluate_classes(classes, scope, lazy_evaluate = true)
|
357
|
-
raise Puppet::DevError, "No source for scope passed to evaluate_classes" unless scope.source
|
357
|
+
raise Puppet::DevError, _("No source for scope passed to evaluate_classes") unless scope.source
|
358
358
|
class_parameters = nil
|
359
359
|
# if we are a param class, save the classes hash
|
360
360
|
# and transform classes to be the keys
|
@@ -472,7 +472,8 @@ class Puppet::Parser::Compiler
|
|
472
472
|
component = krt.find_hostclass(component_name)
|
473
473
|
end
|
474
474
|
if component.nil?
|
475
|
-
raise Puppet::ParseError, "Capability mapping error:
|
475
|
+
raise Puppet::ParseError, _("Capability mapping error: %{kind} clause references nonexistent %{component_type} %{component_name}") %
|
476
|
+
{ kind: kind, component_type: component_type, component_name: component_name }
|
476
477
|
end
|
477
478
|
|
478
479
|
blueprint = args['blueprint']
|
@@ -152,7 +152,7 @@ module Puppet::Parser::Functions
|
|
152
152
|
ftype = options[:type] || :statement
|
153
153
|
|
154
154
|
unless ftype == :statement or ftype == :rvalue
|
155
|
-
raise Puppet::DevError, "Invalid statement type
|
155
|
+
raise Puppet::DevError, _("Invalid statement type %{type}") % { type: ftype.inspect }
|
156
156
|
end
|
157
157
|
|
158
158
|
# the block must be installed as a method because it may use "return",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'digest/
|
1
|
+
require 'digest/sha2'
|
2
2
|
|
3
3
|
Puppet::Parser::Functions::newfunction(:fqdn_rand, :arity => -2, :type => :rvalue, :doc =>
|
4
4
|
"Usage: `fqdn_rand(MAX, [SEED])`. MAX is required and must be a positive
|
@@ -16,6 +16,10 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :arity => -2, :type => :rvalu
|
|
16
16
|
node. (For example, `fqdn_rand(30)`, `fqdn_rand(30, 'expensive job 1')`, and
|
17
17
|
`fqdn_rand(30, 'expensive job 2')` will produce totally different numbers.)") do |args|
|
18
18
|
max = args.shift.to_i
|
19
|
-
|
19
|
+
|
20
|
+
# We are consciously not using different hash algs based on fips mode here
|
21
|
+
# since the randomness is not guaranteed to be predictable for a given node
|
22
|
+
# It just needs to be unique for a given node
|
23
|
+
seed = Digest::SHA256.hexdigest([self['::fqdn'],max,args].join(':')).hex
|
20
24
|
Puppet::Util.deterministic_rand_int(seed,max)
|
21
25
|
end
|
@@ -21,13 +21,11 @@ Puppet::Parser::Functions::newfunction(:generate, :arity => -2, :type => :rvalue
|
|
21
21
|
end
|
22
22
|
|
23
23
|
unless valid
|
24
|
-
raise Puppet::ParseError,
|
25
|
-
_("Generators can only contain alphanumerics, file separators, and dashes")
|
24
|
+
raise Puppet::ParseError, _("Generators can only contain alphanumerics, file separators, and dashes")
|
26
25
|
end
|
27
26
|
|
28
27
|
if args[0] =~ /\.\./
|
29
|
-
raise Puppet::ParseError,
|
30
|
-
_("Can not use generators with '..' in them.")
|
28
|
+
raise Puppet::ParseError, _("Can not use generators with '..' in them.")
|
31
29
|
end
|
32
30
|
|
33
31
|
begin
|
@@ -20,8 +20,7 @@ Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :arit
|
|
20
20
|
begin
|
21
21
|
wrapper.result(string)
|
22
22
|
rescue => detail
|
23
|
-
raise Puppet::ParseError,
|
24
|
-
_("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
|
23
|
+
raise Puppet::ParseError, _("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
|
25
24
|
end
|
26
25
|
end.join("")
|
27
26
|
end
|
@@ -28,8 +28,12 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :arity => -2
|
|
28
28
|
wrapper.result
|
29
29
|
rescue => detail
|
30
30
|
info = detail.backtrace.first.split(':')
|
31
|
-
|
32
|
-
|
31
|
+
message = []
|
32
|
+
message << _("Failed to parse template %{file}:") % { file: file }
|
33
|
+
message << _(" Filepath: %{file_path}") % { file_path: info[0] }
|
34
|
+
message << _(" Line: %{line}") % { line: info[1] }
|
35
|
+
message << _(" Detail: %{detail}") % { detail: detail }
|
36
|
+
raise Puppet::ParseError, message.join("\n") + "\n"
|
33
37
|
end
|
34
38
|
end.join("")
|
35
39
|
end
|
@@ -169,72 +169,18 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
169
169
|
end
|
170
170
|
|
171
171
|
if evaluated?
|
172
|
+
error_location_str = Puppet::Util::Errors.error_location(file, line)
|
173
|
+
msg = if error_location_str.empty?
|
174
|
+
_('Attempt to override an already evaluated resource with new values')
|
175
|
+
else
|
176
|
+
_('Attempt to override an already evaluated resource, defined at %{error_location}, with new values') % { error_location: error_location_str }
|
177
|
+
end
|
172
178
|
strict = Puppet[:strict]
|
173
179
|
unless strict == :off
|
174
180
|
if strict == :error
|
175
|
-
msg = if file && file != ''
|
176
|
-
if line
|
177
|
-
_('Attempt to override an already evaluated resource, defined at %{file}:%{line}, with new values') % { file: file, line: line }
|
178
|
-
else
|
179
|
-
_('Attempt to override an already evaluated resource, defined in %{file}, with new values') % { file: file }
|
180
|
-
end
|
181
|
-
else
|
182
|
-
if line
|
183
|
-
_('Attempt to override an already evaluated resource, defined at line %{line}, with new values') % { line: line }
|
184
|
-
else
|
185
|
-
_('Attempt to override an already evaluated resource with new values')
|
186
|
-
end
|
187
|
-
end
|
188
181
|
raise Puppet::ParseError.new(msg, resource.file, resource.line)
|
189
182
|
else
|
190
|
-
msg
|
191
|
-
# all 4 variables set
|
192
|
-
when file && file != '' && line && resource.file && resource.file != '' && resource.line
|
193
|
-
_('Attempt to override an already evaluated resource, defined at %{file}:%{line}, with new values at %{resource_file}:%{resource_line}') %
|
194
|
-
{ file: file, line: line, resource_file: resource.file, resource_line: resource.line }
|
195
|
-
|
196
|
-
# 3 variables set
|
197
|
-
when file && file != '' && line && resource.file && resource.file != ''
|
198
|
-
_('Attempt to override an already evaluated resource, defined at %{file}:%{line}, with new values in %{resource_file}') %
|
199
|
-
{ file: file, line: line, resource_file: resource.file }
|
200
|
-
when file && file != '' && line && resource.line
|
201
|
-
_('Attempt to override an already evaluated resource, defined at %{file}:%{line}, with new values at line %{resource_line}') %
|
202
|
-
{ file: file, line: line, resource_line: resource.line }
|
203
|
-
when file && file != '' && resource.file && resource.file != '' && resource.line
|
204
|
-
_('Attempt to override an already evaluated resource, defined in %{file}, with new values at %{resource_file}:%{resource_line}') %
|
205
|
-
{ file: file, resource_file: resource.file, resource_line: resource.line }
|
206
|
-
when line && resource.file && resource.file != '' && resource.line
|
207
|
-
_('Attempt to override an already evaluated resource, defined at line %{line}, with new values at %{resource_file}:%{resource_line}') %
|
208
|
-
{ line: line, resource_file: resource.file, resource_line: resource.line }
|
209
|
-
|
210
|
-
# 2 variables set
|
211
|
-
when file && file != '' && line
|
212
|
-
_('Attempt to override an already evaluated resource, defined at %{file}:%{line}, with new values') % { file: file, line: line }
|
213
|
-
when file && file != '' && resource.file && resource.file != ''
|
214
|
-
_('Attempt to override an already evaluated resource, defined in %{file}, with new values in %{resource_file}') % { file: file, resource_file: resource.file }
|
215
|
-
when file && file != '' && resource.line
|
216
|
-
_('Attempt to override an already evaluated resource, defined in %{file}, with new values at line %{resource_line}') % { file: file, resource_line: resource.line }
|
217
|
-
when line && resource.file && resource.file != ''
|
218
|
-
_('Attempt to override an already evaluated resource, defined at line %{line}, with new values in %{resource_file}') % { line: line, resource_file: resource.file }
|
219
|
-
when line && resource.line
|
220
|
-
_('Attempt to override an already evaluated resource, defined at line %{line}, with new values at line %{resource_line}') % { line: line, resource_line: resource.line }
|
221
|
-
when resource.file && resource.file != '' && resource.line
|
222
|
-
_('Attempt to override an already evaluated resource with new values at %{resource_file}:%{resource_line}') % { resource_file: resource.file, resource_line: resource.line }
|
223
|
-
|
224
|
-
# 1 variable set
|
225
|
-
when file && file != ''
|
226
|
-
_('Attempt to override an already evaluated resource, defined in %{file}, with new values') % { file: file }
|
227
|
-
when line
|
228
|
-
_('Attempt to override an already evaluated resource, defined at line %{line}, with new values') % { line: line }
|
229
|
-
when resource.file && resource.file != ''
|
230
|
-
_('Attempt to override an already evaluated resource with new values in %{resource_file}') % { resource_file: resource.file }
|
231
|
-
when resource.line
|
232
|
-
_('Attempt to override an already evaluated resource with new values at line %{resource_line}') % { resource_line: resource.line }
|
233
|
-
|
234
|
-
else
|
235
|
-
# no variables set
|
236
|
-
_('Attempt to override an already evaluated resource with new values')
|
237
|
-
end
|
183
|
+
msg += Puppet::Util::Errors.error_location_with_space(resource.file, resource.line)
|
238
184
|
Puppet.warning(msg)
|
239
185
|
end
|
240
186
|
end
|
@@ -410,41 +356,22 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
410
356
|
|
411
357
|
# The parameter is already set. Fail if they're not allowed to override it.
|
412
358
|
unless param.source.child_of?(current.source) || param.source.equal?(current.source) && scope.is_default?(type, param.name, current.value)
|
359
|
+
error_location_str = Puppet::Util::Errors.error_location(current.file, current.line)
|
413
360
|
msg = if current.source.to_s == ''
|
414
|
-
if
|
415
|
-
|
416
|
-
|
417
|
-
{ name: param.name, resource: ref, file: current.file, line: current.line }
|
418
|
-
else
|
419
|
-
_("Parameter '%{name}' is already set on %{resource} in %{file}; cannot redefine") %
|
420
|
-
{ name: param.name, resource: ref, file: current.file }
|
421
|
-
end
|
361
|
+
if error_location_str.empty?
|
362
|
+
_("Parameter '%{name}' is already set on %{resource}; cannot redefine") %
|
363
|
+
{ name: param.name, resource: ref }
|
422
364
|
else
|
423
|
-
|
424
|
-
|
425
|
-
{ name: param.name, resource: ref, line: current.line }
|
426
|
-
else
|
427
|
-
_("Parameter '%{name}' is already set on %{resource}; cannot redefine") %
|
428
|
-
{ name: param.name, resource: ref }
|
429
|
-
end
|
365
|
+
_("Parameter '%{name}' is already set on %{resource} at %{error_location}; cannot redefine") %
|
366
|
+
{ name: param.name, resource: ref, error_location: error_location_str }
|
430
367
|
end
|
431
368
|
else
|
432
|
-
if
|
433
|
-
|
434
|
-
|
435
|
-
{ name: param.name, resource: ref, source: current.source.to_s, file: current.file, line: current.line }
|
436
|
-
else
|
437
|
-
_("Parameter '%{name}' is already set on %{resource} by %{source} in %{file}; cannot redefine") %
|
438
|
-
{ name: param.name, resource: ref, source: current.source.to_s, file: current.file }
|
439
|
-
end
|
369
|
+
if error_location_str.empty?
|
370
|
+
_("Parameter '%{name}' is already set on %{resource} by %{source}; cannot redefine") %
|
371
|
+
{ name: param.name, resource: ref, source: current.source.to_s }
|
440
372
|
else
|
441
|
-
|
442
|
-
|
443
|
-
{ name: param.name, resource: ref, source: current.source.to_s, line: current.line }
|
444
|
-
else
|
445
|
-
_("Parameter '%{name}' is already set on %{resource} by %{source}; cannot redefine") %
|
446
|
-
{ name: param.name, resource: ref, source: current.source.to_s }
|
447
|
-
end
|
373
|
+
_("Parameter '%{name}' is already set on %{resource} by %{source} at %{error_location}; cannot redefine") %
|
374
|
+
{ name: param.name, resource: ref, source: current.source.to_s, error_location: error_location_str }
|
448
375
|
end
|
449
376
|
end
|
450
377
|
raise Puppet::ParseError.new(msg, param.file, param.line)
|
@@ -378,7 +378,7 @@ class Puppet::Parser::Scope
|
|
378
378
|
if compiler.is_a? Puppet::Parser::AbstractCompiler
|
379
379
|
@compiler = compiler
|
380
380
|
else
|
381
|
-
raise Puppet::DevError, "you must pass a compiler instance to a new scope object"
|
381
|
+
raise Puppet::DevError, _("you must pass a compiler instance to a new scope object")
|
382
382
|
end
|
383
383
|
|
384
384
|
set_options(options)
|
@@ -638,11 +638,9 @@ class Puppet::Parser::Scope
|
|
638
638
|
unless Puppet[:strict_variables]
|
639
639
|
# Do not issue warning if strict variables are on, as an error will be raised by variable_not_found
|
640
640
|
location = if position[:lineproc]
|
641
|
-
|
642
|
-
elsif position[:file] && position[:line]
|
643
|
-
" at #{position[:file]}:#{position[:line]}"
|
641
|
+
Puppet::Util::Errors.error_location_with_space(nil, position[:lineproc].call)
|
644
642
|
else
|
645
|
-
|
643
|
+
Puppet::Util::Errors.error_location_with_space(position[:file], position[:line])
|
646
644
|
end
|
647
645
|
variable_not_found("#{class_name}::#{variable_name}", "#{reason}#{location}")
|
648
646
|
return nil
|
@@ -765,7 +763,7 @@ class Puppet::Parser::Scope
|
|
765
763
|
raise Puppet::ParseError.new(_("Cannot assign to a numeric match result variable '$%{name}'") % { name: name }) # unless options[:ephemeral]
|
766
764
|
end
|
767
765
|
unless name.is_a? String
|
768
|
-
raise Puppet::ParseError, _("Scope variable name %{
|
766
|
+
raise Puppet::ParseError, _("Scope variable name %{name} is a %{class_type}, not a string") % { name: name.inspect, class_type: name.class }
|
769
767
|
end
|
770
768
|
|
771
769
|
# Check for reserved variable names
|
@@ -1018,17 +1016,17 @@ class Puppet::Parser::Scope
|
|
1018
1016
|
|
1019
1017
|
# @api private
|
1020
1018
|
def find_resource_type(type)
|
1021
|
-
raise Puppet::DevError, "Scope#find_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead"
|
1019
|
+
raise Puppet::DevError, _("Scope#find_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead")
|
1022
1020
|
end
|
1023
1021
|
|
1024
1022
|
# @api private
|
1025
1023
|
def find_builtin_resource_type(type)
|
1026
|
-
raise Puppet::DevError, "Scope#find_builtin_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead"
|
1024
|
+
raise Puppet::DevError, _("Scope#find_builtin_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead")
|
1027
1025
|
end
|
1028
1026
|
|
1029
1027
|
# @api private
|
1030
1028
|
def find_defined_resource_type(type)
|
1031
|
-
raise Puppet::DevError, "Scope#find_defined_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead"
|
1029
|
+
raise Puppet::DevError, _("Scope#find_defined_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead")
|
1032
1030
|
end
|
1033
1031
|
|
1034
1032
|
|
@@ -1042,14 +1040,14 @@ class Puppet::Parser::Scope
|
|
1042
1040
|
if respond_to? method
|
1043
1041
|
send(method, *args)
|
1044
1042
|
else
|
1045
|
-
raise Puppet::DevError, "Function
|
1043
|
+
raise Puppet::DevError, _("Function %{name} not defined despite being loaded!") % { name: name }
|
1046
1044
|
end
|
1047
1045
|
end
|
1048
1046
|
|
1049
1047
|
# To be removed when enough time has passed after puppet 5.0.0
|
1050
1048
|
# @api private
|
1051
1049
|
def resolve_type_and_titles(type, titles)
|
1052
|
-
raise Puppet::DevError, "Scope#resolve_type_and_title() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead"
|
1050
|
+
raise Puppet::DevError, _("Scope#resolve_type_and_title() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead")
|
1053
1051
|
end
|
1054
1052
|
|
1055
1053
|
# Transforms references to classes to the form suitable for
|
@@ -1068,7 +1066,10 @@ class Puppet::Parser::Scope
|
|
1068
1066
|
def transform_and_assert_classnames(names)
|
1069
1067
|
names.map do |name|
|
1070
1068
|
case name
|
1069
|
+
when NilClass
|
1070
|
+
raise ArgumentError, _("Cannot use undef as a class name")
|
1071
1071
|
when String
|
1072
|
+
raise ArgumentError, _("Cannot use empty string as a class name") if name.empty?
|
1072
1073
|
name.sub(/^([^:]{1,2})/, '::\1')
|
1073
1074
|
|
1074
1075
|
when Puppet::Resource
|
@@ -62,7 +62,7 @@ class Puppet::Parser::TemplateWrapper
|
|
62
62
|
# @api private
|
63
63
|
def file=(filename)
|
64
64
|
unless @__file__ = Puppet::Parser::Files.find_template(filename, scope.compiler.environment)
|
65
|
-
raise Puppet::ParseError, "Could not find template '
|
65
|
+
raise Puppet::ParseError, _("Could not find template '%{filename}'") % { filename: filename }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -10,7 +10,8 @@ class CollectorTransformer
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def transform(o, scope)
|
13
|
-
|
13
|
+
#TRANSLATORS 'CollectExpression' is a class name and should not be translated
|
14
|
+
raise ArgumentError, _("Expected CollectExpression") unless o.is_a? Model::CollectExpression
|
14
15
|
|
15
16
|
raise "LHS is not a type" unless o.type_expr.is_a? Model::QualifiedReference
|
16
17
|
type = o.type_expr.value().downcase()
|
@@ -27,7 +27,7 @@ class Puppet::Pops::Evaluator::Collectors::AbstractCollector
|
|
27
27
|
@scope = scope
|
28
28
|
|
29
29
|
if !(overrides.nil? || overrides[:parameters])
|
30
|
-
raise ArgumentError, "Exported resource try to override without parameters"
|
30
|
+
raise ArgumentError, _("Exported resource try to override without parameters")
|
31
31
|
end
|
32
32
|
|
33
33
|
@overrides = overrides
|
@@ -4,7 +4,9 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
4
4
|
|
5
5
|
def self.inline_epp(scope, epp_source, template_args = nil)
|
6
6
|
unless epp_source.is_a?(String)
|
7
|
-
|
7
|
+
#TRANSLATORS 'inline_epp()' is a method name and 'epp' refers to 'Embedded Puppet (EPP) template' and should not be translated
|
8
|
+
raise ArgumentError, _("inline_epp(): the first argument must be a String with the epp source text, got a %{class_name}") %
|
9
|
+
{ class_name: epp_source.class }
|
8
10
|
end
|
9
11
|
|
10
12
|
# Parse and validate the source
|
@@ -12,7 +14,8 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
12
14
|
begin
|
13
15
|
result = parser.parse_string(epp_source, 'inlined-epp-text')
|
14
16
|
rescue Puppet::ParseError => e
|
15
|
-
|
17
|
+
#TRANSLATORS 'inline_epp()' is a method name and 'EPP' refers to 'Embedded Puppet (EPP) template' and should not be translated
|
18
|
+
raise ArgumentError, _("inline_epp(): Invalid EPP: %{detail}") % { detail: e.message }
|
16
19
|
end
|
17
20
|
|
18
21
|
# Evaluate (and check template_args)
|
@@ -21,7 +24,8 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
21
24
|
|
22
25
|
def self.epp(scope, file, env_name, template_args = nil)
|
23
26
|
unless file.is_a?(String)
|
24
|
-
|
27
|
+
#TRANSLATORS 'epp()' is a method name and should not be translated
|
28
|
+
raise ArgumentError, _("epp(): the first argument must be a String with the filename, got a %{class_name}") % { class_name: file.class }
|
25
29
|
end
|
26
30
|
|
27
31
|
unless Puppet::FileSystem.exist?(file)
|
@@ -41,7 +45,8 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
41
45
|
begin
|
42
46
|
result = parser.parse_file(template_file)
|
43
47
|
rescue Puppet::ParseError => e
|
44
|
-
|
48
|
+
#TRANSLATORS 'epp()' is a method name and 'EPP' refers to 'Embedded Puppet (EPP) template' and should not be translated
|
49
|
+
raise ArgumentError, _("epp(): Invalid EPP: %{detail}") % { detail: e.message }
|
45
50
|
end
|
46
51
|
|
47
52
|
# Evaluate (and check template_args)
|
@@ -55,13 +60,19 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
55
60
|
|
56
61
|
body = parse_result.body
|
57
62
|
unless body.is_a?(Puppet::Pops::Model::LambdaExpression)
|
58
|
-
|
63
|
+
#TRANSLATORS 'LambdaExpression' is a class name and should not be translated
|
64
|
+
raise ArgumentError, _("%{function_name}(): the parser did not produce a LambdaExpression, got '%{class_name}'") %
|
65
|
+
{ function_name: func_name, class_name: body.class }
|
59
66
|
end
|
60
67
|
unless body.body.is_a?(Puppet::Pops::Model::EppExpression)
|
61
|
-
|
68
|
+
#TRANSLATORS 'EppExpression' is a class name and should not be translated
|
69
|
+
raise ArgumentError, _("%{function_name}(): the parser did not produce an EppExpression, got '%{class_name}'") %
|
70
|
+
{ function_name: func_name, class_name: body.body.class }
|
62
71
|
end
|
63
72
|
unless parse_result.definitions.empty?
|
64
|
-
|
73
|
+
#TRANSLATORS 'EPP' refers to 'Embedded Puppet (EPP) template'
|
74
|
+
raise ArgumentError, _("%{function_name}(): The EPP template contains illegal expressions (definitions)") %
|
75
|
+
{ function_name: func_name }
|
65
76
|
end
|
66
77
|
|
67
78
|
parameters_specified = body.body.parameters_specified
|
@@ -99,7 +110,9 @@ class Puppet::Pops::Evaluator::EppEvaluator
|
|
99
110
|
[{}, false]
|
100
111
|
else
|
101
112
|
unless template_args.is_a?(Hash)
|
102
|
-
|
113
|
+
#TRANSLATORS 'template_args' is a variable name and should not be translated
|
114
|
+
raise ArgumentError, _("%{function_name}(): the template_args must be a Hash, got a %{class_name}") %
|
115
|
+
{ function_name: func_name, class_name: template_args.class }
|
103
116
|
end
|
104
117
|
[template_args, true]
|
105
118
|
end
|