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
@@ -83,7 +83,15 @@ private
|
|
83
83
|
def unique_sections_in(ini, file, allowed_section_names)
|
84
84
|
ini.section_lines.collect do |section|
|
85
85
|
if !allowed_section_names.empty? && !allowed_section_names.include?(section.name)
|
86
|
-
|
86
|
+
error_location_str = Puppet::Util::Errors.error_location(file, section.line_number)
|
87
|
+
message = _("Illegal section '%{name}' in config file at %{error_location}.") %
|
88
|
+
{ name: section.name, error_location: error_location_str }
|
89
|
+
#TRANSLATORS 'puppet.conf' is the name of the puppet configuration file and should not be translated.
|
90
|
+
message += ' ' + _("The only valid puppet.conf sections are: [%{allowed_sections_list}].") %
|
91
|
+
{ allowed_sections_list: allowed_section_names.join(", ") }
|
92
|
+
message += ' ' + _("Please use the directory environments feature to specify environments.")
|
93
|
+
message += ' ' + _("(See https://docs.puppet.com/puppet/latest/reference/environments.html)")
|
94
|
+
raise(Puppet::Error, message)
|
87
95
|
end
|
88
96
|
section.name
|
89
97
|
end.uniq
|
@@ -126,13 +134,15 @@ private
|
|
126
134
|
if str =~ /^\s*(\w+)\s*=\s*([\w\d]+)\s*$/
|
127
135
|
param, value = $1.intern, $2
|
128
136
|
result[param] = value
|
129
|
-
|
137
|
+
unless [:owner, :mode, :group].include?(param)
|
138
|
+
raise ArgumentError, _("Invalid file option '%{parameter}'") % { parameter: param }
|
139
|
+
end
|
130
140
|
|
131
141
|
if param == :mode and value !~ /^\d+$/
|
132
|
-
raise ArgumentError, "File modes must be numbers"
|
142
|
+
raise ArgumentError, _("File modes must be numbers")
|
133
143
|
end
|
134
144
|
else
|
135
|
-
raise ArgumentError, "Could not parse '
|
145
|
+
raise ArgumentError, _("Could not parse '%{string}'") % { string: string }
|
136
146
|
end
|
137
147
|
end
|
138
148
|
''
|
@@ -66,13 +66,11 @@ class Puppet::Settings::EnvironmentConf
|
|
66
66
|
if disable_per_environment_manifest
|
67
67
|
environment_conf_manifest = absolute(raw_setting(:manifest))
|
68
68
|
if environment_conf_manifest && fallback_manifest_directory != environment_conf_manifest
|
69
|
-
|
70
|
-
"environment located at
|
71
|
-
|
72
|
-
"
|
73
|
-
|
74
|
-
"'#{environment_conf_manifest}', they will not be available!"]
|
75
|
-
Puppet.err(errmsg.join(' '))
|
69
|
+
#TRANSLATORS 'disable_per_environment_manifest' is a setting and 'environment.conf' is a file name and should not be translated
|
70
|
+
message = _("The 'disable_per_environment_manifest' setting is true, but the environment located at %{path_to_env} has a manifest setting in its environment.conf of '%{environment_conf}' which does not match the default_manifest setting '%{puppet_conf}'.") %
|
71
|
+
{ path_to_env: @path_to_env, environment_conf: environment_conf_manifest, puppet_conf: puppet_conf_manifest }
|
72
|
+
message += ' ' + _("If this environment is expecting to find modules in '%{environment_conf}', they will not be available!") % { environment_conf: environment_conf_manifest }
|
73
|
+
Puppet.err(message)
|
76
74
|
end
|
77
75
|
fallback_manifest_directory.to_s
|
78
76
|
else
|
@@ -138,13 +136,25 @@ class Puppet::Settings::EnvironmentConf
|
|
138
136
|
section_keys = config.sections.keys
|
139
137
|
main = config.sections[:main]
|
140
138
|
if section_keys.size > 1
|
141
|
-
|
139
|
+
# warn once per config file path
|
140
|
+
Puppet.warn_once(
|
141
|
+
:invalid_settings_section, "EnvironmentConf-section:#{path_to_conf_file}",
|
142
|
+
_("Invalid sections in environment.conf at '%{path_to_conf_file}'. Environment conf may not have sections. The following sections are being ignored: '%{sections}'") % {
|
143
|
+
path_to_conf_file: path_to_conf_file,
|
144
|
+
sections: (section_keys - [:main]).join(',')
|
145
|
+
})
|
142
146
|
valid = false
|
143
147
|
end
|
144
148
|
|
145
149
|
extraneous_settings = main.settings.map(&:name) - VALID_SETTINGS
|
146
150
|
if !extraneous_settings.empty?
|
147
|
-
|
151
|
+
# warn once per config file path
|
152
|
+
Puppet.warn_once(
|
153
|
+
:invalid_settings, "EnvironmentConf-settings:#{path_to_conf_file}",
|
154
|
+
_("Invalid settings in environment.conf at '%{path_to_conf_file}'. The following unknown setting(s) are being ignored: %{ignored_settings}") % {
|
155
|
+
path_to_conf_file: path_to_conf_file,
|
156
|
+
ignored_settings: extraneous_settings.join(', ')
|
157
|
+
})
|
148
158
|
valid = false
|
149
159
|
end
|
150
160
|
|
data/lib/puppet/ssl/base.rb
CHANGED
@@ -24,7 +24,7 @@ class Puppet::SSL::Base
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.wrapped_class
|
27
|
-
raise(Puppet::DevError, "
|
27
|
+
raise(Puppet::DevError, _("%{name} has not declared what class it wraps") % { name: self }) unless defined?(@wrapped_class)
|
28
28
|
@wrapped_class
|
29
29
|
end
|
30
30
|
|
@@ -40,7 +40,7 @@ class Puppet::SSL::Base
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def generate
|
43
|
-
raise Puppet::DevError, "
|
43
|
+
raise Puppet::DevError, _("%{class_name} did not override 'generate'") % { class_name: self.class }
|
44
44
|
end
|
45
45
|
|
46
46
|
def initialize(name)
|
@@ -64,8 +64,13 @@ class Puppet::SSL::Base
|
|
64
64
|
|
65
65
|
# Create an instance of our Puppet::SSL::* class using a given instance of the wrapped class
|
66
66
|
def self.from_instance(instance, name = nil)
|
67
|
-
|
68
|
-
|
67
|
+
unless instance.is_a?(wrapped_class)
|
68
|
+
raise ArgumentError, _("Object must be an instance of %{class_name}, %{actual_class} given") %
|
69
|
+
{ class_name: wrapped_class, actual_class: instance.class }
|
70
|
+
end
|
71
|
+
if name.nil? and !instance.respond_to?(:subject)
|
72
|
+
raise ArgumentError, _("Name must be supplied if it cannot be determined from the instance")
|
73
|
+
end
|
69
74
|
|
70
75
|
name ||= name_from_subject(instance.subject)
|
71
76
|
result = new(name)
|
data/lib/puppet/ssl/oids.rb
CHANGED
@@ -70,12 +70,18 @@ module Puppet::SSL::Oids
|
|
70
70
|
["1.3.6.1.4.1.34380.1.3.13", 'pp_auth_role', 'Puppet Node Role Name for Authorization'],
|
71
71
|
]
|
72
72
|
|
73
|
+
@did_register_puppet_oids = false
|
74
|
+
|
73
75
|
# Register our custom Puppet OIDs with OpenSSL so they can be used as CSR
|
74
76
|
# extensions. Without registering these OIDs, OpenSSL will fail when it
|
75
77
|
# encounters such an extension in a CSR.
|
76
78
|
def self.register_puppet_oids()
|
77
|
-
|
78
|
-
|
79
|
+
if !@did_register_puppet_oids
|
80
|
+
PUPPET_OIDS.each do |oid_defn|
|
81
|
+
OpenSSL::ASN1::ObjectId.register(*oid_defn)
|
82
|
+
end
|
83
|
+
|
84
|
+
@did_register_puppet_oids = true
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
@@ -24,12 +24,11 @@ class Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxCh
|
|
24
24
|
# simply skips all non base64 characters
|
25
25
|
Base64.strict_decode64(cleaned_text)
|
26
26
|
rescue => e
|
27
|
-
if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
msg = _("Base64 syntax checker: Cannot parse invalid Base64 string - %{msg2}") % { msg2: msg2 }
|
27
|
+
msg = if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
|
28
|
+
_("Base64 syntax checker: Cannot parse invalid Base64 string - padding is not correct")
|
29
|
+
else
|
30
|
+
_("Base64 syntax checker: Cannot parse invalid Base64 string - contains letters outside strict base 64 range (or whitespace)")
|
31
|
+
end
|
33
32
|
|
34
33
|
# TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities
|
35
34
|
# and the issue code. (In this case especially, where there is only a single error message being issued).
|
data/lib/puppet/transaction.rb
CHANGED
@@ -93,7 +93,7 @@ class Puppet::Transaction
|
|
93
93
|
|
94
94
|
perform_pre_run_checks
|
95
95
|
|
96
|
-
persistence.load if
|
96
|
+
persistence.load if persistence.enabled?(catalog)
|
97
97
|
|
98
98
|
Puppet.info _("Applying configuration version '%{version}'") % { version: catalog.version } if catalog.version
|
99
99
|
|
@@ -145,7 +145,7 @@ class Puppet::Transaction
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
persistence.save if
|
148
|
+
persistence.save if persistence.enabled?(catalog)
|
149
149
|
end
|
150
150
|
|
151
151
|
# Graph cycles are returned as an array of arrays
|
@@ -177,7 +177,7 @@ class Puppet::Transaction
|
|
177
177
|
else
|
178
178
|
resource.info _("Starting to evaluate the resource") if Puppet[:evaltrace] and @catalog.host_config?
|
179
179
|
seconds = thinmark { block.call(resource) }
|
180
|
-
resource.info _("Evaluated in %
|
180
|
+
resource.info _("Evaluated in %{seconds} seconds") % { seconds: "%0.2f" % seconds } if Puppet[:evaltrace] and @catalog.host_config?
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -187,6 +187,9 @@ class Puppet::Transaction
|
|
187
187
|
report.resources_failed_to_generate = true
|
188
188
|
end
|
189
189
|
|
190
|
+
# mark the end of transaction evaluate.
|
191
|
+
report.transaction_completed = true
|
192
|
+
|
190
193
|
Puppet.debug "Finishing transaction #{object_id}"
|
191
194
|
end
|
192
195
|
|
@@ -262,6 +265,7 @@ class Puppet::Transaction
|
|
262
265
|
resource_status(resource).skipped = true
|
263
266
|
resource.debug("Resource is being skipped, unscheduling all events")
|
264
267
|
event_manager.dequeue_all_events_for_resource(resource)
|
268
|
+
persistence.copy_skipped(resource.ref)
|
265
269
|
else
|
266
270
|
resource_status(resource).scheduled = true
|
267
271
|
apply(resource, ancestor)
|
@@ -40,6 +40,14 @@ class Puppet::Transaction::Persistence
|
|
40
40
|
@new_data["resources"][resource_name]["parameters"][param_name]["system_value"] = value
|
41
41
|
end
|
42
42
|
|
43
|
+
def copy_skipped(resource_name)
|
44
|
+
@old_data["resources"] ||= {}
|
45
|
+
old_value = @old_data["resources"][resource_name]
|
46
|
+
if !old_value.nil?
|
47
|
+
@new_data["resources"][resource_name] = old_value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
43
51
|
# Load data from the persistence store on disk.
|
44
52
|
def load
|
45
53
|
filename = Puppet[:transactionstorefile]
|
@@ -52,7 +60,7 @@ class Puppet::Transaction::Persistence
|
|
52
60
|
end
|
53
61
|
|
54
62
|
result = nil
|
55
|
-
Puppet::Util.benchmark(:debug, _("Loaded transaction store file")) do
|
63
|
+
Puppet::Util.benchmark(:debug, _("Loaded transaction store file in %{seconds} seconds")) do
|
56
64
|
begin
|
57
65
|
result = Puppet::Util::Yaml.load_file(filename, false, true)
|
58
66
|
rescue Puppet::Util::Yaml::YamlLoadError => detail
|
@@ -81,4 +89,11 @@ class Puppet::Transaction::Persistence
|
|
81
89
|
def save
|
82
90
|
Puppet::Util::Yaml.dump(@new_data, Puppet[:transactionstorefile])
|
83
91
|
end
|
92
|
+
|
93
|
+
# Use the catalog and run_mode to determine if persistence should be enabled or not
|
94
|
+
# @param [Puppet::Resource::Catalog] catalog catalog being processed
|
95
|
+
# @return [boolean] true if persistence is enabled
|
96
|
+
def enabled?(catalog)
|
97
|
+
catalog.host_config? && Puppet.run_mode.name == :agent
|
98
|
+
end
|
84
99
|
end
|
@@ -130,6 +130,10 @@ class Puppet::Transaction::Report
|
|
130
130
|
#
|
131
131
|
attr_accessor :resources_failed_to_generate
|
132
132
|
|
133
|
+
# @return [Boolean] true if the transaction completed it's evaluate
|
134
|
+
#
|
135
|
+
attr_accessor :transaction_completed
|
136
|
+
|
133
137
|
def self.from_data_hash(data)
|
134
138
|
obj = self.allocate
|
135
139
|
obj.initialize_from_hash(data)
|
@@ -171,6 +175,7 @@ class Puppet::Transaction::Report
|
|
171
175
|
# @api private
|
172
176
|
def compute_status(resource_metrics, change_metric)
|
173
177
|
if resources_failed_to_generate ||
|
178
|
+
!transaction_completed ||
|
174
179
|
(resource_metrics["failed"] || 0) > 0 ||
|
175
180
|
(resource_metrics["failed_to_restart"] || 0) > 0
|
176
181
|
'failed'
|
@@ -227,6 +232,7 @@ class Puppet::Transaction::Report
|
|
227
232
|
@noop = Puppet[:noop]
|
228
233
|
@noop_pending = false
|
229
234
|
@corrective_change = false
|
235
|
+
@transaction_completed = false
|
230
236
|
end
|
231
237
|
|
232
238
|
# @api private
|
data/lib/puppet/type.rb
CHANGED
@@ -425,7 +425,7 @@ class Type
|
|
425
425
|
when 1;
|
426
426
|
[ [ /(.*)/m, [ [key_attributes.first] ] ] ]
|
427
427
|
else
|
428
|
-
raise Puppet::DevError,"you must specify title patterns when there are two or more key attributes"
|
428
|
+
raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes")
|
429
429
|
end
|
430
430
|
end
|
431
431
|
|
@@ -500,11 +500,10 @@ class Type
|
|
500
500
|
# This is here for types that might still have the old method of defining
|
501
501
|
# a parent class.
|
502
502
|
unless options.is_a? Hash
|
503
|
-
raise Puppet::DevError,
|
504
|
-
"Options must be a hash, not #{options.inspect}"
|
503
|
+
raise Puppet::DevError, _("Options must be a hash, not %{type}") % { type: options.inspect }
|
505
504
|
end
|
506
505
|
|
507
|
-
raise Puppet::DevError, "Class
|
506
|
+
raise Puppet::DevError, _("Class %{class_name} already has a property named %{property}") % { class_name: self.name, property: name } if @validproperties.include?(name)
|
508
507
|
|
509
508
|
if parent = options[:parent]
|
510
509
|
options.delete(:parent)
|
@@ -590,7 +589,7 @@ class Type
|
|
590
589
|
|
591
590
|
# @return [Boolean] Returns true if the given name is the name of an existing parameter
|
592
591
|
def self.validparameter?(name)
|
593
|
-
raise Puppet::DevError, "Class
|
592
|
+
raise Puppet::DevError, _("Class %{class_name} has not defined parameters") % { class_name: self } unless defined?(@parameters)
|
594
593
|
!!(@paramhash.include?(name) or @@metaparamhash.include?(name))
|
595
594
|
end
|
596
595
|
|
@@ -674,7 +673,8 @@ class Type
|
|
674
673
|
# make sure the parameter doesn't have any errors
|
675
674
|
property.value = value
|
676
675
|
rescue Puppet::Error, ArgumentError => detail
|
677
|
-
error = Puppet::ResourceError.new("Parameter
|
676
|
+
error = Puppet::ResourceError.new(_("Parameter %{name} failed on %{ref}: %{detail}") %
|
677
|
+
{ name: name, ref: ref, detail: detail })
|
678
678
|
adderrorcontext(error, detail)
|
679
679
|
raise error
|
680
680
|
end
|
@@ -696,7 +696,7 @@ class Type
|
|
696
696
|
if @parameters.has_key?(attr)
|
697
697
|
@parameters.delete(attr)
|
698
698
|
else
|
699
|
-
raise Puppet::DevError.new("Undefined attribute '
|
699
|
+
raise Puppet::DevError.new(_("Undefined attribute '%{attribute}' in %{name}") % { attribute: attr, name: self})
|
700
700
|
end
|
701
701
|
end
|
702
702
|
|
@@ -1018,8 +1018,8 @@ class Type
|
|
1018
1018
|
|
1019
1019
|
if property = @parameters[:ensure]
|
1020
1020
|
unless is.include? property
|
1021
|
-
|
1022
|
-
|
1021
|
+
#TRANSLATORS 'is' is a variable name and should not be translated
|
1022
|
+
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: property.name }
|
1023
1023
|
end
|
1024
1024
|
ensureis = is[property]
|
1025
1025
|
if property.safe_insync?(ensureis) and property.should == :absent
|
@@ -1029,8 +1029,8 @@ class Type
|
|
1029
1029
|
|
1030
1030
|
properties.each { |prop|
|
1031
1031
|
unless is.include? prop
|
1032
|
-
|
1033
|
-
|
1032
|
+
#TRANSLATORS 'is' is a variable name and should not be translated
|
1033
|
+
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: prop.name }
|
1034
1034
|
end
|
1035
1035
|
|
1036
1036
|
propis = is[prop]
|
@@ -1156,7 +1156,7 @@ class Type
|
|
1156
1156
|
# Either requires providers or must be overridden.
|
1157
1157
|
# @raise [Puppet::DevError] when there are no providers and the implementation has not overridden this method.
|
1158
1158
|
def self.instances
|
1159
|
-
raise Puppet::DevError, "
|
1159
|
+
raise Puppet::DevError, _("%{name} has no providers and has not overridden 'instances'") % { name: self.name } if provider_hash.empty?
|
1160
1160
|
|
1161
1161
|
# Put the default provider first, then the rest of the suitable providers.
|
1162
1162
|
provider_instances = {}
|
@@ -1289,9 +1289,7 @@ class Type
|
|
1289
1289
|
end
|
1290
1290
|
|
1291
1291
|
newmetaparam(:audit) do
|
1292
|
-
desc "
|
1293
|
-
|
1294
|
-
Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
|
1292
|
+
desc "Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
|
1295
1293
|
attribute name, an array of attribute names, or `all`.
|
1296
1294
|
|
1297
1295
|
Auditing a resource attribute has two effects: First, whenever a catalog
|
@@ -1312,12 +1310,6 @@ class Type
|
|
1312
1310
|
and the second run will log the edit made by Puppet.)"
|
1313
1311
|
|
1314
1312
|
validate do |list|
|
1315
|
-
if Puppet.settings[:strict] != :off
|
1316
|
-
# Only warn if `audit` metaparam came from a manifest
|
1317
|
-
if file && line
|
1318
|
-
puppet_deprecation_warning(_("The `audit` metaparameter is deprecated and will be ignored in a future release."), { :line => line, :file => file })
|
1319
|
-
end
|
1320
|
-
end
|
1321
1313
|
list = Array(list).collect {|p| p.to_sym}
|
1322
1314
|
unless list == [:all]
|
1323
1315
|
list.each do |param|
|
@@ -1423,7 +1415,7 @@ class Type
|
|
1423
1415
|
munge do |aliases|
|
1424
1416
|
aliases = [aliases] unless aliases.is_a?(Array)
|
1425
1417
|
|
1426
|
-
raise(ArgumentError, "Cannot add aliases without a catalog") unless @resource.catalog
|
1418
|
+
raise(ArgumentError, _("Cannot add aliases without a catalog")) unless @resource.catalog
|
1427
1419
|
|
1428
1420
|
aliases.each do |other|
|
1429
1421
|
if obj = @resource.catalog.resource(@resource.class.name, other)
|
@@ -1502,7 +1494,8 @@ class Type
|
|
1502
1494
|
@value.each do |ref|
|
1503
1495
|
unless @resource.catalog.resource(ref.to_s)
|
1504
1496
|
description = self.class.direction == :in ? "dependency" : "dependent"
|
1505
|
-
fail ResourceError, "Could not find
|
1497
|
+
fail ResourceError, _("Could not find %{description} %{ref} for %{resource}") %
|
1498
|
+
{ description: description, ref: ref, resource: resource.ref }
|
1506
1499
|
end
|
1507
1500
|
end
|
1508
1501
|
end
|
@@ -1761,9 +1754,8 @@ end
|
|
1761
1754
|
defaults = defaults.find_all { |provider| provider.specificity == max }
|
1762
1755
|
|
1763
1756
|
if defaults.length > 1
|
1764
|
-
Puppet.warning(
|
1765
|
-
|
1766
|
-
)
|
1757
|
+
Puppet.warning(_("Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}") %
|
1758
|
+
{ name: self.name, provider_list: defaults.collect { |i| i.name.to_s }.join(", "), selected_provider: defaults[0].name })
|
1767
1759
|
end
|
1768
1760
|
|
1769
1761
|
@defaultprovider = defaults.shift unless defaults.empty?
|
@@ -1847,8 +1839,7 @@ end
|
|
1847
1839
|
if provider = self.provider(pname)
|
1848
1840
|
provider
|
1849
1841
|
else
|
1850
|
-
raise Puppet::DevError,
|
1851
|
-
"Could not find parent provider #{pname} of #{name}"
|
1842
|
+
raise Puppet::DevError, _("Could not find parent provider %{parent} of %{name}") % { parent: pname, name: name }
|
1852
1843
|
end
|
1853
1844
|
end
|
1854
1845
|
else
|
@@ -1924,7 +1915,7 @@ end
|
|
1924
1915
|
provider_class = provider_class.class.name if provider_class.is_a?(Puppet::Provider)
|
1925
1916
|
|
1926
1917
|
unless @resource.class.provider(provider_class)
|
1927
|
-
raise ArgumentError, "Invalid
|
1918
|
+
raise ArgumentError, _("Invalid %{resource} provider '%{provider_class}'") % { resource: @resource.class.name, provider_class: provider_class}
|
1928
1919
|
end
|
1929
1920
|
end
|
1930
1921
|
|
@@ -2007,7 +1998,7 @@ end
|
|
2007
1998
|
elsif klass = self.class.provider(name)
|
2008
1999
|
@provider = klass.new(self)
|
2009
2000
|
else
|
2010
|
-
raise ArgumentError, "Could not find
|
2001
|
+
raise ArgumentError, _("Could not find %{name} provider of %{provider}") % { name: name, provider: self.class.name }
|
2011
2002
|
end
|
2012
2003
|
end
|
2013
2004
|
|
@@ -2124,7 +2115,7 @@ end
|
|
2124
2115
|
#
|
2125
2116
|
def autorelation(rel_type, rel_catalog = nil)
|
2126
2117
|
rel_catalog ||= catalog
|
2127
|
-
raise
|
2118
|
+
raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
|
2128
2119
|
|
2129
2120
|
reqs = []
|
2130
2121
|
|
@@ -2435,11 +2426,12 @@ end
|
|
2435
2426
|
if p.is_a?(Puppet::Property)
|
2436
2427
|
p.sensitive = true
|
2437
2428
|
elsif p.is_a?(Puppet::Parameter)
|
2438
|
-
warning("Unable to mark '
|
2429
|
+
warning(_("Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted.") %
|
2430
|
+
{ name: name })
|
2439
2431
|
elsif self.class.attrclass(name)
|
2440
|
-
warning("Unable to mark '
|
2432
|
+
warning(_("Unable to mark '%{name}' as sensitive: the property itself was not assigned a value.") % { name: name })
|
2441
2433
|
else
|
2442
|
-
err("Unable to mark '
|
2434
|
+
err(_("Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}.") % { name: name, type: type })
|
2443
2435
|
end
|
2444
2436
|
end
|
2445
2437
|
end
|
@@ -2490,7 +2482,7 @@ end
|
|
2490
2482
|
rescue ArgumentError, Puppet::Error, TypeError
|
2491
2483
|
raise
|
2492
2484
|
rescue => detail
|
2493
|
-
error = Puppet::DevError.new(
|
2485
|
+
error = Puppet::DevError.new(_("Could not set %{attribute} on %{class_name}: %{detail}") % { attribute: attr, class_name: self.class.name, detail: detail })
|
2494
2486
|
error.set_backtrace(detail.backtrace)
|
2495
2487
|
raise error
|
2496
2488
|
end
|