puppet 5.3.3-x86-mingw32 → 5.3.4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +3 -0
- data/ext/puppet-test +3 -2
- data/lib/hiera/puppet_function.rb +5 -2
- data/lib/hiera_puppet.rb +3 -3
- data/lib/puppet.rb +2 -5
- data/lib/puppet/agent.rb +22 -2
- data/lib/puppet/agent/locker.rb +6 -5
- data/lib/puppet/application.rb +18 -1
- data/lib/puppet/application/agent.rb +9 -2
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/config.rb +1 -0
- data/lib/puppet/application/device.rb +1 -2
- data/lib/puppet/application/filebucket.rb +22 -5
- data/lib/puppet/application/help.rb +1 -0
- data/lib/puppet/application/lookup.rb +1 -3
- data/lib/puppet/application_support.rb +6 -1
- data/lib/puppet/bindings.rb +2 -1
- data/lib/puppet/configurer.rb +9 -4
- data/lib/puppet/configurer/downloader_factory.rb +10 -0
- data/lib/puppet/configurer/plugin_handler.rb +11 -4
- data/lib/puppet/daemon.rb +2 -2
- data/lib/puppet/defaults.rb +99 -27
- data/lib/puppet/environments.rb +2 -0
- data/lib/puppet/error.rb +5 -15
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/config.rb +14 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +12 -14
- data/lib/puppet/face/man.rb +1 -0
- data/lib/puppet/face/module/build.rb +1 -1
- data/lib/puppet/face/module/list.rb +6 -17
- data/lib/puppet/face/module/uninstall.rb +14 -3
- data/lib/puppet/face/node.rb +1 -0
- data/lib/puppet/face/status.rb +1 -0
- data/lib/puppet/file_serving/base.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +3 -0
- data/lib/puppet/file_serving/configuration/parser.rb +23 -9
- data/lib/puppet/file_serving/mount/locales.rb +35 -0
- data/lib/puppet/forge.rb +2 -1
- data/lib/puppet/forge/errors.rb +24 -22
- data/lib/puppet/functions/binary_file.rb +1 -0
- data/lib/puppet/functions/each.rb +10 -4
- data/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/lib/puppet/functions/lookup.rb +2 -2
- data/lib/puppet/functions/map.rb +12 -2
- data/lib/puppet/functions/slice.rb +2 -3
- data/lib/puppet/functions/unique.rb +1 -1
- data/lib/puppet/functions/yaml_data.rb +1 -1
- data/lib/puppet/gettext/config.rb +144 -41
- data/lib/puppet/gettext/module_translations.rb +42 -0
- data/lib/puppet/graph/relationship_graph.rb +1 -1
- data/lib/puppet/graph/simple_graph.rb +3 -3
- data/lib/puppet/indirector/catalog/compiler.rb +40 -25
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +3 -3
- data/lib/puppet/indirector/facts/network_device.rb +2 -2
- data/lib/puppet/indirector/file_bucket_file/file.rb +4 -1
- data/lib/puppet/indirector/indirection.rb +17 -9
- data/lib/puppet/indirector/ldap.rb +2 -2
- data/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
- data/lib/puppet/indirector/rest.rb +8 -5
- data/lib/puppet/indirector/ssl_file.rb +2 -2
- data/lib/puppet/indirector/terminus.rb +3 -3
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +41 -24
- data/lib/puppet/interface/action_builder.rb +14 -5
- data/lib/puppet/interface/action_manager.rb +1 -1
- data/lib/puppet/interface/documentation.rb +21 -10
- data/lib/puppet/interface/face_collection.rb +4 -2
- data/lib/puppet/interface/option.rb +36 -15
- data/lib/puppet/interface/option_builder.rb +23 -9
- data/lib/puppet/interface/option_manager.rb +8 -3
- data/lib/puppet/metatype/manager.rb +7 -3
- data/lib/puppet/module.rb +18 -21
- data/lib/puppet/module_tool/errors/installer.rb +18 -20
- data/lib/puppet/module_tool/errors/shared.rb +20 -15
- data/lib/puppet/module_tool/errors/uninstaller.rb +1 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/tar/mini.rb +57 -4
- data/lib/puppet/network/auth_config_parser.rb +18 -13
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/client_request.rb +1 -1
- data/lib/puppet/network/format.rb +3 -3
- data/lib/puppet/network/http/api/indirection_type.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
- data/lib/puppet/network/http/error.rb +7 -7
- data/lib/puppet/network/http/factory.rb +9 -0
- data/lib/puppet/network/http/rack.rb +2 -2
- data/lib/puppet/network/http/webrick.rb +2 -4
- data/lib/puppet/node.rb +25 -6
- data/lib/puppet/node/environment.rb +14 -0
- data/lib/puppet/node/facts.rb +9 -0
- data/lib/puppet/parameter.rb +3 -3
- data/lib/puppet/parameter/value_collection.rb +9 -9
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/ast/node.rb +2 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
- data/lib/puppet/parser/compiler.rb +6 -5
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +2 -4
- data/lib/puppet/parser/functions/inline_template.rb +1 -2
- data/lib/puppet/parser/functions/sprintf.rb +17 -3
- data/lib/puppet/parser/functions/template.rb +6 -2
- data/lib/puppet/parser/resource.rb +30 -31
- data/lib/puppet/parser/scope.rb +20 -11
- data/lib/puppet/parser/templatewrapper.rb +4 -3
- data/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/lib/puppet/pops/functions/function.rb +8 -2
- data/lib/puppet/pops/issue_reporter.rb +7 -2
- data/lib/puppet/pops/issues.rb +10 -4
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/loader/module_loaders.rb +5 -2
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/loaders.rb +7 -3
- data/lib/puppet/pops/lookup/explainer.rb +2 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
- data/lib/puppet/pops/lookup/lookup_adapter.rb +4 -4
- data/lib/puppet/pops/merge_strategy.rb +6 -3
- data/lib/puppet/pops/migration/migration_checker.rb +8 -8
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
- data/lib/puppet/pops/types/iterable.rb +2 -0
- data/lib/puppet/pops/types/p_object_type.rb +36 -15
- data/lib/puppet/pops/types/type_calculator.rb +2 -1
- data/lib/puppet/pops/types/type_factory.rb +3 -1
- data/lib/puppet/pops/types/type_mismatch_describer.rb +19 -6
- data/lib/puppet/pops/types/type_parser.rb +7 -7
- data/lib/puppet/pops/types/types.rb +10 -4
- data/lib/puppet/pops/validation.rb +14 -12
- data/lib/puppet/property.rb +14 -6
- data/lib/puppet/property/ensure.rb +2 -2
- data/lib/puppet/provider.rb +4 -4
- data/lib/puppet/provider/group/aix.rb +4 -2
- data/lib/puppet/provider/ldap.rb +2 -2
- data/lib/puppet/provider/naginator.rb +1 -1
- data/lib/puppet/provider/nameservice.rb +7 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +7 -8
- data/lib/puppet/provider/package/opkg.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +9 -6
- data/lib/puppet/provider/package/pkgutil.rb +3 -3
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/parsedfile.rb +4 -4
- data/lib/puppet/provider/selmodule/semodule.rb +5 -3
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/init.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +1 -0
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +13 -6
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -1
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +4 -2
- data/lib/puppet/relationship.rb +2 -1
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/resource.rb +7 -5
- data/lib/puppet/resource/capability_finder.rb +14 -11
- data/lib/puppet/resource/catalog.rb +33 -18
- data/lib/puppet/resource/type.rb +5 -5
- data/lib/puppet/settings.rb +19 -13
- data/lib/puppet/settings/base_setting.rb +23 -8
- data/lib/puppet/settings/config_file.rb +14 -4
- data/lib/puppet/settings/environment_conf.rb +19 -9
- data/lib/puppet/ssl/base.rb +9 -4
- data/lib/puppet/ssl/oids.rb +8 -2
- data/lib/puppet/syntax_checkers/base64.rb +5 -6
- data/lib/puppet/transaction.rb +7 -3
- data/lib/puppet/transaction/persistence.rb +16 -1
- data/lib/puppet/transaction/report.rb +6 -0
- data/lib/puppet/type.rb +27 -35
- data/lib/puppet/type/file.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/group.rb +1 -1
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/schedule.rb +26 -14
- data/lib/puppet/type/user.rb +9 -3
- data/lib/puppet/type/zone.rb +1 -1
- data/lib/puppet/util.rb +27 -21
- data/lib/puppet/util/at_fork/solaris.rb +6 -4
- data/lib/puppet/util/command_line.rb +5 -0
- data/lib/puppet/util/command_line/trollop.rb +6 -5
- data/lib/puppet/util/errors.rb +61 -8
- data/lib/puppet/util/fileparsing.rb +3 -5
- data/lib/puppet/util/http_proxy.rb +14 -6
- data/lib/puppet/util/instance_loader.rb +1 -3
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +19 -24
- data/lib/puppet/util/logging.rb +21 -28
- data/lib/puppet/util/methodhelper.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +21 -13
- data/lib/puppet/util/plist.rb +3 -1
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/lib/puppet/util/reference.rb +2 -3
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/storage.rb +2 -2
- data/lib/puppet/util/windows/eventlog.rb +10 -5
- data/lib/puppet/util/windows/file.rb +61 -9
- data/lib/puppet/util/windows/process.rb +1 -1
- data/lib/puppet/util/windows/taskscheduler.rb +2 -2
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/en/puppet.po +19 -0
- data/locales/ja/puppet.po +2739 -809
- data/locales/puppet.pot +2367 -734
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
- data/spec/integration/agent/logging_spec.rb +2 -0
- data/spec/integration/faces/plugin_spec.rb +1 -0
- data/spec/integration/network/authconfig_spec.rb +2 -2
- data/spec/integration/parser/collection_spec.rb +2 -2
- data/spec/integration/parser/scope_spec.rb +16 -3
- data/spec/integration/provider/cron/crontab_spec.rb +1 -0
- data/spec/integration/transaction/report_spec.rb +5 -0
- data/spec/lib/matchers/json.rb +14 -13
- data/spec/unit/agent_spec.rb +33 -0
- data/spec/unit/application/config_spec.rb +4 -0
- data/spec/unit/application/lookup_spec.rb +30 -0
- data/spec/unit/application_spec.rb +18 -0
- data/spec/unit/configurer/downloader_factory_spec.rb +33 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +71 -16
- data/spec/unit/environments_spec.rb +15 -0
- data/spec/unit/face/config_spec.rb +8 -9
- data/spec/unit/face/epp_face_spec.rb +2 -2
- data/spec/unit/face/plugin_spec.rb +50 -4
- data/spec/unit/file_serving/configuration/parser_spec.rb +2 -2
- data/spec/unit/file_serving/mount/locales_spec.rb +73 -0
- data/spec/unit/functions/break_spec.rb +108 -50
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/hiera_spec.rb +0 -1
- data/spec/unit/functions/lookup_spec.rb +85 -19
- data/spec/unit/functions/next_spec.rb +1 -1
- data/spec/unit/functions/return_spec.rb +2 -2
- data/spec/unit/gettext/config_spec.rb +125 -0
- data/spec/unit/gettext/module_loading_spec.rb +53 -0
- data/spec/unit/indirector/json_spec.rb +0 -11
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +1 -1
- data/spec/unit/interface_spec.rb +12 -0
- data/spec/unit/module_spec.rb +0 -28
- data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
- data/spec/unit/network/http/factory_spec.rb +22 -0
- data/spec/unit/network/http/webrick_spec.rb +30 -29
- data/spec/unit/node/environment_spec.rb +16 -0
- data/spec/unit/node_spec.rb +102 -16
- data/spec/unit/parser/environment_compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
- data/spec/unit/parser/resource/param_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +9 -9
- data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_containers_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
- data/spec/unit/provider/selmodule_spec.rb +6 -0
- data/spec/unit/provider/service/init_spec.rb +1 -1
- data/spec/unit/provider/service/smf_spec.rb +2 -0
- data/spec/unit/provider/service/systemd_spec.rb +14 -0
- data/spec/unit/resource/catalog_spec.rb +12 -2
- data/spec/unit/settings/config_file_spec.rb +1 -1
- data/spec/unit/transaction/persistence_spec.rb +42 -0
- data/spec/unit/transaction/report_spec.rb +19 -4
- data/spec/unit/transaction_spec.rb +27 -0
- data/spec/unit/type/schedule_spec.rb +14 -0
- data/spec/unit/type_spec.rb +3 -3
- data/spec/unit/util/errors_spec.rb +1 -1
- data/spec/unit/util/http_proxy_spec.rb +37 -0
- data/spec/unit/util/log_spec.rb +3 -3
- data/spec/unit/util/logging_spec.rb +7 -7
- data/spec/unit/util/monkey_patches_spec.rb +6 -2
- metadata +3445 -3416
- checksums.yaml +0 -7
- data/spec/unit/gettext_config_spec.rb +0 -57
@@ -111,7 +111,7 @@ module Puppet::Interface::FaceCollection
|
|
111
111
|
nil
|
112
112
|
rescue SyntaxError => e
|
113
113
|
raise unless e.message =~ %r{#{path}\.rb:\d+: }
|
114
|
-
Puppet.err "Failed to load face
|
114
|
+
Puppet.err _("Failed to load face %{name}:\n%{detail}") % { name: name, detail: e }
|
115
115
|
# ...but we just carry on after complaining.
|
116
116
|
nil
|
117
117
|
end
|
@@ -122,7 +122,9 @@ module Puppet::Interface::FaceCollection
|
|
122
122
|
|
123
123
|
def self.underscorize(name)
|
124
124
|
unless name.to_s =~ /^[-_a-z][-_a-z0-9]*$/i then
|
125
|
-
|
125
|
+
#TRANSLATORS 'face' refers to a programming API in Puppet
|
126
|
+
raise ArgumentError, _("%{name} (%{class_name}) is not a valid face name") %
|
127
|
+
{ name: name.inspect, class_name: name.class }
|
126
128
|
end
|
127
129
|
|
128
130
|
name.to_s.downcase.split(/[-_]/).join('_').to_sym
|
@@ -18,7 +18,7 @@ class Puppet::Interface::Option
|
|
18
18
|
declaration.each do |item|
|
19
19
|
if item.is_a? String and item.to_s =~ /^-/ then
|
20
20
|
unless item =~ /^-[a-z]\b/ or item =~ /^--[^-]/ then
|
21
|
-
raise ArgumentError, "
|
21
|
+
raise ArgumentError, _("%{option}: long options need two dashes (--)") % { option: item.inspect }
|
22
22
|
end
|
23
23
|
@optparse << item
|
24
24
|
|
@@ -33,20 +33,21 @@ class Puppet::Interface::Option
|
|
33
33
|
# jeffweiss 17 april 2012
|
34
34
|
name = optparse_to_optionname(item)
|
35
35
|
if Puppet.settings.include? name then
|
36
|
-
raise ArgumentError, "
|
36
|
+
raise ArgumentError, _("%{option}: already defined in puppet") % { option: item.inspect }
|
37
37
|
end
|
38
38
|
if dup = dups[name] then
|
39
|
-
raise ArgumentError, "
|
39
|
+
raise ArgumentError, _("%{option}: duplicates existing alias %{duplicate} in %{parent}") %
|
40
|
+
{ option: item.inspect, duplicate: dup.inspect, parent: @parent }
|
40
41
|
else
|
41
42
|
dups[name] = item
|
42
43
|
end
|
43
44
|
else
|
44
|
-
raise ArgumentError, "
|
45
|
+
raise ArgumentError, _("%{option} is not valid for an option argument") % { option: item.inspect }
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
49
|
if @optparse.empty? then
|
49
|
-
raise ArgumentError, "No option declarations found while building"
|
50
|
+
raise ArgumentError, _("No option declarations found while building")
|
50
51
|
end
|
51
52
|
|
52
53
|
# Now, infer the name from the options; we prefer the first long option as
|
@@ -59,15 +60,17 @@ class Puppet::Interface::Option
|
|
59
60
|
# relax this rule later if we find a valid use case for it. --daniel 2011-03-30
|
60
61
|
@argument = @optparse.any? { |o| o =~ /[ =]/ }
|
61
62
|
if @argument and not @optparse.all? { |o| o =~ /[ =]/ } then
|
62
|
-
raise ArgumentError, "Option
|
63
|
+
raise ArgumentError, _("Option %{name} is inconsistent about taking an argument") % { name: @name }
|
63
64
|
end
|
64
65
|
|
65
66
|
# Is our argument optional? The rules about consistency apply here, also,
|
66
67
|
# just like they do to taking arguments at all. --daniel 2011-03-30
|
67
68
|
@optional_argument = @optparse.any? { |o| o=~/[ =]\[/ }
|
68
|
-
@optional_argument
|
69
|
+
if @optional_argument
|
70
|
+
raise ArgumentError, _("Options with optional arguments are not supported")
|
71
|
+
end
|
69
72
|
if @optional_argument and not @optparse.all? { |o| o=~/[ =]\[/ } then
|
70
|
-
raise ArgumentError, "Option
|
73
|
+
raise ArgumentError, _("Option %{name} is inconsistent about the argument being optional") % { name: @name }
|
71
74
|
end
|
72
75
|
end
|
73
76
|
|
@@ -82,7 +85,7 @@ class Puppet::Interface::Option
|
|
82
85
|
# @api private
|
83
86
|
def optparse_to_optionname(declaration)
|
84
87
|
unless found = declaration.match(/^-+(?:\[no-\])?([^ =]+)/) then
|
85
|
-
raise ArgumentError, "Can't find a name in the declaration
|
88
|
+
raise ArgumentError, _("Can't find a name in the declaration %{declaration}") % { declaration: declaration.inspect }
|
86
89
|
end
|
87
90
|
found.captures.first
|
88
91
|
end
|
@@ -90,7 +93,9 @@ class Puppet::Interface::Option
|
|
90
93
|
# @api private
|
91
94
|
def optparse_to_name(declaration)
|
92
95
|
name = optparse_to_optionname(declaration).tr('-', '_')
|
93
|
-
|
96
|
+
unless name.to_s =~ /^[a-z]\w*$/
|
97
|
+
raise _("%{name} is an invalid option name") % { name: name.inspect }
|
98
|
+
end
|
94
99
|
name.to_sym
|
95
100
|
end
|
96
101
|
|
@@ -110,8 +115,14 @@ class Puppet::Interface::Option
|
|
110
115
|
end
|
111
116
|
|
112
117
|
def default=(proc)
|
113
|
-
required
|
114
|
-
|
118
|
+
if required
|
119
|
+
raise ArgumentError, _("%{name} can't be optional and have a default value") % { name: self }
|
120
|
+
end
|
121
|
+
unless proc.is_a? Proc
|
122
|
+
#TRANSLATORS 'proc' is a Ruby block of code
|
123
|
+
raise ArgumentError, _("default value for %{name} is a %{class_name}, not a proc") %
|
124
|
+
{ name: self, class_name: proc.class.name.inspect }
|
125
|
+
end
|
115
126
|
@default = proc
|
116
127
|
end
|
117
128
|
|
@@ -122,20 +133,30 @@ class Puppet::Interface::Option
|
|
122
133
|
attr_reader :parent, :name, :aliases, :optparse
|
123
134
|
attr_accessor :required
|
124
135
|
def required=(value)
|
125
|
-
has_default?
|
136
|
+
if has_default?
|
137
|
+
raise ArgumentError, _("%{name} can't be optional and have a default value") % { name: self }
|
138
|
+
end
|
126
139
|
@required = value
|
127
140
|
end
|
128
141
|
|
129
142
|
attr_accessor :before_action
|
130
143
|
def before_action=(proc)
|
131
|
-
proc.is_a? Proc
|
144
|
+
unless proc.is_a? Proc
|
145
|
+
#TRANSLATORS 'proc' is a Ruby block of code
|
146
|
+
raise ArgumentError, _("before action hook for %{name} is a %{class_name}, not a proc") %
|
147
|
+
{ name: self, class_name: proc.class.name.inspect }
|
148
|
+
end
|
132
149
|
@before_action =
|
133
150
|
@parent.__send__(:__add_method, __decoration_name(:before), proc)
|
134
151
|
end
|
135
152
|
|
136
153
|
attr_accessor :after_action
|
137
154
|
def after_action=(proc)
|
138
|
-
proc.is_a? Proc
|
155
|
+
unless proc.is_a? Proc
|
156
|
+
#TRANSLATORS 'proc' is a Ruby block of code
|
157
|
+
raise ArgumentError, _("after action hook for %{name} is a %{class_name}, not a proc") %
|
158
|
+
{ name: self, class_name: proc.class.name.inspect }
|
159
|
+
end
|
139
160
|
@after_action =
|
140
161
|
@parent.__send__(:__add_method, __decoration_name(:after), proc)
|
141
162
|
end
|
@@ -40,12 +40,17 @@ class Puppet::Interface::OptionBuilder
|
|
40
40
|
# @api public
|
41
41
|
# @dsl Faces
|
42
42
|
def before_action(&block)
|
43
|
-
|
43
|
+
unless block
|
44
|
+
#TRANSLATORS 'before_action' is a method name and should not be translated
|
45
|
+
raise ArgumentError, _("%{option} before_action requires a block") % { option: @option }
|
46
|
+
end
|
44
47
|
if @option.before_action
|
45
|
-
|
48
|
+
#TRANSLATORS 'before_action' is a method name and should not be translated
|
49
|
+
raise ArgumentError, _("%{option} already has a before_action set") % { option: @option }
|
46
50
|
end
|
47
51
|
unless block.arity == 3 then
|
48
|
-
|
52
|
+
#TRANSLATORS 'before_action' is a method name and should not be translated
|
53
|
+
raise ArgumentError, _("before_action takes three arguments, action, args, and options")
|
49
54
|
end
|
50
55
|
@option.before_action = block
|
51
56
|
end
|
@@ -55,12 +60,17 @@ class Puppet::Interface::OptionBuilder
|
|
55
60
|
# @api public
|
56
61
|
# @dsl Faces
|
57
62
|
def after_action(&block)
|
58
|
-
|
63
|
+
unless block
|
64
|
+
#TRANSLATORS 'after_action' is a method name and should not be translated
|
65
|
+
raise ArgumentError, _("%{option} after_action requires a block") % { option: @option }
|
66
|
+
end
|
59
67
|
if @option.after_action
|
60
|
-
|
68
|
+
#TRANSLATORS 'after_action' is a method name and should not be translated
|
69
|
+
raise ArgumentError, _("%{option} already has an after_action set") % { option: @option }
|
61
70
|
end
|
62
71
|
unless block.arity == 3 then
|
63
|
-
|
72
|
+
#TRANSLATORS 'after_action' is a method name and should not be translated
|
73
|
+
raise ArgumentError, _("after_action takes three arguments, action, args, and options")
|
64
74
|
end
|
65
75
|
@option.after_action = block
|
66
76
|
end
|
@@ -79,12 +89,16 @@ class Puppet::Interface::OptionBuilder
|
|
79
89
|
# @api public
|
80
90
|
# @dsl Faces
|
81
91
|
def default_to(&block)
|
82
|
-
|
92
|
+
unless block
|
93
|
+
#TRANSLATORS 'default_to' is a method name and should not be translated
|
94
|
+
raise ArgumentError, _("%{option} default_to requires a block") % { option: @option }
|
95
|
+
end
|
83
96
|
if @option.has_default?
|
84
|
-
raise ArgumentError, "
|
97
|
+
raise ArgumentError, _("%{option} already has a default value") % { option: @option }
|
85
98
|
end
|
86
99
|
unless block.arity == 0
|
87
|
-
|
100
|
+
#TRANSLATORS 'default_to' is a method name and should not be translated
|
101
|
+
raise ArgumentError, _("%{option} default_to block should not take any arguments") % { option: @option }
|
88
102
|
end
|
89
103
|
@option.default = block
|
90
104
|
end
|
@@ -9,7 +9,10 @@ module Puppet::Interface::OptionManager
|
|
9
9
|
def display_global_options(*args)
|
10
10
|
@display_global_options ||= []
|
11
11
|
[args].flatten.each do |refopt|
|
12
|
-
|
12
|
+
unless Puppet.settings.include?(refopt)
|
13
|
+
#TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated
|
14
|
+
raise ArgumentError, _("Global option %{option} does not exist in Puppet.settings") % { option: refopt }
|
15
|
+
end
|
13
16
|
@display_global_options << refopt if refopt
|
14
17
|
end
|
15
18
|
@display_global_options.uniq!
|
@@ -51,13 +54,15 @@ module Puppet::Interface::OptionManager
|
|
51
54
|
|
52
55
|
option.aliases.each do |name|
|
53
56
|
if conflict = get_option(name) then
|
54
|
-
raise ArgumentError, "Option
|
57
|
+
raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict}") %
|
58
|
+
{ option: option, conflict: conflict }
|
55
59
|
end
|
56
60
|
|
57
61
|
actions.each do |action|
|
58
62
|
action = get_action(action)
|
59
63
|
if conflict = action.get_option(name) then
|
60
|
-
raise ArgumentError, "Option
|
64
|
+
raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict} on %{action}") %
|
65
|
+
{ option: option, conflict: conflict, action: action }
|
61
66
|
end
|
62
67
|
end
|
63
68
|
end
|
@@ -72,7 +72,9 @@ module Manager
|
|
72
72
|
def newtype(name, options = {}, &block)
|
73
73
|
# Handle backward compatibility
|
74
74
|
unless options.is_a?(Hash)
|
75
|
-
|
75
|
+
#TRANSLATORS 'Puppet::Type.newtype' should not be translated
|
76
|
+
Puppet.warning(_("Puppet::Type.newtype(%{name}) now expects a hash as the second argument, not %{argument}") %
|
77
|
+
{ name: name, argument: options.inspect})
|
76
78
|
end
|
77
79
|
|
78
80
|
# First make sure we don't have a method sitting around
|
@@ -107,7 +109,8 @@ module Manager
|
|
107
109
|
# Now define a "new<type>" method for convenience.
|
108
110
|
if self.respond_to? newmethod
|
109
111
|
# Refuse to overwrite existing methods like 'newparam' or 'newtype'.
|
110
|
-
|
112
|
+
#TRANSLATORS 'new%{method}' will become a method name, do not translate this string
|
113
|
+
Puppet.warning(_("'new%{method}' method already exists; skipping") % { method: name.to_s })
|
111
114
|
else
|
112
115
|
selfobj.send(:define_method, newmethod) do |*args|
|
113
116
|
klass.new(*args)
|
@@ -169,7 +172,8 @@ module Manager
|
|
169
172
|
end
|
170
173
|
# Try loading the type.
|
171
174
|
if typeloader.load(name, Puppet.lookup(:current_environment))
|
172
|
-
|
175
|
+
#TRANSLATORS 'puppet/type/%{name}' should not be translated
|
176
|
+
Puppet.warning(_("Loaded puppet/type/%{name} but no class was created") % { name: name }) unless @types.include? name
|
173
177
|
elsif !Puppet[:always_retry_plugins]
|
174
178
|
# PUP-5482 - Only look for a type once if plugin retry is disabled
|
175
179
|
@types[name] = nil
|
data/lib/puppet/module.rb
CHANGED
@@ -23,6 +23,7 @@ class Puppet::Module
|
|
23
23
|
"templates" => "templates",
|
24
24
|
"plugins" => "lib",
|
25
25
|
"pluginfacts" => "facts.d",
|
26
|
+
"locales" => "locales",
|
26
27
|
}
|
27
28
|
|
28
29
|
# Find and return the +module+ that +path+ belongs to. If +path+ is
|
@@ -96,9 +97,6 @@ class Puppet::Module
|
|
96
97
|
load_metadata
|
97
98
|
|
98
99
|
@absolute_path_to_manifests = Puppet::FileSystem::PathPattern.absolute(manifests)
|
99
|
-
|
100
|
-
# i18n initialization for modules
|
101
|
-
initialize_i18n unless Puppet[:disable_i18n]
|
102
100
|
end
|
103
101
|
|
104
102
|
# @deprecated The puppetversion module metadata field is no longer used.
|
@@ -208,7 +206,8 @@ class Puppet::Module
|
|
208
206
|
rescue Errno::ENOENT
|
209
207
|
{}
|
210
208
|
rescue JSON::JSONError => e
|
211
|
-
|
209
|
+
#TRANSLATORS 'metadata.json' is a specific file name and should not be translated.
|
210
|
+
msg = _("%{name} has an invalid and unparsable metadata.json file. The parse error: %{error}") % { name: name, error: e.message }
|
212
211
|
case Puppet[:strict]
|
213
212
|
when :off
|
214
213
|
Puppet.debug(msg)
|
@@ -302,6 +301,21 @@ class Puppet::Module
|
|
302
301
|
subpath("facts.d")
|
303
302
|
end
|
304
303
|
|
304
|
+
#@return [String]
|
305
|
+
def locale_directory
|
306
|
+
subpath("locales")
|
307
|
+
end
|
308
|
+
|
309
|
+
# Returns true if the module has translation files for the
|
310
|
+
# given locale.
|
311
|
+
# @param [String] locale the two-letter language code to check
|
312
|
+
# for translations
|
313
|
+
# @return true if the module has a directory for the locale, false
|
314
|
+
# false otherwise
|
315
|
+
def has_translations?(locale)
|
316
|
+
return Puppet::FileSystem.exist?(File.join(locale_directory, locale))
|
317
|
+
end
|
318
|
+
|
305
319
|
def has_external_facts?
|
306
320
|
File.directory?(plugin_fact_directory)
|
307
321
|
end
|
@@ -422,23 +436,6 @@ class Puppet::Module
|
|
422
436
|
@strict_semver
|
423
437
|
end
|
424
438
|
|
425
|
-
def initialize_i18n
|
426
|
-
# this name takes the form "namespace-module", and should match the name of
|
427
|
-
# the PO file containing the translations.
|
428
|
-
module_name = @forge_name ? @forge_name.gsub("/", "-") : name
|
429
|
-
return if Puppet::GettextConfig.translations_loaded?(module_name)
|
430
|
-
|
431
|
-
locales_path = File.absolute_path('locales', path)
|
432
|
-
|
433
|
-
if Puppet::GettextConfig.load_translations(module_name, locales_path, :po)
|
434
|
-
Puppet.debug "i18n initialized for #{module_name}"
|
435
|
-
elsif Puppet::GettextConfig.gettext_loaded?
|
436
|
-
Puppet.debug "Could not find translation files for #{module_name} at #{locales_path}. Skipping i18n initialization."
|
437
|
-
else
|
438
|
-
Puppet.debug "No gettext library found, skipping i18n initialization."
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
439
|
private
|
443
440
|
|
444
441
|
def wanted_manifests_from(pattern)
|
@@ -14,9 +14,11 @@ module Puppet::ModuleTool::Errors
|
|
14
14
|
def multiline
|
15
15
|
message = []
|
16
16
|
message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @module_name, version: @requested_version }
|
17
|
-
message << _(" Module '%{module_name}' (%{
|
17
|
+
message << _(" Module '%{module_name}' (%{installed_version}) is already installed") % { module_name: @module_name, installed_version: @installed_version }
|
18
18
|
message << _(" Installed module has had changes made locally") unless @local_changes.empty?
|
19
|
+
#TRANSLATORS `puppet module upgrade` is a command line and should not be translated
|
19
20
|
message << _(" Use `puppet module upgrade` to install a different version")
|
21
|
+
#TRANSLATORS `puppet module install --force` is a command line and should not be translated
|
20
22
|
message << _(" Use `puppet module install --force` to re-install only this module")
|
21
23
|
message.join("\n")
|
22
24
|
end
|
@@ -33,10 +35,8 @@ module Puppet::ModuleTool::Errors
|
|
33
35
|
def multiline
|
34
36
|
message = []
|
35
37
|
message << _("Could not install '%{requested_package}'") % { requested_package: @requested_package }
|
36
|
-
|
37
38
|
message << _(" No releases are available from %{source}") % { source: @source }
|
38
39
|
message << _(" Does '%{requested_package}' have at least one published release?") % { requested_package: @requested_package }
|
39
|
-
|
40
40
|
message.join("\n")
|
41
41
|
end
|
42
42
|
end
|
@@ -50,12 +50,12 @@ module Puppet::ModuleTool::Errors
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def multiline
|
53
|
-
|
54
|
-
Could not install module '%{module_name}' (%{version})
|
55
|
-
Path '%{
|
56
|
-
|
57
|
-
mkdir -p '%{
|
58
|
-
|
53
|
+
message = []
|
54
|
+
message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
|
55
|
+
message << _(" Path '%{directory}' exists but is not a directory.") % { directory: @directory }
|
56
|
+
#TRANSLATORS "mkdir -p '%{directory}'" is a command line example and should not be translated
|
57
|
+
message << _(" A potential solution is to rename the path and then \"mkdir -p '%{directory}'\"") % { directory: @directory }
|
58
|
+
message.join("\n")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -68,12 +68,11 @@ Could not install module '%{module_name}' (%{version})
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def multiline
|
71
|
-
|
72
|
-
Could not install module '%{module_name}' (%{version})
|
73
|
-
Permission is denied when trying to create directory '%{
|
74
|
-
A potential solution is to check the ownership and permissions of
|
75
|
-
|
76
|
-
MSG
|
71
|
+
message = []
|
72
|
+
message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
|
73
|
+
message << _(" Permission is denied when trying to create directory '%{directory}'.") % { directory: @directory }
|
74
|
+
message << _(' A potential solution is to check the ownership and permissions of parent directories.')
|
75
|
+
message.join("\n")
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
@@ -85,11 +84,10 @@ Could not install module '%{module_name}' (%{version})
|
|
85
84
|
end
|
86
85
|
|
87
86
|
def multiline
|
88
|
-
|
89
|
-
Could not install package with an invalid path.
|
90
|
-
Package attempted to install file into
|
91
|
-
|
92
|
-
MSG
|
87
|
+
message = []
|
88
|
+
message << _('Could not install package with an invalid path.')
|
89
|
+
message << _(' Package attempted to install file into %{path} under %{directory}.') % { path: @entry_path.inspect, directory: @directory.inspect }
|
90
|
+
message.join("\n")
|
93
91
|
end
|
94
92
|
end
|
95
93
|
end
|
@@ -15,8 +15,8 @@ module Puppet::ModuleTool::Errors
|
|
15
15
|
message = []
|
16
16
|
message << _("Could not %{action} module '%{module_name}' (%{version})") % { action: @action, module_name: @requested_name, version: vstring }
|
17
17
|
message << _(" No version of '%{module_name}' can satisfy all dependencies") % { module_name: @requested_name }
|
18
|
+
#TRANSLATORS `puppet module %{action} --ignore-dependencies` is a command line and should not be translated
|
18
19
|
message << _(" Use `puppet module %{action} --ignore-dependencies` to %{action} only this module") % { action: @action }
|
19
|
-
|
20
20
|
message.join("\n")
|
21
21
|
end
|
22
22
|
end
|
@@ -39,14 +39,12 @@ module Puppet::ModuleTool::Errors
|
|
39
39
|
def multiline
|
40
40
|
message = []
|
41
41
|
message << _("Could not %{action} '%{module_name}' (%{version})") % { action: @action, module_name: @module_name, version: vstring }
|
42
|
-
|
43
42
|
if @requested_version == :latest
|
44
43
|
message << _(" No releases are available from %{source}") % { source: @source }
|
45
44
|
message << _(" Does '%{module_name}' have at least one published release?") % { module_name: @module_name }
|
46
45
|
else
|
47
|
-
message << _(" No releases matching '%{
|
46
|
+
message << _(" No releases matching '%{requested_version}' are available from %{source}") % { requested_version: @requested_version, source: @source }
|
48
47
|
end
|
49
|
-
|
50
48
|
message.join("\n")
|
51
49
|
end
|
52
50
|
end
|
@@ -66,21 +64,22 @@ module Puppet::ModuleTool::Errors
|
|
66
64
|
message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: @requested_version }
|
67
65
|
|
68
66
|
if @dependency
|
69
|
-
message << _(" Dependency '%{name}' (%{version}) would overwrite %{
|
67
|
+
message << _(" Dependency '%{name}' (%{version}) would overwrite %{directory}") % { name: @dependency[:name], version: v(@dependency[:version]), directory: @directory }
|
70
68
|
else
|
71
|
-
message << _(" Installation would overwrite %{
|
69
|
+
message << _(" Installation would overwrite %{directory}") % { directory: @directory }
|
72
70
|
end
|
73
71
|
|
74
72
|
if @metadata
|
75
|
-
message << _(" Currently, '%{
|
73
|
+
message << _(" Currently, '%{current_name}' (%{current_version}) is installed to that directory") % { current_name: @metadata["name"], current_version: v(@metadata["version"]) }
|
76
74
|
end
|
77
75
|
|
78
76
|
if @dependency
|
77
|
+
#TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated
|
79
78
|
message << _(" Use `puppet module install --ignore-dependencies` to install only this module")
|
80
79
|
else
|
80
|
+
#TRANSLATORS `puppet module install --force` is a command line and should not be translated
|
81
81
|
message << _(" Use `puppet module install --force` to install this module anyway")
|
82
82
|
end
|
83
|
-
|
84
83
|
message.join("\n")
|
85
84
|
end
|
86
85
|
end
|
@@ -97,17 +96,18 @@ module Puppet::ModuleTool::Errors
|
|
97
96
|
end
|
98
97
|
|
99
98
|
def multiline
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
99
|
+
dependency_list = []
|
100
|
+
dependency_list << _("You specified '%{name}' (%{version})") % { name: @source.first[:name], version: v(@requested_version) }
|
101
|
+
dependency_list += @source[1..-1].map do |m|
|
102
|
+
#TRANSLATORS This message repeats as separate lines as a list under the heading "You specified '%{name}' (%{version})\n"
|
103
|
+
_("This depends on '%{name}' (%{version})") % { name: m[:name], version: v(m[:version]) }
|
104
|
+
end
|
105
105
|
message = []
|
106
106
|
message << _("Could not install module '%{module_name}' (%{version})") % { module_name: @requested_module, version: v(@requested_version) }
|
107
107
|
message << _(" No version of '%{module_name}' will satisfy dependencies") % { module_name: @module_name }
|
108
|
-
message <<
|
108
|
+
message << dependency_list.map {|s| " #{s}".join(",\n")}
|
109
|
+
#TRANSLATORS `puppet module install --force` is a command line and should not be translated
|
109
110
|
message << _(" Use `puppet module install --force` to install this module anyway")
|
110
|
-
|
111
111
|
message.join("\n")
|
112
112
|
end
|
113
113
|
end
|
@@ -125,8 +125,10 @@ module Puppet::ModuleTool::Errors
|
|
125
125
|
message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
|
126
126
|
message << _(" Module '%{module_name}' is not installed") % { module_name: @module_name }
|
127
127
|
message += @suggestions.map do |suggestion|
|
128
|
+
#TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated
|
128
129
|
_(" You may have meant `puppet module %{action} %{suggestion}`") % { action: @action, suggestion: suggestion }
|
129
130
|
end
|
131
|
+
#TRANSLATORS `puppet module install` is a command line and should not be translated
|
130
132
|
message << _(" Use `puppet module install` to install this module") if @action == :upgrade
|
131
133
|
message.join("\n")
|
132
134
|
end
|
@@ -146,8 +148,10 @@ module Puppet::ModuleTool::Errors
|
|
146
148
|
message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
|
147
149
|
message << _(" Module '%{module_name}' appears multiple places in the module path") % { module_name: @module_name }
|
148
150
|
message += @modules.map do |mod|
|
151
|
+
#TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path"
|
149
152
|
_(" '%{module_name}' (%{version}) was found in %{path}") % { module_name: @module_name, version: v(mod.version), path: mod.modulepath }
|
150
153
|
end
|
154
|
+
#TRANSLATORS `--modulepath` is command line option and should not be translated
|
151
155
|
message << _(" Use the `--modulepath` option to limit the search to specific directories")
|
152
156
|
message.join("\n")
|
153
157
|
end
|
@@ -166,6 +170,7 @@ module Puppet::ModuleTool::Errors
|
|
166
170
|
message = []
|
167
171
|
message << _("Could not %{action} module '%{module_name}' (%{version})") % { action: @action, module_name: @module_name, version: vstring }
|
168
172
|
message << _(" Installed module has had changes made locally")
|
173
|
+
#TRANSLATORS `puppet module %{action} --ignore-changes` is a command line and should not be translated
|
169
174
|
message << _(" Use `puppet module %{action} --ignore-changes` to %{action} this module anyway") % { action: @action }
|
170
175
|
message.join("\n")
|
171
176
|
end
|