puppet 5.3.3-universal-darwin → 5.3.4-universal-darwin
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 +3435 -3416
- checksums.yaml +0 -7
- data/spec/unit/gettext_config_spec.rb +0 -57
data/lib/puppet/type/file.rb
CHANGED
@@ -727,7 +727,7 @@ Puppet::Type.newtype(:file) do
|
|
727
727
|
if can_backup?(current_type)
|
728
728
|
backup_existing
|
729
729
|
else
|
730
|
-
self.warning "Could not back up file of type
|
730
|
+
self.warning _("Could not back up file of type %{current_type}") % { current_type: current_type }
|
731
731
|
end
|
732
732
|
end
|
733
733
|
|
@@ -752,6 +752,7 @@ Puppet::Type.newtype(:file) do
|
|
752
752
|
# catalog validation (because that would be a breaking change from Puppet 4).
|
753
753
|
if Puppet.features.microsoft_windows? && parameter(:source) &&
|
754
754
|
[:use, :use_when_creating].include?(self[:source_permissions])
|
755
|
+
#TRANSLATORS "source_permissions => ignore" should not be translated
|
755
756
|
err_msg = _("Copying owner/mode/group from the source file on Windows is not supported; use source_permissions => ignore.")
|
756
757
|
if self[:owner] == nil || self[:group] == nil || self[:mode] == nil
|
757
758
|
# Fail on Windows if source permissions are being used and the file resource
|
@@ -27,7 +27,8 @@ module Puppet
|
|
27
27
|
return false if is == :absent
|
28
28
|
else
|
29
29
|
if resource[:ensure] == :present && has_contents && (s = resource.stat)
|
30
|
-
|
30
|
+
#TRANSLATORS 'Ensure' is an attribute and ':present' is a value and should not be translated
|
31
|
+
resource.warning _("Ensure set to :present but file type is %{file_type} so no content will be synced") % { file_type: s.ftype}
|
31
32
|
end
|
32
33
|
return true
|
33
34
|
end
|
@@ -128,7 +128,7 @@ module Puppet
|
|
128
128
|
# Look up (if necessary) and return local content.
|
129
129
|
def content
|
130
130
|
return @content if @content
|
131
|
-
raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
|
131
|
+
raise Puppet::DevError, _("No source for content was stored with the metadata") unless metadata.source
|
132
132
|
|
133
133
|
unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source, :environment => resource.catalog.environment_instance, :links => resource[:links])
|
134
134
|
self.fail "Could not find any content at %s" % metadata.source
|
data/lib/puppet/type/group.rb
CHANGED
data/lib/puppet/type/mount.rb
CHANGED
@@ -112,7 +112,7 @@ module Puppet
|
|
112
112
|
# Determine if there are any out-of-sync properties.
|
113
113
|
oos = @resource.send(:properties).find_all do |prop|
|
114
114
|
unless currentvalues.include?(prop)
|
115
|
-
raise Puppet::DevError, "Parent has property %
|
115
|
+
raise Puppet::DevError, _("Parent has property %{name} but it doesn't appear in the current values") % { name: prop.name }
|
116
116
|
end
|
117
117
|
if prop.name == :ensure
|
118
118
|
false
|
@@ -127,7 +127,7 @@ Puppet::Type.newtype(:resources) do
|
|
127
127
|
def resource_type
|
128
128
|
unless defined?(@resource_type)
|
129
129
|
unless type = Puppet::Type.type(self[:name])
|
130
|
-
raise Puppet::DevError, "Could not find resource type"
|
130
|
+
raise Puppet::DevError, _("Could not find resource type")
|
131
131
|
end
|
132
132
|
@resource_type = type
|
133
133
|
end
|
data/lib/puppet/type/schedule.rb
CHANGED
@@ -346,9 +346,9 @@ module Puppet
|
|
346
346
|
newparam(:weekday) do
|
347
347
|
desc <<-EOT
|
348
348
|
The days of the week in which the schedule should be valid.
|
349
|
-
You may specify the full day name
|
350
|
-
abbreviation
|
351
|
-
week where 0 is Sunday, 1 is Monday,
|
349
|
+
You may specify the full day name 'Tuesday', the three character
|
350
|
+
abbreviation 'Tue', or a number (as a string or as an integer) corresponding to the day of the
|
351
|
+
week where 0 is Sunday, 1 is Monday, and so on. Multiple days can be specified
|
352
352
|
as an array. If not specified, the day of the week will not be
|
353
353
|
considered in the schedule.
|
354
354
|
|
@@ -369,13 +369,22 @@ module Puppet
|
|
369
369
|
validate do |values|
|
370
370
|
values = [values] unless values.is_a?(Array)
|
371
371
|
values.each { |value|
|
372
|
-
|
373
|
-
|
374
|
-
|
372
|
+
if weekday_integer?(value) || weekday_string?(value)
|
373
|
+
value
|
374
|
+
else
|
375
|
+
raise ArgumentError, _("%{value} is not a valid day of the week") % { value: value }
|
375
376
|
end
|
376
377
|
}
|
377
378
|
end
|
378
379
|
|
380
|
+
def weekday_integer?(value)
|
381
|
+
value.is_a?(Integer) && (0..6).include?(value)
|
382
|
+
end
|
383
|
+
|
384
|
+
def weekday_string?(value)
|
385
|
+
value.is_a?(String) && (value =~ /^[0-6]$/ || value =~ /^(Mon|Tues?|Wed(?:nes)?|Thu(?:rs)?|Fri|Sat(?:ur)?|Sun)(day)?$/i)
|
386
|
+
end
|
387
|
+
|
379
388
|
weekdays = {
|
380
389
|
'sun' => 0,
|
381
390
|
'mon' => 1,
|
@@ -390,14 +399,17 @@ module Puppet
|
|
390
399
|
values = [values] unless values.is_a?(Array)
|
391
400
|
ret = {}
|
392
401
|
|
393
|
-
values.each
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
402
|
+
values.each do |value|
|
403
|
+
case value
|
404
|
+
when /^[0-6]$/
|
405
|
+
index = value.to_i
|
406
|
+
when 0..6
|
407
|
+
index = value
|
408
|
+
else
|
409
|
+
index = weekdays[value[0,3].downcase]
|
410
|
+
end
|
411
|
+
ret[index] = true
|
412
|
+
end
|
401
413
|
ret
|
402
414
|
end
|
403
415
|
|
data/lib/puppet/type/user.rb
CHANGED
@@ -367,9 +367,15 @@ module Puppet
|
|
367
367
|
end
|
368
368
|
|
369
369
|
newparam(:managehome, :boolean => true, :parent => Puppet::Parameter::Boolean) do
|
370
|
-
desc "Whether to manage the home directory when
|
371
|
-
This
|
372
|
-
|
370
|
+
desc "Whether to manage the home directory when Puppet creates or removes the user.
|
371
|
+
This creates the home directory if Puppet also creates the user account, and deletes the
|
372
|
+
home directory if Puppet also removes the user account. Defaults to `false`.
|
373
|
+
|
374
|
+
This parameter has no effect unless Puppet is also creating or removing the user in the
|
375
|
+
resource at the same time. For instance, Puppet creates a home directory for a managed
|
376
|
+
user if `ensure => present` and the user does not exist at the time of the Puppet run.
|
377
|
+
If the home directory is then deleted manually, Puppet will not recreate it on the next
|
378
|
+
run."
|
373
379
|
|
374
380
|
defaultto false
|
375
381
|
|
data/lib/puppet/type/zone.rb
CHANGED
@@ -115,7 +115,7 @@ end
|
|
115
115
|
# everything between it and us.
|
116
116
|
self.class.state_sequence(self.retrieve, self.should).each do |state|
|
117
117
|
method = state[direction]
|
118
|
-
raise Puppet::DevError, "Cannot move
|
118
|
+
raise Puppet::DevError, _("Cannot move %{direction} from %{name}") % { direction: direction, name: st[:name] } unless method
|
119
119
|
provider_sync_send(method)
|
120
120
|
end
|
121
121
|
|
data/lib/puppet/util.rb
CHANGED
@@ -197,25 +197,33 @@ module Util
|
|
197
197
|
}
|
198
198
|
end
|
199
199
|
|
200
|
+
# execute a block of work and based on the logging level provided, log the provided message with the seconds taken
|
201
|
+
# The message 'msg' should include string ' in %{seconds} seconds' as part of the message and any content should escape
|
202
|
+
# any percent signs '%' so that they are not interpreted as formatting commands
|
203
|
+
# escaped_str = str.gsub(/%/, '%%')
|
204
|
+
#
|
205
|
+
# @param msg [String] the message to be formated to assigned the %{seconds} seconds take to execute,
|
206
|
+
# other percent signs '%' need to be escaped
|
207
|
+
# @param level [Symbol] the logging level for this message
|
208
|
+
# @param object [Object] The object use for logging the message
|
200
209
|
def benchmark(*args)
|
201
210
|
msg = args.pop
|
202
211
|
level = args.pop
|
203
|
-
object =
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
raise Puppet::DevError, "Failed to provide level to :benchmark" unless level
|
212
|
+
object = if args.empty?
|
213
|
+
if respond_to?(level)
|
214
|
+
self
|
215
|
+
else
|
216
|
+
Puppet
|
217
|
+
end
|
218
|
+
else
|
219
|
+
args.pop
|
220
|
+
end
|
221
|
+
|
222
|
+
#TRANSLATORS 'benchmark' is a method name and should not be translated
|
223
|
+
raise Puppet::DevError, _("Failed to provide level to benchmark") unless level
|
216
224
|
|
217
225
|
unless level == :none or object.respond_to? level
|
218
|
-
raise Puppet::DevError, "Benchmarked object does not respond to
|
226
|
+
raise Puppet::DevError, _("Benchmarked object does not respond to %{value}") % { value: level }
|
219
227
|
end
|
220
228
|
|
221
229
|
# Only benchmark if our log level is high enough
|
@@ -223,9 +231,7 @@ module Util
|
|
223
231
|
seconds = Benchmark.realtime {
|
224
232
|
yield
|
225
233
|
}
|
226
|
-
|
227
|
-
# given operation took
|
228
|
-
object.send(level, msg + (_(" in %0.2f seconds") % seconds))
|
234
|
+
object.send(level, msg % { seconds: "%0.2f" % seconds })
|
229
235
|
return seconds
|
230
236
|
else
|
231
237
|
yield
|
@@ -301,7 +307,7 @@ module Util
|
|
301
307
|
when :posix
|
302
308
|
AbsolutePathPosix
|
303
309
|
else
|
304
|
-
raise Puppet::DevError, "unknown platform
|
310
|
+
raise Puppet::DevError, _("unknown platform %{platform} in absolute_path") % { platform: platform }
|
305
311
|
end
|
306
312
|
|
307
313
|
!! (path =~ regex)
|
@@ -439,7 +445,7 @@ module Util
|
|
439
445
|
# query will encode + as %2B and space as %20
|
440
446
|
# fragment behaves like query
|
441
447
|
def uri_encode(path, opts = { :allow_fragment => false })
|
442
|
-
raise ArgumentError.new('path may not be nil') if path.nil?
|
448
|
+
raise ArgumentError.new(_('path may not be nil')) if path.nil?
|
443
449
|
|
444
450
|
# ensure string starts as UTF-8 for the sake of Ruby 1.9.3
|
445
451
|
encoded = ''.encode!(Encoding::UTF_8)
|
@@ -557,11 +563,11 @@ module Util
|
|
557
563
|
DEFAULT_WINDOWS_MODE = nil
|
558
564
|
|
559
565
|
def replace_file(file, default_mode, &block)
|
560
|
-
raise Puppet::DevError, "replace_file requires a block" unless block_given?
|
566
|
+
raise Puppet::DevError, _("replace_file requires a block") unless block_given?
|
561
567
|
|
562
568
|
if default_mode
|
563
569
|
unless valid_symbolic_mode?(default_mode)
|
564
|
-
raise Puppet::DevError, "replace_file default_mode:
|
570
|
+
raise Puppet::DevError, _("replace_file default_mode: %{default_mode} is invalid") % { default_mode: default_mode }
|
565
571
|
end
|
566
572
|
|
567
573
|
mode = symbolic_mode_to_int(normalize_symbolic_mode(default_mode))
|
@@ -93,10 +93,12 @@ class Puppet::Util::AtFork::Solaris
|
|
93
93
|
begin
|
94
94
|
raise_if_error { ct_tmpl_clear(tmpl.fileno) }
|
95
95
|
rescue => detail
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
msg = if parent
|
97
|
+
_('Failed to deactivate process contract template in the parent process')
|
98
|
+
else
|
99
|
+
_('Failed to deactivate process contract template in the child process')
|
100
|
+
end
|
101
|
+
Puppet.log_exception(detail, msg)
|
100
102
|
exit(1)
|
101
103
|
ensure
|
102
104
|
tmpl.close
|
@@ -14,6 +14,7 @@ require 'puppet/util'
|
|
14
14
|
require "puppet/util/rubygems"
|
15
15
|
require "puppet/util/limits"
|
16
16
|
require 'puppet/util/colors'
|
17
|
+
require 'puppet/gettext/module_translations'
|
17
18
|
|
18
19
|
module Puppet
|
19
20
|
module Util
|
@@ -122,6 +123,10 @@ module Puppet
|
|
122
123
|
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
|
123
124
|
end
|
124
125
|
|
126
|
+
Puppet::GettextConfig.reset_text_domain('cli')
|
127
|
+
Puppet::ModuleTranslations.load_from_modulepath(configured_environment.modules)
|
128
|
+
Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
|
129
|
+
|
125
130
|
# Puppet requires Facter, which initializes its lookup paths. Reset Facter to
|
126
131
|
# pickup the new $LOAD_PATH.
|
127
132
|
Facter.reset
|
@@ -165,11 +165,11 @@ class Parser
|
|
165
165
|
when 'IO'; :io
|
166
166
|
when 'Date'; :date
|
167
167
|
else
|
168
|
-
raise ArgumentError, "unsupported argument type '
|
168
|
+
raise ArgumentError, _("unsupported argument type '%{type}'") % { type: opts[:type].class.name }
|
169
169
|
end
|
170
170
|
when nil; nil
|
171
171
|
else
|
172
|
-
raise ArgumentError, "unsupported argument type '
|
172
|
+
raise ArgumentError, _("unsupported argument type '%{type}'") % { type: opts[:type] } unless TYPES.include?(opts[:type])
|
173
173
|
opts[:type]
|
174
174
|
end
|
175
175
|
|
@@ -223,7 +223,7 @@ class Parser
|
|
223
223
|
when /^[^-]/
|
224
224
|
opts[:long]
|
225
225
|
else
|
226
|
-
raise ArgumentError, "invalid long option name
|
226
|
+
raise ArgumentError, _("invalid long option name %{name}") % { name: opts[:long].inspect }
|
227
227
|
end
|
228
228
|
raise ArgumentError, _("long option name %{value0} is already taken; please specify a (different) :long") % { value0: opts[:long].inspect } if @long[opts[:long]]
|
229
229
|
|
@@ -232,7 +232,7 @@ class Parser
|
|
232
232
|
opts[:short] = case opts[:short]
|
233
233
|
when /^-(.)$/; $1
|
234
234
|
when nil, :none, /^.$/; opts[:short]
|
235
|
-
else raise ArgumentError, "invalid short option name '
|
235
|
+
else raise ArgumentError, _("invalid short option name '%{name}'") % { name: opts[:short].inspect }
|
236
236
|
end
|
237
237
|
|
238
238
|
if opts[:short]
|
@@ -812,7 +812,8 @@ def die arg, msg=nil
|
|
812
812
|
if @last_parser
|
813
813
|
@last_parser.die arg, msg
|
814
814
|
else
|
815
|
-
|
815
|
+
#TRANSLATORS 'Trollop' is the name of a module and 'die' and 'options' are methods in it and should not be translated.
|
816
|
+
raise ArgumentError, _("Trollop::die can only be called after Trollop::options")
|
816
817
|
end
|
817
818
|
end
|
818
819
|
|
data/lib/puppet/util/errors.rb
CHANGED
@@ -31,22 +31,75 @@ module Puppet::Util::Errors
|
|
31
31
|
error
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
|
35
|
+
|
36
|
+
# Return a human-readable string of this object's file, line, and pos attributes,
|
35
37
|
# if set.
|
36
38
|
#
|
37
|
-
# @
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
# @param file [String] the file path for the error (nil or "", for not known)
|
40
|
+
# @param line [String] the line number for the error (nil or "", for not known)
|
41
|
+
# @param column [String] the column number for the error (nil or "", for not known)
|
42
|
+
# @return [String] description of file, line, and column
|
43
|
+
#
|
44
|
+
def self.error_location(file, line=nil, column=nil)
|
45
|
+
file = nil if (file.is_a?(String) && file.empty?)
|
46
|
+
line = nil if (line.is_a?(String) && line.empty?)
|
47
|
+
column = nil if (column.is_a?(String) && column.empty?)
|
48
|
+
if file and line and column
|
49
|
+
_("(file: %{file}, line: %{line}, column: %{column})") % { file: file, line: line, column: column }
|
50
|
+
elsif file and line
|
51
|
+
_("(file: %{file}, line: %{line})") % { file: file, line: line }
|
52
|
+
elsif line and column
|
53
|
+
_("(line: %{line}, column: %{column})") % { line: line, column: column }
|
41
54
|
elsif line
|
42
|
-
_("
|
55
|
+
_("(line: %{line})") % { line: line }
|
43
56
|
elsif file
|
44
|
-
_("
|
57
|
+
_("(file: %{file})") % { file: file }
|
45
58
|
else
|
46
|
-
|
59
|
+
''
|
47
60
|
end
|
48
61
|
end
|
49
62
|
|
63
|
+
# Return a human-readable string of this object's file, line, and pos attributes,
|
64
|
+
# with a proceeding space in the output
|
65
|
+
# if set.
|
66
|
+
#
|
67
|
+
# @param file [String] the file path for the error (nil or "", for not known)
|
68
|
+
# @param line [String] the line number for the error (nil or "", for not known)
|
69
|
+
# @param column [String] the column number for the error (nil or "", for not known)
|
70
|
+
# @return [String] description of file, line, and column
|
71
|
+
#
|
72
|
+
def self.error_location_with_space(file, line=nil, column=nil)
|
73
|
+
error_location_str = error_location(file, line, column)
|
74
|
+
if error_location_str.empty?
|
75
|
+
''
|
76
|
+
else
|
77
|
+
' ' + error_location_str
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Return a human-readable string of this object's file and line
|
82
|
+
# where unknown entries are listed as 'unknown'
|
83
|
+
#
|
84
|
+
# @param file [String] the file path for the error (nil or "", for not known)
|
85
|
+
# @param line [String] the line number for the error (nil or "", for not known)
|
86
|
+
# @return [String] description of file, and line
|
87
|
+
def self.error_location_with_unknowns(file, line)
|
88
|
+
file = nil if (file.is_a?(String) && file.empty?)
|
89
|
+
line = nil if (line.is_a?(String) && line.empty?)
|
90
|
+
file = _('unknown') unless file
|
91
|
+
line = _('unknown') unless line
|
92
|
+
error_location(file, line)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Return a human-readable string of this object's file and line attributes,
|
96
|
+
# if set.
|
97
|
+
#
|
98
|
+
# @return [String] description of file and line with a leading space
|
99
|
+
def error_context
|
100
|
+
Puppet::Util::Errors.error_location_with_space(file, line)
|
101
|
+
end
|
102
|
+
|
50
103
|
# Wrap a call in such a way that we always throw the right exception and keep
|
51
104
|
# as much context as possible.
|
52
105
|
#
|
@@ -151,8 +151,7 @@ module Puppet::Util::FileParsing
|
|
151
151
|
if record.respond_to?(:process)
|
152
152
|
if ret = record.send(:process, line.dup)
|
153
153
|
unless ret.is_a?(Hash)
|
154
|
-
raise Puppet::DevError,
|
155
|
-
"Process record type #{record.name} returned non-hash"
|
154
|
+
raise Puppet::DevError, _("Process record type %{record_name} returned non-hash") % { record_name: record.name }
|
156
155
|
end
|
157
156
|
else
|
158
157
|
return nil
|
@@ -236,7 +235,7 @@ module Puppet::Util::FileParsing
|
|
236
235
|
|
237
236
|
# Handle parsing a single line.
|
238
237
|
def parse_line(line)
|
239
|
-
raise Puppet::DevError, "No record types defined; cannot parse lines" unless records?
|
238
|
+
raise Puppet::DevError, _("No record types defined; cannot parse lines") unless records?
|
240
239
|
|
241
240
|
@record_order.each do |record|
|
242
241
|
# These are basically either text or record lines.
|
@@ -247,8 +246,7 @@ module Puppet::Util::FileParsing
|
|
247
246
|
return result
|
248
247
|
end
|
249
248
|
else
|
250
|
-
raise Puppet::DevError,
|
251
|
-
"Somehow got invalid line type #{record.type}"
|
249
|
+
raise Puppet::DevError, _("Somehow got invalid line type %{record_type}") % { record_type: record.type }
|
252
250
|
end
|
253
251
|
end
|
254
252
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'openssl'
|
3
|
+
require 'puppet/network/http'
|
3
4
|
|
4
5
|
module Puppet::Util::HttpProxy
|
5
6
|
def self.proxy(uri)
|
@@ -172,7 +173,13 @@ module Puppet::Util::HttpProxy
|
|
172
173
|
|
173
174
|
0.upto(redirect_limit) do |redirection|
|
174
175
|
proxy = get_http_object(current_uri)
|
175
|
-
|
176
|
+
|
177
|
+
headers = { 'Accept' => '*/*', 'User-Agent' => Puppet[:http_user_agent] }
|
178
|
+
if Puppet.features.zlib?
|
179
|
+
headers.merge!({"Accept-Encoding" => Puppet::Network::HTTP::Compression::ACCEPT_ENCODING})
|
180
|
+
end
|
181
|
+
|
182
|
+
response = proxy.send(:head, current_uri.path, headers)
|
176
183
|
|
177
184
|
if [301, 302, 307].include?(response.code.to_i)
|
178
185
|
# handle the redirection
|
@@ -180,11 +187,12 @@ module Puppet::Util::HttpProxy
|
|
180
187
|
next
|
181
188
|
end
|
182
189
|
|
183
|
-
if
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
190
|
+
if method != :head
|
191
|
+
if block_given?
|
192
|
+
response = proxy.send("request_#{method}".to_sym, current_uri.path, headers, &block)
|
193
|
+
else
|
194
|
+
response = proxy.send(method, current_uri.path, headers)
|
195
|
+
end
|
188
196
|
end
|
189
197
|
|
190
198
|
Puppet.debug("HTTP #{method.to_s.upcase} request to #{current_uri} returned #{response.code} #{response.message}")
|