bolt 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bolt/cli.rb +30 -131
- data/lib/bolt/config.rb +35 -9
- data/lib/bolt/executor.rb +33 -7
- data/lib/bolt/node.rb +19 -2
- data/lib/bolt/node/orch.rb +4 -4
- data/lib/bolt/node/ssh.rb +46 -21
- data/lib/bolt/node/winrm.rb +12 -23
- data/lib/bolt/outputter.rb +9 -0
- data/lib/bolt/outputter/human.rb +33 -4
- data/lib/bolt/outputter/json.rb +6 -1
- data/lib/bolt/pal.rb +87 -20
- data/lib/bolt/version.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_command.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_plan.rb +18 -1
- data/modules/boltlib/lib/puppet/functions/run_script.rb +1 -1
- data/modules/boltlib/lib/puppet/functions/run_task.rb +2 -1
- data/vendored/facter/lib/facter/virtual.rb +2 -0
- data/vendored/hiera/lib/hiera/config.rb +2 -2
- data/vendored/hiera/lib/hiera/version.rb +1 -1
- data/vendored/puppet/lib/hiera/puppet_function.rb +5 -2
- data/vendored/puppet/lib/hiera_puppet.rb +3 -3
- data/vendored/puppet/lib/puppet/agent/locker.rb +6 -5
- data/vendored/puppet/lib/puppet/application/filebucket.rb +23 -6
- data/vendored/puppet/lib/puppet/daemon.rb +2 -2
- data/vendored/puppet/lib/puppet/defaults.rb +42 -10
- data/vendored/puppet/lib/puppet/error.rb +5 -15
- data/vendored/puppet/lib/puppet/external/pson/common.rb +2 -2
- data/vendored/puppet/lib/puppet/face/module/build.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/install.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/search.rb +2 -1
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +1 -0
- data/vendored/puppet/lib/puppet/face/module/upgrade.rb +1 -0
- data/vendored/puppet/lib/puppet/file_bucket/dipper.rb +1 -1
- data/vendored/puppet/lib/puppet/file_serving/base.rb +2 -1
- data/vendored/puppet/lib/puppet/file_serving/configuration/parser.rb +21 -9
- data/vendored/puppet/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/vendored/puppet/lib/puppet/forge.rb +2 -1
- data/vendored/puppet/lib/puppet/functions/binary_file.rb +1 -0
- data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/vendored/puppet/lib/puppet/functions/module_directory.rb +41 -0
- data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/unique.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/yaml_data.rb +1 -1
- data/vendored/puppet/lib/puppet/gettext/config.rb +10 -5
- data/vendored/puppet/lib/puppet/graph/relationship_graph.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +3 -3
- data/vendored/puppet/lib/puppet/indirector/facts/network_device.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/file_bucket_file/file.rb +10 -3
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +17 -9
- data/vendored/puppet/lib/puppet/indirector/ldap.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
- data/vendored/puppet/lib/puppet/indirector/rest.rb +2 -1
- data/vendored/puppet/lib/puppet/indirector/ssl_file.rb +2 -2
- data/vendored/puppet/lib/puppet/indirector/terminus.rb +3 -3
- data/vendored/puppet/lib/puppet/interface.rb +1 -1
- data/vendored/puppet/lib/puppet/interface/action.rb +41 -24
- data/vendored/puppet/lib/puppet/interface/action_builder.rb +14 -5
- data/vendored/puppet/lib/puppet/interface/action_manager.rb +1 -1
- data/vendored/puppet/lib/puppet/interface/documentation.rb +21 -10
- data/vendored/puppet/lib/puppet/interface/face_collection.rb +4 -2
- data/vendored/puppet/lib/puppet/interface/option.rb +36 -15
- data/vendored/puppet/lib/puppet/interface/option_builder.rb +23 -9
- data/vendored/puppet/lib/puppet/interface/option_manager.rb +8 -3
- data/vendored/puppet/lib/puppet/metatype/manager.rb +7 -3
- data/vendored/puppet/lib/puppet/module.rb +2 -1
- data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +4 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +3 -0
- data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +3 -3
- data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +10 -5
- data/vendored/puppet/lib/puppet/network/authstore.rb +2 -2
- data/vendored/puppet/lib/puppet/network/client_request.rb +1 -1
- data/vendored/puppet/lib/puppet/network/format.rb +3 -3
- data/vendored/puppet/lib/puppet/network/http/api/indirection_type.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +1 -3
- data/vendored/puppet/lib/puppet/node.rb +16 -7
- data/vendored/puppet/lib/puppet/parameter.rb +3 -3
- data/vendored/puppet/lib/puppet/parameter/value_collection.rb +5 -2
- data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/ast/node.rb +2 -2
- data/vendored/puppet/lib/puppet/parser/compiler.rb +6 -5
- data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
- data/vendored/puppet/lib/puppet/parser/functions/generate.rb +2 -4
- data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -2
- data/vendored/puppet/lib/puppet/parser/functions/sha256.rb +5 -0
- data/vendored/puppet/lib/puppet/parser/functions/template.rb +6 -2
- data/vendored/puppet/lib/puppet/parser/resource.rb +18 -91
- data/vendored/puppet/lib/puppet/parser/scope.rb +12 -11
- data/vendored/puppet/lib/puppet/parser/templatewrapper.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +5 -6
- data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/functions/function.rb +8 -2
- data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +7 -2
- data/vendored/puppet/lib/puppet/pops/issues.rb +14 -4
- data/vendored/puppet/lib/puppet/pops/label_provider.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/loader/base_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/dependency_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/loader.rb +6 -1
- data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +27 -6
- data/vendored/puppet/lib/puppet/pops/loader/runtime3_type_loader.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/loaders.rb +7 -3
- data/vendored/puppet/lib/puppet/pops/lookup/explainer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/merge_strategy.rb +6 -3
- data/vendored/puppet/lib/puppet/pops/migration/migration_checker.rb +8 -8
- data/vendored/puppet/lib/puppet/pops/model/factory.rb +4 -2
- data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +6 -2
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +36 -15
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +4 -1
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +75 -7
- data/vendored/puppet/lib/puppet/pops/types/types.rb +9 -5
- data/vendored/puppet/lib/puppet/pops/validation.rb +14 -12
- data/vendored/puppet/lib/puppet/property.rb +14 -6
- data/vendored/puppet/lib/puppet/property/ensure.rb +2 -2
- data/vendored/puppet/lib/puppet/provider.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/group/aix.rb +4 -2
- data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +25 -1
- data/vendored/puppet/lib/puppet/provider/ldap.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/naginator.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/nameservice.rb +7 -4
- data/vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
- data/vendored/puppet/lib/puppet/provider/nameservice/objectadd.rb +13 -24
- data/vendored/puppet/lib/puppet/provider/nameservice/pw.rb +14 -14
- data/vendored/puppet/lib/puppet/provider/package/aix.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pkg.rb +3 -2
- data/vendored/puppet/lib/puppet/provider/package/yum.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/parsedfile.rb +4 -4
- data/vendored/puppet/lib/puppet/provider/service/base.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/service/launchd.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/service/runit.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -0
- data/vendored/puppet/lib/puppet/provider/service/upstart.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/user/aix.rb +13 -6
- data/vendored/puppet/lib/puppet/provider/user/openbsd.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/user/useradd.rb +33 -4
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +2 -1
- data/vendored/puppet/lib/puppet/provider/zone/solaris.rb +2 -2
- data/vendored/puppet/lib/puppet/relationship.rb +2 -1
- data/vendored/puppet/lib/puppet/reports/store.rb +1 -1
- data/vendored/puppet/lib/puppet/resource.rb +7 -5
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +14 -11
- data/vendored/puppet/lib/puppet/resource/catalog.rb +33 -18
- data/vendored/puppet/lib/puppet/resource/type.rb +5 -5
- data/vendored/puppet/lib/puppet/settings.rb +19 -13
- data/vendored/puppet/lib/puppet/settings/base_setting.rb +23 -8
- data/vendored/puppet/lib/puppet/settings/config_file.rb +14 -4
- data/vendored/puppet/lib/puppet/settings/environment_conf.rb +5 -7
- data/vendored/puppet/lib/puppet/settings/ini_file.rb +4 -0
- data/vendored/puppet/lib/puppet/ssl/base.rb +9 -4
- data/vendored/puppet/lib/puppet/ssl/oids.rb +8 -2
- data/vendored/puppet/lib/puppet/transaction.rb +6 -2
- data/vendored/puppet/lib/puppet/transaction/persistence.rb +15 -0
- data/vendored/puppet/lib/puppet/transaction/report.rb +9 -1
- data/vendored/puppet/lib/puppet/type.rb +26 -26
- data/vendored/puppet/lib/puppet/type/file.rb +2 -1
- data/vendored/puppet/lib/puppet/type/file/data_sync.rb +2 -1
- data/vendored/puppet/lib/puppet/type/file/source.rb +1 -1
- data/vendored/puppet/lib/puppet/type/group.rb +4 -1
- data/vendored/puppet/lib/puppet/type/mount.rb +1 -1
- data/vendored/puppet/lib/puppet/type/resources.rb +1 -1
- data/vendored/puppet/lib/puppet/type/user.rb +12 -7
- data/vendored/puppet/lib/puppet/type/zone.rb +1 -1
- data/vendored/puppet/lib/puppet/util.rb +15 -21
- data/vendored/puppet/lib/puppet/util/at_fork/solaris.rb +6 -4
- data/vendored/puppet/lib/puppet/util/command_line/trollop.rb +6 -5
- data/vendored/puppet/lib/puppet/util/errors.rb +59 -8
- data/vendored/puppet/lib/puppet/util/fileparsing.rb +3 -5
- data/vendored/puppet/lib/puppet/util/http_proxy.rb +14 -6
- data/vendored/puppet/lib/puppet/util/instance_loader.rb +1 -3
- data/vendored/puppet/lib/puppet/util/ldap/manager.rb +6 -3
- data/vendored/puppet/lib/puppet/util/log.rb +15 -21
- data/vendored/puppet/lib/puppet/util/logging.rb +21 -28
- data/vendored/puppet/lib/puppet/util/methodhelper.rb +1 -1
- data/vendored/puppet/lib/puppet/util/nagios_maker.rb +1 -1
- data/vendored/puppet/lib/puppet/util/network_device/config.rb +20 -13
- data/vendored/puppet/lib/puppet/util/platform.rb +13 -0
- data/vendored/puppet/lib/puppet/util/posix.rb +1 -1
- data/vendored/puppet/lib/puppet/util/provider_features.rb +1 -1
- data/vendored/puppet/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/vendored/puppet/lib/puppet/util/selinux.rb +1 -1
- data/vendored/puppet/lib/puppet/util/windows/eventlog.rb +10 -5
- data/vendored/puppet/lib/puppet/util/windows/file.rb +61 -9
- data/vendored/puppet/lib/puppet/util/windows/process.rb +1 -1
- data/vendored/puppet/lib/puppet/util/windows/taskscheduler.rb +2 -2
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- data/vendored/puppet/lib/puppet_pal.rb +23 -22
- metadata +4 -2
@@ -11,10 +11,14 @@ class Puppet::Settings::BaseSetting
|
|
11
11
|
|
12
12
|
def call_hook=(value)
|
13
13
|
if value.nil?
|
14
|
-
|
14
|
+
#TRANSLATORS ':%{name}', ':call_hook', and ':on_write_only' should not be translated
|
15
|
+
Puppet.warning _("Setting :%{name} :call_hook is nil, defaulting to :on_write_only") % { name: name }
|
15
16
|
value = :on_write_only
|
16
17
|
end
|
17
|
-
|
18
|
+
unless self.class.available_call_hook_values.include?(value)
|
19
|
+
#TRANSLATORS 'call_hook' is a Puppet option name and should not be translated
|
20
|
+
raise ArgumentError, _("Invalid option %{value} for call_hook") % { value: value }
|
21
|
+
end
|
18
22
|
@call_hook = value
|
19
23
|
end
|
20
24
|
|
@@ -67,16 +71,23 @@ class Puppet::Settings::BaseSetting
|
|
67
71
|
@call_hook = :on_write_only if args[:hook] and not args[:call_hook]
|
68
72
|
@has_hook = false
|
69
73
|
|
70
|
-
|
74
|
+
if args[:call_hook] and not args[:hook]
|
75
|
+
#TRANSLATORS ':call_hook' and ':hook' are specific setting names and should not be translated
|
76
|
+
raise ArgumentError, _("Cannot reference :call_hook for :%{name} if no :hook is defined") % { name: @name }
|
77
|
+
end
|
71
78
|
|
72
79
|
args.each do |param, value|
|
73
80
|
method = param.to_s + "="
|
74
|
-
|
81
|
+
unless self.respond_to? method
|
82
|
+
raise ArgumentError, _("%{class_name} (setting '%{setting}') does not accept %{parameter}") %
|
83
|
+
{ class_name: self.class, setting: args[:name], parameter: param }
|
84
|
+
end
|
75
85
|
|
76
86
|
self.send(method, value)
|
77
87
|
end
|
78
|
-
|
79
|
-
|
88
|
+
unless self.desc
|
89
|
+
raise ArgumentError, _("You must provide a description for the %{class_name} config option") % { class_name: self.name }
|
90
|
+
end
|
80
91
|
end
|
81
92
|
|
82
93
|
def iscreated
|
@@ -89,7 +100,7 @@ class Puppet::Settings::BaseSetting
|
|
89
100
|
|
90
101
|
# short name for the celement
|
91
102
|
def short=(value)
|
92
|
-
raise ArgumentError, "Short names can only be one character." if value.to_s.length != 1
|
103
|
+
raise ArgumentError, _("Short names can only be one character.") if value.to_s.length != 1
|
93
104
|
@short = value.to_s
|
94
105
|
end
|
95
106
|
|
@@ -151,7 +162,11 @@ class Puppet::Settings::BaseSetting
|
|
151
162
|
end
|
152
163
|
|
153
164
|
def deprecated=(deprecation)
|
154
|
-
|
165
|
+
unless [:completely, :allowed_on_commandline].include?(deprecation)
|
166
|
+
#TRANSLATORS 'deprecated' is a Puppet setting and ':completely' and ':allowed_on_commandline' are possible values and should not be translated
|
167
|
+
raise ArgumentError, _("Unsupported deprecated value '%{deprecation}'.") % { deprecation: deprecation } +
|
168
|
+
' ' + _("Supported values for deprecated are ':completely' or ':allowed_on_commandline'")
|
169
|
+
end
|
155
170
|
@deprecated = deprecation
|
156
171
|
end
|
157
172
|
|
@@ -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
|
''
|
@@ -65,13 +65,11 @@ class Puppet::Settings::EnvironmentConf
|
|
65
65
|
if disable_per_environment_manifest
|
66
66
|
environment_conf_manifest = absolute(raw_setting(:manifest))
|
67
67
|
if environment_conf_manifest && fallback_manifest_directory != environment_conf_manifest
|
68
|
-
|
69
|
-
"environment located at
|
70
|
-
|
71
|
-
"
|
72
|
-
|
73
|
-
"'#{environment_conf_manifest}', they will not be available!"]
|
74
|
-
Puppet.err(errmsg.join(' '))
|
68
|
+
#TRANSLATORS 'disable_per_environment_manifest' is a setting and 'environment.conf' is a file name and should not be translated
|
69
|
+
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}'.") %
|
70
|
+
{ path_to_env: @path_to_env, environment_conf: environment_conf_manifest, puppet_conf: puppet_conf_manifest }
|
71
|
+
message += ' ' + _("If this environment is expecting to find modules in '%{environment_conf}', they will not be available!") % { environment_conf: environment_conf_manifest }
|
72
|
+
Puppet.err(message)
|
75
73
|
end
|
76
74
|
fallback_manifest_directory.to_s
|
77
75
|
else
|
@@ -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)
|
@@ -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
|
|
@@ -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
|
@@ -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]
|
@@ -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'
|
@@ -213,7 +218,7 @@ class Puppet::Transaction::Report
|
|
213
218
|
@external_times ||= {}
|
214
219
|
@host = Puppet[:node_name_value]
|
215
220
|
@time = Time.now
|
216
|
-
@report_format =
|
221
|
+
@report_format = 8
|
217
222
|
@puppet_version = Puppet.version
|
218
223
|
@configuration_version = configuration_version
|
219
224
|
@transaction_uuid = transaction_uuid
|
@@ -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
|
@@ -237,6 +243,7 @@ class Puppet::Transaction::Report
|
|
237
243
|
@transaction_uuid = data['transaction_uuid']
|
238
244
|
@environment = data['environment']
|
239
245
|
@status = data['status']
|
246
|
+
@transaction_completed = data['transaction_completed']
|
240
247
|
@noop = data['noop']
|
241
248
|
@noop_pending = data['noop_pending']
|
242
249
|
@host = data['host']
|
@@ -298,6 +305,7 @@ class Puppet::Transaction::Report
|
|
298
305
|
'report_format' => @report_format,
|
299
306
|
'puppet_version' => @puppet_version,
|
300
307
|
'status' => @status,
|
308
|
+
'transaction_completed' => @transaction_completed,
|
301
309
|
'noop' => @noop,
|
302
310
|
'noop_pending' => @noop_pending,
|
303
311
|
'environment' => @environment,
|
@@ -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 = {}
|
@@ -1415,7 +1415,7 @@ class Type
|
|
1415
1415
|
munge do |aliases|
|
1416
1416
|
aliases = [aliases] unless aliases.is_a?(Array)
|
1417
1417
|
|
1418
|
-
raise(ArgumentError, "Cannot add aliases without a catalog") unless @resource.catalog
|
1418
|
+
raise(ArgumentError, _("Cannot add aliases without a catalog")) unless @resource.catalog
|
1419
1419
|
|
1420
1420
|
aliases.each do |other|
|
1421
1421
|
if obj = @resource.catalog.resource(@resource.class.name, other)
|
@@ -1494,7 +1494,8 @@ class Type
|
|
1494
1494
|
@value.each do |ref|
|
1495
1495
|
unless @resource.catalog.resource(ref.to_s)
|
1496
1496
|
description = self.class.direction == :in ? "dependency" : "dependent"
|
1497
|
-
fail ResourceError, "Could not find
|
1497
|
+
fail ResourceError, _("Could not find %{description} %{ref} for %{resource}") %
|
1498
|
+
{ description: description, ref: ref, resource: resource.ref }
|
1498
1499
|
end
|
1499
1500
|
end
|
1500
1501
|
end
|
@@ -1766,9 +1767,8 @@ end
|
|
1766
1767
|
defaults = defaults.find_all { |provider| provider.specificity == max }
|
1767
1768
|
|
1768
1769
|
if defaults.length > 1
|
1769
|
-
Puppet.warning(
|
1770
|
-
|
1771
|
-
)
|
1770
|
+
Puppet.warning(_("Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}") %
|
1771
|
+
{ name: self.name, provider_list: defaults.collect { |i| i.name.to_s }.join(", "), selected_provider: defaults[0].name })
|
1772
1772
|
end
|
1773
1773
|
|
1774
1774
|
@defaultprovider = defaults.shift unless defaults.empty?
|
@@ -1852,8 +1852,7 @@ end
|
|
1852
1852
|
if provider = self.provider(pname)
|
1853
1853
|
provider
|
1854
1854
|
else
|
1855
|
-
raise Puppet::DevError,
|
1856
|
-
"Could not find parent provider #{pname} of #{name}"
|
1855
|
+
raise Puppet::DevError, _("Could not find parent provider %{parent} of %{name}") % { parent: pname, name: name }
|
1857
1856
|
end
|
1858
1857
|
end
|
1859
1858
|
else
|
@@ -1929,7 +1928,7 @@ end
|
|
1929
1928
|
provider_class = provider_class.class.name if provider_class.is_a?(Puppet::Provider)
|
1930
1929
|
|
1931
1930
|
unless @resource.class.provider(provider_class)
|
1932
|
-
raise ArgumentError, "Invalid
|
1931
|
+
raise ArgumentError, _("Invalid %{resource} provider '%{provider_class}'") % { resource: @resource.class.name, provider_class: provider_class}
|
1933
1932
|
end
|
1934
1933
|
end
|
1935
1934
|
|
@@ -2012,7 +2011,7 @@ end
|
|
2012
2011
|
elsif klass = self.class.provider(name)
|
2013
2012
|
@provider = klass.new(self)
|
2014
2013
|
else
|
2015
|
-
raise ArgumentError, "Could not find
|
2014
|
+
raise ArgumentError, _("Could not find %{name} provider of %{provider}") % { name: name, provider: self.class.name }
|
2016
2015
|
end
|
2017
2016
|
end
|
2018
2017
|
|
@@ -2129,7 +2128,7 @@ end
|
|
2129
2128
|
#
|
2130
2129
|
def autorelation(rel_type, rel_catalog = nil)
|
2131
2130
|
rel_catalog ||= catalog
|
2132
|
-
raise
|
2131
|
+
raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
|
2133
2132
|
|
2134
2133
|
reqs = []
|
2135
2134
|
|
@@ -2440,11 +2439,12 @@ end
|
|
2440
2439
|
if p.is_a?(Puppet::Property)
|
2441
2440
|
p.sensitive = true
|
2442
2441
|
elsif p.is_a?(Puppet::Parameter)
|
2443
|
-
warning("Unable to mark '
|
2442
|
+
warning(_("Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted.") %
|
2443
|
+
{ name: name })
|
2444
2444
|
elsif self.class.attrclass(name)
|
2445
|
-
warning("Unable to mark '
|
2445
|
+
warning(_("Unable to mark '%{name}' as sensitive: the property itself was not assigned a value.") % { name: name })
|
2446
2446
|
else
|
2447
|
-
err("Unable to mark '
|
2447
|
+
err(_("Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}.") % { name: name, type: type })
|
2448
2448
|
end
|
2449
2449
|
end
|
2450
2450
|
end
|
@@ -2495,7 +2495,7 @@ end
|
|
2495
2495
|
rescue ArgumentError, Puppet::Error, TypeError
|
2496
2496
|
raise
|
2497
2497
|
rescue => detail
|
2498
|
-
error = Puppet::DevError.new(
|
2498
|
+
error = Puppet::DevError.new(_("Could not set %{attribute} on %{class_name}: %{detail}") % { attribute: attr, class_name: self.class.name, detail: detail })
|
2499
2499
|
error.set_backtrace(detail.backtrace)
|
2500
2500
|
raise error
|
2501
2501
|
end
|