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
@@ -4,6 +4,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
4
4
|
description <<-EOT
|
5
5
|
Prepares a local module for release on the Puppet Forge by building a
|
6
6
|
ready-to-upload archive file.
|
7
|
+
Note: Module build uses MD5 checksums, which are prohibited on FIPS enabled systems.
|
7
8
|
|
8
9
|
This action uses the metadata.json file in the module directory to set metadata
|
9
10
|
used by the Forge. See <https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html> for more
|
@@ -8,6 +8,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
8
8
|
summary _("Install a module from the Puppet Forge or a release archive.")
|
9
9
|
description <<-EOT
|
10
10
|
Installs a module from the Puppet Forge or from a release archive file.
|
11
|
+
Note: Module install uses MD5 checksums, which are prohibited on FIPS enabled systems.
|
11
12
|
|
12
13
|
The specified module will be installed into the directory
|
13
14
|
specified with the `--target-dir` option, which defaults to the first
|
@@ -82,13 +82,14 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
82
82
|
highlight = proc do |s|
|
83
83
|
s = s.gsub(term, colorize(:green, term))
|
84
84
|
s = s.gsub(term.gsub('/', '-'), colorize(:green, term.gsub('/', '-'))) if term =~ /\//
|
85
|
+
s = s.gsub(' DEPRECATED', colorize(:red, ' DEPRECATED'))
|
85
86
|
s
|
86
87
|
end
|
87
88
|
|
88
89
|
format % [ headers['full_name'], headers['desc'], headers['author'], headers['tag_list'] ] +
|
89
90
|
results[:answers].map do |match|
|
90
91
|
name, desc, author, keywords = %w{full_name desc author tag_list}.map { |k| match[k] }
|
91
|
-
name +=
|
92
|
+
name += ' DEPRECATED' unless match['deprecated_at'].nil?
|
92
93
|
desc = desc[0...(columns['desc'] - 3)] + '...' if desc.length > columns['desc']
|
93
94
|
highlight[format % [ name.sub('/', '-'), desc, "@#{author}", [keywords].flatten.join(' ') ]]
|
94
95
|
end.join
|
@@ -4,6 +4,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
4
4
|
description <<-EOT
|
5
5
|
Uninstalls a puppet module from the modulepath (or a specific
|
6
6
|
target directory).
|
7
|
+
Note: Module uninstall uses MD5 checksums, which are prohibited on FIPS enabled systems.
|
7
8
|
EOT
|
8
9
|
|
9
10
|
returns _("Hash of module objects representing uninstalled modules and related errors.")
|
@@ -45,7 +45,7 @@ class Puppet::FileBucket::Dipper
|
|
45
45
|
|
46
46
|
# Make a HEAD request for the file so that we don't waste time
|
47
47
|
# uploading it if it already exists in the bucket.
|
48
|
-
unless Puppet::FileBucket::File.indirection.head(file_bucket_path)
|
48
|
+
unless Puppet::FileBucket::File.indirection.head(file_bucket_path, :bucket_path => file_bucket_file.bucket_path)
|
49
49
|
Puppet::FileBucket::File.indirection.save(file_bucket_file, dest_path)
|
50
50
|
end
|
51
51
|
|
@@ -46,7 +46,8 @@ class Puppet::FileServing::Base
|
|
46
46
|
def links=(value)
|
47
47
|
value = value.to_sym
|
48
48
|
value = :manage if value == :ignore
|
49
|
-
|
49
|
+
#TRANSLATORS ':link', ':manage', ':follow' should not be translated
|
50
|
+
raise(ArgumentError, _(":links can only be set to :manage or :follow")) unless [:manage, :follow].include?(value)
|
50
51
|
@links = value
|
51
52
|
end
|
52
53
|
|
@@ -13,9 +13,9 @@ class Puppet::FileServing::Configuration::Parser
|
|
13
13
|
@mounts = {}
|
14
14
|
@count = 0
|
15
15
|
|
16
|
-
File.open(@file)
|
16
|
+
File.open(@file) do |f|
|
17
17
|
mount = nil
|
18
|
-
f.each_line
|
18
|
+
f.each_line do |line|
|
19
19
|
# Have the count increment at the top, in case we throw exceptions.
|
20
20
|
@count += 1
|
21
21
|
|
@@ -37,13 +37,17 @@ class Puppet::FileServing::Configuration::Parser
|
|
37
37
|
when "deny"
|
38
38
|
deny(mount, value)
|
39
39
|
else
|
40
|
-
|
40
|
+
error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
|
41
|
+
raise ArgumentError.new(_("Invalid argument '%{var}' at %{error_location}") %
|
42
|
+
{ var: var, error_location: error_location_str })
|
41
43
|
end
|
42
44
|
else
|
43
|
-
|
45
|
+
error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
|
46
|
+
raise ArgumentError.new(_("Invalid entry at %{error_location}: '%{file_text}'") %
|
47
|
+
{ file_text: line.chomp, error_location: error_location_str })
|
44
48
|
end
|
45
|
-
|
46
|
-
|
49
|
+
end
|
50
|
+
end
|
47
51
|
|
48
52
|
validate
|
49
53
|
|
@@ -67,7 +71,9 @@ class Puppet::FileServing::Configuration::Parser
|
|
67
71
|
mount.info _("allowing %{val} access") % { val: val }
|
68
72
|
mount.allow(val)
|
69
73
|
rescue Puppet::AuthStoreError => detail
|
70
|
-
|
74
|
+
error_location_str = Puppet::Util::Errors.error_location(@file, @count)
|
75
|
+
raise ArgumentError.new("%{detail} %{error_location}" %
|
76
|
+
{ detail: detail.to_s, error_location: error_location_str })
|
71
77
|
end
|
72
78
|
}
|
73
79
|
end
|
@@ -79,14 +85,20 @@ class Puppet::FileServing::Configuration::Parser
|
|
79
85
|
mount.info _("denying %{val} access") % { val: val }
|
80
86
|
mount.deny(val)
|
81
87
|
rescue Puppet::AuthStoreError => detail
|
82
|
-
|
88
|
+
error_location_str = Puppet::Util::Errors.error_location(@file, @count)
|
89
|
+
raise ArgumentError.new("%{detail} %{error_location}" %
|
90
|
+
{ detail: detail.to_s, error_location: error_location_str })
|
83
91
|
end
|
84
92
|
}
|
85
93
|
end
|
86
94
|
|
87
95
|
# Create a new mount.
|
88
96
|
def newmount(name)
|
89
|
-
|
97
|
+
if @mounts.include?(name)
|
98
|
+
error_location_str = Puppet::Util::Errors.error_location(@file, @count)
|
99
|
+
raise ArgumentError.new(_("%{mount} is already mounted at %{name} at %{error_location}") %
|
100
|
+
{ mount: @mounts[name], name: name, error_location: error_location_str })
|
101
|
+
end
|
90
102
|
case name
|
91
103
|
when "modules"
|
92
104
|
mount = Mount::Modules.new(name)
|
@@ -37,7 +37,7 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
|
|
37
37
|
def collect
|
38
38
|
# Prefer the checksum_type from the indirector request options
|
39
39
|
# but fall back to the alternative otherwise
|
40
|
-
[ @checksum_type, :md5, :mtime ].each do |type|
|
40
|
+
[ @checksum_type, :md5, :sha256, :sha384, :sha512, :sha224, :mtime ].each do |type|
|
41
41
|
@checksum_type = type
|
42
42
|
@checksum = @checksums[type]
|
43
43
|
return if @checksum
|
@@ -134,7 +134,8 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
134
134
|
Puppet::ModuleTool::Metadata.new.add_dependency(dep['name'], dep['version_requirement'], dep['repository'])
|
135
135
|
Puppet::ModuleTool.parse_module_dependency(release, dep, strict_semver)[0..1]
|
136
136
|
rescue ArgumentError => e
|
137
|
-
raise ArgumentError, "Malformed dependency:
|
137
|
+
raise ArgumentError, _("Malformed dependency: %{name}.") % { name: dep['name'] } +
|
138
|
+
' ' + _("Exception was: %{detail}") % { detail: e }
|
138
139
|
end
|
139
140
|
end
|
140
141
|
else
|
@@ -12,6 +12,7 @@ Puppet::Functions.create_function(:binary_file, Puppet::Functions::InternalFunct
|
|
12
12
|
def binary_file(scope, unresolved_path)
|
13
13
|
path = Puppet::Parser::Files.find_file(unresolved_path, scope.compiler.environment)
|
14
14
|
unless path && Puppet::FileSystem.exist?(path)
|
15
|
+
#TRANSLATORS the string "binary_file()" should not be translated
|
15
16
|
raise Puppet::ParseError, _("binary_file(): The given file '%{unresolved_path}' does not exist") % { unresolved_path: unresolved_path }
|
16
17
|
end
|
17
18
|
Puppet::Pops::Types::PBinaryType::Binary.from_binary_string(Puppet::FileSystem.binread(path))
|
@@ -26,8 +26,10 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
|
|
26
26
|
# Can't do this with an argument_mismatch dispatcher since there is no way to declare a struct that at least
|
27
27
|
# contains some keys but may contain other arbitrary keys.
|
28
28
|
unless options.include?('path')
|
29
|
+
#TRANSLATORS 'eyaml_lookup_key':, 'path', 'paths' 'glob', 'globs', 'mapped_paths', and lookup_key should not be translated
|
29
30
|
raise ArgumentError,
|
30
|
-
"'eyaml_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml
|
31
|
+
_("'eyaml_lookup_key': one of 'path', 'paths' 'glob', 'globs' or 'mapped_paths' must be declared in hiera.yaml"\
|
32
|
+
" when using this lookup_key function")
|
31
33
|
end
|
32
34
|
|
33
35
|
# nil key is used to indicate that the cache contains the raw content of the eyaml file
|
@@ -48,7 +50,7 @@ Puppet::Functions.create_function(:eyaml_lookup_key) do
|
|
48
50
|
if data.is_a?(Hash)
|
49
51
|
Puppet::Pops::Lookup::HieraConfig.symkeys_to_string(data)
|
50
52
|
else
|
51
|
-
Puppet.warning("
|
53
|
+
Puppet.warning(_("%{path}: file does not contain a valid yaml hash") % { path: path })
|
52
54
|
{}
|
53
55
|
end
|
54
56
|
rescue YAML::SyntaxError => ex
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Finds an existing module and returns the path to its root directory.
|
2
|
+
#
|
3
|
+
# The argument to this function should be a module name String
|
4
|
+
# For example, the reference `mysql` will search for the
|
5
|
+
# directory `<MODULES DIRECTORY>/mysql` and return the first
|
6
|
+
# found on the modulepath.
|
7
|
+
#
|
8
|
+
# This function can also accept:
|
9
|
+
#
|
10
|
+
# * Multiple String arguments, which will return the path of the **first** module
|
11
|
+
# found, skipping non existing modules.
|
12
|
+
# * An array of module names, which will return the path of the **first** module
|
13
|
+
# found from the given names in the array, skipping non existing modules.
|
14
|
+
#
|
15
|
+
# The function returns `undef` if none of the given modules were found
|
16
|
+
#
|
17
|
+
# @since 5.4.0
|
18
|
+
#
|
19
|
+
Puppet::Functions.create_function(:module_directory, Puppet::Functions::InternalFunction) do
|
20
|
+
dispatch :module_directory do
|
21
|
+
scope_param
|
22
|
+
repeated_param 'String', :names
|
23
|
+
end
|
24
|
+
|
25
|
+
dispatch :module_directory_array do
|
26
|
+
scope_param
|
27
|
+
repeated_param 'Array[String]', :names
|
28
|
+
end
|
29
|
+
|
30
|
+
def module_directory_array(scope, names)
|
31
|
+
module_directory(scope, *names)
|
32
|
+
end
|
33
|
+
|
34
|
+
def module_directory(scope, *names)
|
35
|
+
names.each do |module_name|
|
36
|
+
found = scope.compiler.environment.module(module_name)
|
37
|
+
return found.path if found
|
38
|
+
end
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
@@ -36,7 +36,7 @@ Puppet::Functions.create_function(:strftime) do
|
|
36
36
|
line = nil
|
37
37
|
end
|
38
38
|
Puppet.warn_once('deprecations', 'legacy#strftime',
|
39
|
-
_('The argument signature (String format, [String timezone]) is deprecated for #
|
39
|
+
_('The argument signature (String format, [String timezone]) is deprecated for #strftime. See #strftime documentation and Timespan type for more info'),
|
40
40
|
file, line)
|
41
41
|
Puppet::Pops::Time::Timestamp.format_time(format, Time.now.utc, timezone)
|
42
42
|
end
|
@@ -25,7 +25,7 @@ Puppet::Functions.create_function(:yaml_data) do
|
|
25
25
|
if data.is_a?(Hash)
|
26
26
|
Puppet::Pops::Lookup::HieraConfig.symkeys_to_string(data)
|
27
27
|
else
|
28
|
-
Puppet.warning("
|
28
|
+
Puppet.warning(_("%{path}: file does not contain a valid yaml hash" % { path: path }))
|
29
29
|
{}
|
30
30
|
end
|
31
31
|
rescue YAML::SyntaxError => ex
|
@@ -89,7 +89,7 @@ module Puppet::GettextConfig
|
|
89
89
|
report_warning: false)
|
90
90
|
FastGettext.default_text_domain = DEFAULT_TEXT_DOMAIN
|
91
91
|
|
92
|
-
load_translations('puppet', puppet_locale_path, translation_mode(puppet_locale_path))
|
92
|
+
load_translations('puppet', puppet_locale_path, translation_mode(puppet_locale_path), DEFAULT_TEXT_DOMAIN)
|
93
93
|
end
|
94
94
|
|
95
95
|
# @api private
|
@@ -108,6 +108,7 @@ module Puppet::GettextConfig
|
|
108
108
|
def self.delete_all_text_domains
|
109
109
|
FastGettext.translation_repositories.clear
|
110
110
|
FastGettext.default_text_domain = nil
|
111
|
+
FastGettext.text_domain = nil
|
111
112
|
end
|
112
113
|
|
113
114
|
# @api private
|
@@ -117,6 +118,9 @@ module Puppet::GettextConfig
|
|
117
118
|
return if @gettext_disabled || !gettext_loaded?
|
118
119
|
|
119
120
|
FastGettext.translation_repositories.delete(domain_name)
|
121
|
+
if FastGettext.text_domain == domain_name
|
122
|
+
FastGettext.text_domain = nil
|
123
|
+
end
|
120
124
|
end
|
121
125
|
|
122
126
|
# @api private
|
@@ -130,6 +134,7 @@ module Puppet::GettextConfig
|
|
130
134
|
|
131
135
|
FastGettext.translation_repositories.delete(key)
|
132
136
|
end
|
137
|
+
FastGettext.text_domain = nil
|
133
138
|
end
|
134
139
|
|
135
140
|
# @api private
|
@@ -191,7 +196,7 @@ module Puppet::GettextConfig
|
|
191
196
|
# @param [String] locale_dir the path to the directory containing translations
|
192
197
|
# @param [Symbol] file_format translation file format to use, either :po or :mo
|
193
198
|
# @return true if initialization succeeded, false otherwise
|
194
|
-
def self.load_translations(project_name, locale_dir, file_format)
|
199
|
+
def self.load_translations(project_name, locale_dir, file_format, text_domain = FastGettext.text_domain)
|
195
200
|
if project_name.nil? || project_name.empty?
|
196
201
|
raise Puppet::Error, "A project name must be specified in order to initialize translations."
|
197
202
|
end
|
@@ -204,7 +209,7 @@ module Puppet::GettextConfig
|
|
204
209
|
raise Puppet::Error, "Unsupported translation file format #{file_format}; please use :po or :mo"
|
205
210
|
end
|
206
211
|
|
207
|
-
add_repository_to_domain(project_name, locale_dir, file_format)
|
212
|
+
add_repository_to_domain(project_name, locale_dir, file_format, text_domain)
|
208
213
|
return true
|
209
214
|
end
|
210
215
|
|
@@ -214,10 +219,10 @@ module Puppet::GettextConfig
|
|
214
219
|
# @param [String] project_name the name of the project for which to load translations
|
215
220
|
# @param [String] locale_dir the path to the directory containing translations
|
216
221
|
# @param [Symbol] file_format the fomat of the translations files, :po or :mo
|
217
|
-
def self.add_repository_to_domain(project_name, locale_dir, file_format)
|
222
|
+
def self.add_repository_to_domain(project_name, locale_dir, file_format, text_domain = FastGettext.text_domain)
|
218
223
|
return if @gettext_disabled || !gettext_loaded?
|
219
224
|
|
220
|
-
current_chain = FastGettext.translation_repositories[
|
225
|
+
current_chain = FastGettext.translation_repositories[text_domain].chain
|
221
226
|
|
222
227
|
repository = FastGettext::TranslationRepository.build(project_name,
|
223
228
|
path: locale_dir,
|
@@ -70,7 +70,7 @@ class Puppet::Graph::RelationshipGraph < Puppet::Graph::SimpleGraph
|
|
70
70
|
if @blockers[resource] > 0
|
71
71
|
@blockers[resource] -= 1
|
72
72
|
else
|
73
|
-
resource.warning "appears to have a negative number of dependencies"
|
73
|
+
resource.warning _("appears to have a negative number of dependencies")
|
74
74
|
end
|
75
75
|
@blockers[resource] <= 0
|
76
76
|
end
|
@@ -91,7 +91,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
91
91
|
elsif format == 'application/json'
|
92
92
|
return Puppet::Node::Facts.convert_from('json', CGI.unescape(facts))
|
93
93
|
else
|
94
|
-
raise ArgumentError, "Unsupported facts format"
|
94
|
+
raise ArgumentError, _("Unsupported facts format")
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -8,7 +8,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
|
|
8
8
|
external_command = command
|
9
9
|
|
10
10
|
# Make sure it's an array
|
11
|
-
raise Puppet::DevError, "Exec commands must be an array" unless external_command.is_a?(Array)
|
11
|
+
raise Puppet::DevError, _("Exec commands must be an array") unless external_command.is_a?(Array)
|
12
12
|
|
13
13
|
# Make sure it's fully qualified.
|
14
14
|
raise ArgumentError, _("You must set the exec parameter to a fully qualified command") unless Puppet::Util.absolute_path?(external_command[0])
|
@@ -11,11 +11,11 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def destroy(facts)
|
14
|
-
raise Puppet::DevError, 'You cannot destroy facts in the code store; it is only used for getting facts from Facter'
|
14
|
+
raise Puppet::DevError, _('You cannot destroy facts in the code store; it is only used for getting facts from Facter')
|
15
15
|
end
|
16
16
|
|
17
17
|
def save(facts)
|
18
|
-
raise Puppet::DevError, 'You cannot save facts to the code store; it is only used for getting facts from Facter'
|
18
|
+
raise Puppet::DevError, _('You cannot save facts to the code store; it is only used for getting facts from Facter')
|
19
19
|
end
|
20
20
|
|
21
21
|
# Lookup a host's facts up in Facter.
|
@@ -55,7 +55,7 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
|
|
55
55
|
# print out each .rb in the facts directory as module
|
56
56
|
# developers may find that information useful for debugging purposes
|
57
57
|
if Puppet::Util::Log.sendlevel?(:info)
|
58
|
-
Puppet.info "Loading facts"
|
58
|
+
Puppet.info _("Loading facts")
|
59
59
|
Dir.glob("#{dir}/*.rb").each do |file|
|
60
60
|
Puppet.debug "Loading facts from #{file}"
|
61
61
|
end
|
@@ -18,10 +18,10 @@ class Puppet::Node::Facts::NetworkDevice < Puppet::Indirector::Code
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def destroy(facts)
|
21
|
-
raise Puppet::DevError, "You cannot destroy facts in the code store; it is only used for getting facts from a remote device"
|
21
|
+
raise Puppet::DevError, _("You cannot destroy facts in the code store; it is only used for getting facts from a remote device")
|
22
22
|
end
|
23
23
|
|
24
24
|
def save(facts)
|
25
|
-
raise Puppet::DevError, "You cannot save facts to the code store; it is only used for getting facts from a remote device"
|
25
|
+
raise Puppet::DevError, _("You cannot save facts to the code store; it is only used for getting facts from a remote device")
|
26
26
|
end
|
27
27
|
end
|
@@ -29,6 +29,7 @@ module Puppet::FileBucketFile
|
|
29
29
|
raise _("Unable to diff on this platform") unless Puppet[:diff] != ""
|
30
30
|
return diff(Puppet::FileSystem.path_string(contents_file), Puppet::FileSystem.path_string(other_contents_file))
|
31
31
|
else
|
32
|
+
#TRANSLATORS "FileBucket" should not be translated
|
32
33
|
Puppet.info _("FileBucket read %{checksum}") % { checksum: checksum }
|
33
34
|
model.new(Puppet::FileSystem.binread(contents_file))
|
34
35
|
end
|
@@ -158,8 +159,13 @@ module Puppet::FileBucketFile
|
|
158
159
|
Puppet::FileSystem.exclusive_open(paths_file, 0640, 'a+:external') do |f|
|
159
160
|
if Puppet::FileSystem.exist?(contents_file)
|
160
161
|
if verify_identical_file(contents_file, bucket_file)
|
161
|
-
|
162
|
-
Puppet
|
162
|
+
#TRANSLATORS "FileBucket" should not be translated
|
163
|
+
Puppet.info _("FileBucket got a duplicate file %{file_checksum}") % { file_checksum: bucket_file.checksum }
|
164
|
+
# Don't touch the contents file on Windows, since we can't update the
|
165
|
+
# mtime of read-only files there.
|
166
|
+
if !Puppet::Util::Platform.windows?
|
167
|
+
Puppet::FileSystem.touch(contents_file)
|
168
|
+
end
|
163
169
|
elsif contents_file_matches_checksum?(contents_file, bucket_file.checksum_data, bucket_file.checksum_type)
|
164
170
|
# If the contents or sizes don't match, but the checksum does,
|
165
171
|
# then we've found a conflict (potential hash collision).
|
@@ -167,6 +173,7 @@ module Puppet::FileBucketFile
|
|
167
173
|
# needed, but ask the user to validate.
|
168
174
|
# Note: Don't print the full path to the bucket file in the
|
169
175
|
# exception to avoid disclosing file system layout on server.
|
176
|
+
#TRANSLATORS "FileBucket" should not be translated
|
170
177
|
Puppet.err(_("Unable to verify existing FileBucket backup at '%{path}'.") % { path: contents_file.to_path })
|
171
178
|
raise Puppet::FileBucket::BucketError, _("Existing backup and new file have different content but same checksum, %{value}. Verify existing backup and remove if incorrect.") %
|
172
179
|
{ value: bucket_file.checksum }
|
@@ -243,7 +250,7 @@ module Puppet::FileBucketFile
|
|
243
250
|
# @return [void]
|
244
251
|
# @api private
|
245
252
|
def copy_bucket_file_to_contents_file(contents_file, bucket_file)
|
246
|
-
Puppet::
|
253
|
+
Puppet::Util.replace_file(contents_file, 0440) do |of|
|
247
254
|
# PUP-1044 writes all of the contents
|
248
255
|
bucket_file.stream() do |src|
|
249
256
|
FileUtils.copy_stream(src, of)
|
@@ -37,7 +37,7 @@ class Puppet::Indirector::Indirection
|
|
37
37
|
|
38
38
|
# Create and return our cache terminus.
|
39
39
|
def cache
|
40
|
-
raise
|
40
|
+
raise Puppet::DevError, _("Tried to cache when no cache class was set") unless cache_class
|
41
41
|
terminus(cache_class)
|
42
42
|
end
|
43
43
|
|
@@ -97,7 +97,7 @@ class Puppet::Indirector::Indirection
|
|
97
97
|
@cache_class = nil
|
98
98
|
@terminus_class = nil
|
99
99
|
|
100
|
-
raise(ArgumentError, "Indirection
|
100
|
+
raise(ArgumentError, _("Indirection %{name} is already defined") % { name: @name }) if @@indirections.find { |i| i.name == @name }
|
101
101
|
@@indirections << self
|
102
102
|
|
103
103
|
@indirected_class = options.delete(:indirected_class)
|
@@ -118,7 +118,7 @@ class Puppet::Indirector::Indirection
|
|
118
118
|
# Return the singleton terminus for this indirection.
|
119
119
|
def terminus(terminus_name = nil)
|
120
120
|
# Get the name of the terminus.
|
121
|
-
raise Puppet::DevError, "No terminus specified for
|
121
|
+
raise Puppet::DevError, _("No terminus specified for %{name}; cannot redirect") % { name: self.name } unless terminus_name ||= terminus_class
|
122
122
|
|
123
123
|
termini[terminus_name] ||= make_terminus(terminus_name)
|
124
124
|
end
|
@@ -132,7 +132,7 @@ class Puppet::Indirector::Indirection
|
|
132
132
|
if setting = self.terminus_setting
|
133
133
|
self.terminus_class = Puppet.settings[setting]
|
134
134
|
else
|
135
|
-
raise Puppet::DevError, "No terminus class nor terminus setting was provided for indirection
|
135
|
+
raise Puppet::DevError, _("No terminus class nor terminus setting was provided for indirection %{name}") % { name: self.name}
|
136
136
|
end
|
137
137
|
end
|
138
138
|
@terminus_class
|
@@ -150,9 +150,12 @@ class Puppet::Indirector::Indirection
|
|
150
150
|
|
151
151
|
# This is used by terminus_class= and cache=.
|
152
152
|
def validate_terminus_class(terminus_class)
|
153
|
-
|
153
|
+
unless terminus_class and terminus_class.to_s != ""
|
154
|
+
raise ArgumentError, _("Invalid terminus name %{terminus_class}") % { terminus_class: terminus_class.inspect }
|
155
|
+
end
|
154
156
|
unless Puppet::Indirector::Terminus.terminus_class(self.name, terminus_class)
|
155
|
-
raise ArgumentError, "Could not find terminus
|
157
|
+
raise ArgumentError, _("Could not find terminus %{terminus_class} for indirection %{name}") %
|
158
|
+
{ terminus_class: terminus_class, name: self.name }
|
156
159
|
end
|
157
160
|
end
|
158
161
|
|
@@ -266,7 +269,7 @@ class Puppet::Indirector::Indirection
|
|
266
269
|
terminus = prepare(request)
|
267
270
|
|
268
271
|
if result = terminus.search(request)
|
269
|
-
raise Puppet::DevError, "Search results from terminus
|
272
|
+
raise Puppet::DevError, _("Search results from terminus %{terminus_name} are not an array") % { terminus_name: terminus.name } unless result.is_a?(Array)
|
270
273
|
result.each do |instance|
|
271
274
|
next unless instance.respond_to? :expiration
|
272
275
|
instance.expiration ||= self.expiration
|
@@ -302,8 +305,13 @@ class Puppet::Indirector::Indirection
|
|
302
305
|
return unless terminus.respond_to?(:authorized?)
|
303
306
|
|
304
307
|
unless terminus.authorized?(request)
|
305
|
-
msg =
|
306
|
-
|
308
|
+
msg = if request.options.empty?
|
309
|
+
_("Not authorized to call %{method} on %{description}") %
|
310
|
+
{ method: request.method, description: request.description }
|
311
|
+
else
|
312
|
+
_("Not authorized to call %{method} on %{description} with %{option}") %
|
313
|
+
{ method: request.method, description: request.description, option: request.options.inspect }
|
314
|
+
end
|
307
315
|
raise ArgumentError, msg
|
308
316
|
end
|
309
317
|
end
|