puppet 5.3.3 → 5.3.4
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 +3433 -3416
- checksums.yaml +0 -7
- data/spec/unit/gettext_config_spec.rb +0 -57
@@ -125,9 +125,15 @@ module Validation
|
|
125
125
|
# @api public
|
126
126
|
#
|
127
127
|
def []=(issue, level)
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
unless issue.is_a? Issues::Issue
|
129
|
+
raise Puppet::DevError.new(_("Attempt to set validation severity for something that is not an Issue. (Got %{issue})") % { issue: issue.class })
|
130
|
+
end
|
131
|
+
unless @@severity_hash[level]
|
132
|
+
raise Puppet::DevError.new(_("Illegal severity level: %{level} for '%{issue_code}'") % { issue_code: issue.issue_code, level: level })
|
133
|
+
end
|
134
|
+
unless issue.demotable? || level == :error
|
135
|
+
raise Puppet::DevError.new(_("Attempt to demote the hard issue '%{issue_code}' to %{level}") % { issue_code: issue.issue_code, level: level })
|
136
|
+
end
|
131
137
|
@severities[issue] = level
|
132
138
|
end
|
133
139
|
|
@@ -145,14 +151,9 @@ module Validation
|
|
145
151
|
# @api private
|
146
152
|
#
|
147
153
|
def assert_issue issue
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
# Checks if the given severity level is valid.
|
152
|
-
# @api private
|
153
|
-
#
|
154
|
-
def assert_severity level
|
155
|
-
raise Puppet::DevError.new("Illegal severity level: #{option}") unless @@severity_hash[level]
|
154
|
+
unless issue.is_a? Issues::Issue
|
155
|
+
raise Puppet::DevError.new(_("Attempt to get validation severity for something that is not an Issue. (Got %{issue})") % { issue: issue.class })
|
156
|
+
end
|
156
157
|
end
|
157
158
|
end
|
158
159
|
|
@@ -203,7 +204,8 @@ module Validation
|
|
203
204
|
# Accept an Error as semantic if it supports methods #file(), #line(), and #pos()
|
204
205
|
if semantic.is_a?(StandardError)
|
205
206
|
unless semantic.respond_to?(:file) && semantic.respond_to?(:line) && semantic.respond_to?(:pos)
|
206
|
-
raise Puppet::DevError("Issue
|
207
|
+
raise Puppet::DevError, _("Issue %{issue_code}: Cannot pass a %{class_name} as a semantic object when it does not support #pos(), #file() and #line()") %
|
208
|
+
{ issue_code: issue.issue_code, class_name: semantic.class }
|
207
209
|
end
|
208
210
|
end
|
209
211
|
|
data/lib/puppet/property.rb
CHANGED
@@ -95,7 +95,8 @@ class Puppet::Property < Puppet::Parameter
|
|
95
95
|
#
|
96
96
|
def array_matching=(value)
|
97
97
|
value = value.intern if value.is_a?(String)
|
98
|
-
|
98
|
+
#TRANSLATORS 'Property#array_matching', 'first', and 'all' should not be translated
|
99
|
+
raise ArgumentError, _("Supported values for Property#array_matching are 'first' and 'all'") unless [:first, :all].include?(value)
|
99
100
|
@array_matching = value
|
100
101
|
end
|
101
102
|
|
@@ -167,7 +168,7 @@ class Puppet::Property < Puppet::Parameter
|
|
167
168
|
method = value.method.to_sym
|
168
169
|
if value.block
|
169
170
|
if instance_methods(false).include?(method)
|
170
|
-
raise ArgumentError, "Attempt to redefine method
|
171
|
+
raise ArgumentError, _("Attempt to redefine method %{method} with block") % { method: method }
|
171
172
|
end
|
172
173
|
define_method(method, &value.block)
|
173
174
|
else
|
@@ -211,7 +212,7 @@ class Puppet::Property < Puppet::Parameter
|
|
211
212
|
rescue Puppet::Error, Puppet::DevError
|
212
213
|
raise
|
213
214
|
rescue => detail
|
214
|
-
message = "Could not convert change '
|
215
|
+
message = _("Could not convert change '%{name}' to string: %{detail}") % { name: name, detail: detail }
|
215
216
|
Puppet.log_exception(detail, message)
|
216
217
|
raise Puppet::DevError, message, detail.backtrace
|
217
218
|
end
|
@@ -367,7 +368,9 @@ class Puppet::Property < Puppet::Parameter
|
|
367
368
|
rescue => detail
|
368
369
|
# Certain operations may fail, but we don't want to fail the transaction if we can
|
369
370
|
# avoid it
|
370
|
-
|
371
|
+
#TRANSLATORS 'insync_values?' should not be translated
|
372
|
+
msg = _("Unknown failure using insync_values? on type: %{type} / property: %{name} to compare values %{should} and %{is}") %
|
373
|
+
{ type: self.resource.ref, name: self.name, should: should, is: is }
|
371
374
|
Puppet.info(msg)
|
372
375
|
|
373
376
|
# Return nil, ie. unknown
|
@@ -489,7 +492,8 @@ class Puppet::Property < Puppet::Parameter
|
|
489
492
|
rescue Puppet::Error
|
490
493
|
raise
|
491
494
|
rescue => detail
|
492
|
-
error = Puppet::ResourceError.new("Could not set '
|
495
|
+
error = Puppet::ResourceError.new(_("Could not set '%{value}' on %{class_name}: %{detail}") %
|
496
|
+
{ value: value, class_name: self.class.name, detail: detail }, @resource.file, @resource.line, detail)
|
493
497
|
error.set_backtrace detail.backtrace
|
494
498
|
Puppet.log_exception(detail, error.message)
|
495
499
|
raise error
|
@@ -584,7 +588,11 @@ class Puppet::Property < Puppet::Parameter
|
|
584
588
|
if features = self.class.value_option(self.class.value_name(value), :required_features)
|
585
589
|
features = Array(features)
|
586
590
|
needed_features = features.collect { |f| f.to_s }.join(", ")
|
587
|
-
|
591
|
+
unless provider.satisfies?(features)
|
592
|
+
#TRANSLATORS 'Provider' refers to a Puppet provider class
|
593
|
+
raise ArgumentError, _("Provider %{provider} must have features '%{needed_features}' to set '%{property}' to '%{value}'") %
|
594
|
+
{ provider: provider.class.name, needed_features: needed_features, property: self.class.name, value: value }
|
595
|
+
end
|
588
596
|
end
|
589
597
|
end
|
590
598
|
|
@@ -59,7 +59,7 @@ class Puppet::Property::Ensure < Puppet::Property
|
|
59
59
|
rescue Puppet::Error, Puppet::DevError
|
60
60
|
raise
|
61
61
|
rescue => detail
|
62
|
-
raise Puppet::DevError, "Could not convert change
|
62
|
+
raise Puppet::DevError, _("Could not convert change %{name} to string: %{detail}") % { name: self.name, detail: detail }, detail.backtrace
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -82,7 +82,7 @@ class Puppet::Property::Ensure < Puppet::Property
|
|
82
82
|
elsif @resource.respond_to?(:exists?)
|
83
83
|
result = @resource.exists?
|
84
84
|
else
|
85
|
-
raise Puppet::DevError, "No ability to determine if
|
85
|
+
raise Puppet::DevError, _("No ability to determine if %{name} exists") % { name: @resource.class.name }
|
86
86
|
end
|
87
87
|
if result
|
88
88
|
return :present
|
data/lib/puppet/provider.rb
CHANGED
@@ -143,7 +143,7 @@ class Puppet::Provider
|
|
143
143
|
elsif superclass.respond_to? :command and command = superclass.command(name)
|
144
144
|
# nothing
|
145
145
|
else
|
146
|
-
raise Puppet::DevError, "No command
|
146
|
+
raise Puppet::DevError, _("No command %{command} defined for provider %{provider}") % { command: name, provider: self.name }
|
147
147
|
end
|
148
148
|
|
149
149
|
which(command)
|
@@ -374,7 +374,7 @@ class Puppet::Provider
|
|
374
374
|
# @raise [Puppet::DevError] Error indicating that the method should have been implemented by subclass.
|
375
375
|
# @see prefetch
|
376
376
|
def self.instances
|
377
|
-
raise Puppet::DevError, "Provider
|
377
|
+
raise Puppet::DevError, _("Provider %{provider} has not defined the 'instances' class method") % { provider: self.name }
|
378
378
|
end
|
379
379
|
|
380
380
|
# Creates getter- and setter- methods for each property supported by the resource type.
|
@@ -446,7 +446,7 @@ class Puppet::Provider
|
|
446
446
|
klass = param
|
447
447
|
else
|
448
448
|
unless klass = resource_type.attrclass(param)
|
449
|
-
raise Puppet::DevError, "'
|
449
|
+
raise Puppet::DevError, _("'%{parameter_name}' is not a valid parameter for %{resource_type}") % { parameter_name: param, resource_type: resource_type.name }
|
450
450
|
end
|
451
451
|
end
|
452
452
|
return true unless features = klass.required_features
|
@@ -530,7 +530,7 @@ class Puppet::Provider
|
|
530
530
|
elsif self.resource
|
531
531
|
resource.name
|
532
532
|
else
|
533
|
-
raise Puppet::DevError, "No resource and no name in property hash in
|
533
|
+
raise Puppet::DevError, _("No resource and no name in property hash in %{class_name} instance") % { class_name: self.class.name }
|
534
534
|
end
|
535
535
|
end
|
536
536
|
|
@@ -98,8 +98,10 @@ Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject d
|
|
98
98
|
def get_arguments(key, value, mapping, objectinfo)
|
99
99
|
# In the case of attributes, return a list of key=value
|
100
100
|
if key == :attributes
|
101
|
-
|
102
|
-
|
101
|
+
unless value and value.is_a? Hash
|
102
|
+
raise Puppet::Error, _("Attributes must be a list of pairs key=value on %{resource}[%{name}]") %
|
103
|
+
{ resource: @resource.class.name, name: @resource.name }
|
104
|
+
end
|
103
105
|
return value.select { |k,v| true }.map { |pair| pair.join("=") }
|
104
106
|
end
|
105
107
|
super(key, value, mapping, objectinfo)
|
data/lib/puppet/provider/ldap.rb
CHANGED
@@ -74,8 +74,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def initialize(*args)
|
77
|
-
raise(Puppet::DevError, "No LDAP Configuration defined for
|
78
|
-
raise(Puppet::DevError, "Invalid LDAP Configuration defined for
|
77
|
+
raise(Puppet::DevError, _("No LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager
|
78
|
+
raise(Puppet::DevError, _("Invalid LDAP Configuration defined for %{class_name}") % { class_name: self.class }) unless self.class.manager.valid?
|
79
79
|
super
|
80
80
|
|
81
81
|
@property_hash = @property_hash.inject({}) do |result, ary|
|
@@ -10,7 +10,7 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
|
|
10
10
|
unless @nagios_type
|
11
11
|
name = resource_type.name.to_s.sub(/^nagios_/, '')
|
12
12
|
unless @nagios_type = Nagios::Base.type(name.to_sym)
|
13
|
-
raise Puppet::DevError, "Could not find nagios type '
|
13
|
+
raise Puppet::DevError, _("Could not find nagios type '%{name}'") % { name: name }
|
14
14
|
end
|
15
15
|
|
16
16
|
# And add our 'ensure' settings, since they aren't a part of
|
@@ -41,7 +41,9 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def options(name, hash)
|
44
|
-
|
44
|
+
unless resource_type.valid_parameter?(name)
|
45
|
+
raise Puppet::DevError, _("%{name} is not a valid attribute for %{resource_type}") % { name: name, resource_type: resource_type.name }
|
46
|
+
end
|
45
47
|
@options ||= {}
|
46
48
|
@options[name] ||= {}
|
47
49
|
|
@@ -115,7 +117,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
115
117
|
end
|
116
118
|
|
117
119
|
# Autogenerate a value. Mostly used for uid/gid, but also used heavily
|
118
|
-
# with DirectoryServices
|
120
|
+
# with DirectoryServices
|
119
121
|
def autogen(field)
|
120
122
|
field = field.intern
|
121
123
|
id_generators = {:user => :uid, :group => :gid}
|
@@ -141,7 +143,8 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
141
143
|
when :user; database = :passwd; method = :uid
|
142
144
|
when :group; database = :group; method = :gid
|
143
145
|
else
|
144
|
-
|
146
|
+
#TRANSLATORS "autogen_id()" is a method name and should not be translated
|
147
|
+
raise Puppet::DevError, _("autogen_id() does not support auto generation of id for resource type %{resource_type}") % { resource_type: resource_type }
|
145
148
|
end
|
146
149
|
|
147
150
|
# Initialize from the data set, if needed.
|
@@ -291,7 +294,7 @@ class Puppet::Provider::NameService < Puppet::Provider
|
|
291
294
|
def set(param, value)
|
292
295
|
self.class.validate(param, value)
|
293
296
|
cmd = modifycmd(param, munge(param, value))
|
294
|
-
raise Puppet::DevError, "Nameservice command must be an array" unless cmd.is_a?(Array)
|
297
|
+
raise Puppet::DevError, _("Nameservice command must be an array") unless cmd.is_a?(Array)
|
295
298
|
begin
|
296
299
|
execute(cmd)
|
297
300
|
rescue Puppet::ExecutionFailure => detail
|
@@ -196,8 +196,9 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
|
|
196
196
|
# zeroes. If someone attempts to use a password hash that worked with
|
197
197
|
# a previous version of OS X, we will fail early and warn them.
|
198
198
|
if password_hash.length != 136
|
199
|
-
|
200
|
-
|
199
|
+
#TRANSLATORS 'OS X 10.7' is an operating system and should not be translated, 'Salted SHA512' is the name of a hashing algorithm
|
200
|
+
fail(_("OS X 10.7 requires a Salted SHA512 hash password of 136 characters.") +
|
201
|
+
' ' + _("Please check your password and try again."))
|
201
202
|
end
|
202
203
|
|
203
204
|
plist_file = "#{users_plist_dir}/#{resource_name}.plist"
|
@@ -372,7 +373,7 @@ class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameSe
|
|
372
373
|
# expects to be returned by addcmd. Thus we don't bother defining addcmd.
|
373
374
|
def create
|
374
375
|
if exists?
|
375
|
-
info "already exists"
|
376
|
+
info _("already exists")
|
376
377
|
return nil
|
377
378
|
end
|
378
379
|
|
@@ -136,7 +136,7 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
|
|
136
136
|
unless upd.nil?
|
137
137
|
return "#{upd[:version]}"
|
138
138
|
else
|
139
|
-
raise Puppet::DevError, "Tried to get latest on a missing package" if properties[:ensure] == :absent
|
139
|
+
raise Puppet::DevError, _("Tried to get latest on a missing package") if properties[:ensure] == :absent
|
140
140
|
|
141
141
|
return properties[:ensure]
|
142
142
|
end
|
@@ -97,14 +97,13 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
if (package_type == nil)
|
100
|
-
|
101
|
-
errmsg =
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
errmsg << "on lpp_source '#{source}'"
|
100
|
+
|
101
|
+
errmsg = if version_specified
|
102
|
+
_("Unable to find package '%{package}' with version '%{version}' on lpp_source '%{source}'") %
|
103
|
+
{ package: pkg, version: version, source: source }
|
104
|
+
else
|
105
|
+
_("Unable to find package '%{package}' on lpp_source '%{source}'") % { package: pkg, source: source }
|
106
|
+
end
|
108
107
|
self.fail errmsg
|
109
108
|
end
|
110
109
|
|
@@ -43,7 +43,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
43
43
|
when '-'
|
44
44
|
{:status => 'known'}
|
45
45
|
else
|
46
|
-
raise ArgumentError, _('Unknown format %
|
46
|
+
raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %
|
47
|
+
{ resource_name: self.name, full_flags: flags, bad_flag: flags[0..0] }
|
47
48
|
end
|
48
49
|
).merge(
|
49
50
|
case flags[1..1]
|
@@ -52,7 +53,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
52
53
|
when '-'
|
53
54
|
{}
|
54
55
|
else
|
55
|
-
raise ArgumentError, _('Unknown format %
|
56
|
+
raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %
|
57
|
+
{ resource_name: self.name, full_flags: flags, bad_flag: flags[1..1] }
|
56
58
|
end
|
57
59
|
)
|
58
60
|
end
|
@@ -82,7 +84,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
82
84
|
when /known/
|
83
85
|
{:status => 'known'}
|
84
86
|
else
|
85
|
-
raise ArgumentError, _('Unknown format %
|
87
|
+
raise ArgumentError, _('Unknown format %{resource_name}: %{state}') % { resource_name: self.name, state: state }
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
@@ -101,7 +103,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
101
103
|
{:publisher => $1, :name => $2, :ensure => $3}.merge pkg_state($4).merge(ufoxi_flag($5))
|
102
104
|
|
103
105
|
else
|
104
|
-
raise ArgumentError, _('Unknown line format %
|
106
|
+
raise ArgumentError, _('Unknown line format %{resource_name}: %{parse_line}') % { resource_name: self.name, parse_line: line }
|
105
107
|
end).merge({:provider => self.name})
|
106
108
|
end
|
107
109
|
|
@@ -161,7 +163,8 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
161
163
|
return false
|
162
164
|
end
|
163
165
|
}
|
164
|
-
raise Puppet::DevError, "No version of
|
166
|
+
raise Puppet::DevError, _("No version of %{name} matching %{should} is installable, even though the package is currently installed") %
|
167
|
+
{ name: name, should: should }
|
165
168
|
end
|
166
169
|
|
167
170
|
false
|
@@ -176,7 +179,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
176
179
|
# remove certificate expiration warnings from the output, but report them
|
177
180
|
cert_warnings = lines.select { |line| line =~ /^Certificate/ }
|
178
181
|
unless cert_warnings.empty?
|
179
|
-
Puppet.warning("pkg warning:
|
182
|
+
Puppet.warning(_("pkg warning: %{warnings}") % { warnings: cert_warnings.join(', ') })
|
180
183
|
end
|
181
184
|
|
182
185
|
lst = lines.select { |line| line !~ /^Certificate/ }.map { |line| self.class.parse_line(line) }
|
@@ -70,7 +70,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
70
70
|
if line =~ /\s*(\S+)\s+(\S+)\s+(.*)/
|
71
71
|
{ :alias => $1, :name => $2, :avail => $3 }
|
72
72
|
else
|
73
|
-
Puppet.warning _("Cannot match %
|
73
|
+
Puppet.warning _("Cannot match %{line}") % { line: line }
|
74
74
|
end
|
75
75
|
end.reject { |h| h.nil? }
|
76
76
|
end
|
@@ -88,7 +88,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
88
88
|
output = output.split("\n")
|
89
89
|
|
90
90
|
if output[-1] == "Not in catalog"
|
91
|
-
Puppet.warning _("Package not in pkgutil catalog: %
|
91
|
+
Puppet.warning _("Package not in pkgutil catalog: %{package}") % { package: hash[:justme] }
|
92
92
|
return nil
|
93
93
|
end
|
94
94
|
|
@@ -142,7 +142,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
142
142
|
|
143
143
|
return hash
|
144
144
|
else
|
145
|
-
Puppet.warning _("Cannot match %
|
145
|
+
Puppet.warning _("Cannot match %{line}") % { line: line }
|
146
146
|
return nil
|
147
147
|
end
|
148
148
|
end
|
@@ -230,7 +230,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
230
230
|
else
|
231
231
|
# Yum didn't find updates, pretend the current version is the latest
|
232
232
|
version = properties[:ensure]
|
233
|
-
raise Puppet::DevError, "Tried to get latest on a missing package" if version == :absent || version == :purged
|
233
|
+
raise Puppet::DevError, _("Tried to get latest on a missing package") if version == :absent || version == :purged
|
234
234
|
return version
|
235
235
|
end
|
236
236
|
end
|
@@ -43,7 +43,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
43
43
|
elsif klass = Puppet::Util::FileType.filetype(type)
|
44
44
|
@filetype = klass
|
45
45
|
else
|
46
|
-
raise ArgumentError, "Invalid filetype
|
46
|
+
raise ArgumentError, _("Invalid filetype %{type}") % { type: type }
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -277,7 +277,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
277
277
|
|
278
278
|
target_records = prefetch_hook(target_records) if respond_to?(:prefetch_hook)
|
279
279
|
|
280
|
-
raise Puppet::DevError, "Prefetching
|
280
|
+
raise Puppet::DevError, _("Prefetching %{target} for provider %{name} returned nil") % { target: target, name: self.name } unless target_records
|
281
281
|
|
282
282
|
target_records
|
283
283
|
end
|
@@ -350,7 +350,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
350
350
|
def self.targets(resources = nil)
|
351
351
|
targets = []
|
352
352
|
# First get the default target
|
353
|
-
raise Puppet::DevError, "Parsed Providers must define a default target" unless self.default_target
|
353
|
+
raise Puppet::DevError, _("Parsed Providers must define a default target") unless self.default_target
|
354
354
|
targets << self.default_target
|
355
355
|
|
356
356
|
# Then get each of the file objects
|
@@ -439,7 +439,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
439
439
|
|
440
440
|
# Retrieve the current state from disk.
|
441
441
|
def prefetch
|
442
|
-
raise Puppet::DevError, "Somehow got told to prefetch with no resource set" unless @resource
|
442
|
+
raise Puppet::DevError, _("Somehow got told to prefetch with no resource set") unless @resource
|
443
443
|
self.class.prefetch(@resource[:name] => @resource)
|
444
444
|
end
|
445
445
|
|
@@ -118,11 +118,13 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def selmodversion_loaded
|
121
|
-
|
121
|
+
selmod_output = []
|
122
|
+
selmodule_cmd = "#{command(:semodule)} --list"
|
122
123
|
begin
|
123
|
-
execpipe(
|
124
|
+
execpipe(selmodule_cmd) do |output|
|
124
125
|
output.each_line do |line|
|
125
126
|
line.chomp!
|
127
|
+
selmod_output << line
|
126
128
|
bits = line.split
|
127
129
|
if bits[0] == @resource[:name]
|
128
130
|
self.debug "load version #{bits[1]}"
|
@@ -131,7 +133,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
|
|
131
133
|
end
|
132
134
|
end
|
133
135
|
rescue Puppet::ExecutionFailure
|
134
|
-
raise Puppet::ExecutionFailure, "Could not list policy modules:
|
136
|
+
raise Puppet::ExecutionFailure, _("Could not list policy modules: \"%{selmodule_command}\" failed with \"%{selmod_output}\"") % { selmodule_command: selmodule_cmd, selmod_output: selmod_output.join(' ') }
|
135
137
|
end
|
136
138
|
nil
|
137
139
|
end
|