puppet 5.3.3-x64-mingw32 → 5.3.4-x64-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
@@ -38,6 +38,15 @@ class Puppet::Network::HTTP::Factory
|
|
38
38
|
http.read_timeout = Puppet[:http_read_timeout]
|
39
39
|
http.open_timeout = Puppet[:http_connect_timeout]
|
40
40
|
|
41
|
+
if Puppet[:sourceaddress]
|
42
|
+
if http.respond_to?(:local_host)
|
43
|
+
Puppet.debug("Using source IP #{Puppet[:sourceaddress]}")
|
44
|
+
http.local_host = Puppet[:sourceaddress]
|
45
|
+
else
|
46
|
+
raise ArgumentError, "Setting 'sourceaddress' is unsupported by this version of Net::HTTP."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
41
50
|
if Puppet[:http_debug]
|
42
51
|
http.set_debug_output($stderr)
|
43
52
|
end
|
@@ -23,9 +23,9 @@ class Puppet::Network::HTTP::Rack
|
|
23
23
|
# Send a Status 500 Error on unhandled exceptions.
|
24
24
|
response.status = 500
|
25
25
|
response['Content-Type'] = 'text/plain'
|
26
|
-
response.write _(
|
26
|
+
response.write _("Internal Server Error: \"%{message}\"") % { message: detail.message }
|
27
27
|
# log what happened
|
28
|
-
Puppet.log_exception(detail, _("Puppet Server (Rack): Internal Server Error: Unhandled Exception: \"%
|
28
|
+
Puppet.log_exception(detail, _("Puppet Server (Rack): Internal Server Error: Unhandled Exception: \"%{message}\"") % { message: detail.message })
|
29
29
|
end
|
30
30
|
response.finish
|
31
31
|
end
|
@@ -17,8 +17,6 @@ class Puppet::Network::HTTP::WEBrick
|
|
17
17
|
def listen(address, port)
|
18
18
|
@server = create_server(address, port)
|
19
19
|
|
20
|
-
@server.listeners.each { |l| l.start_immediately = false }
|
21
|
-
|
22
20
|
@server.mount('/', Puppet::Network::HTTP::WEBrickREST)
|
23
21
|
|
24
22
|
raise _("WEBrick server is already listening") if @listening
|
@@ -27,7 +25,7 @@ class Puppet::Network::HTTP::WEBrick
|
|
27
25
|
@server.start do |sock|
|
28
26
|
timeout = 10.0
|
29
27
|
if ! IO.select([sock],nil,nil,timeout)
|
30
|
-
raise _("Client did not send data within
|
28
|
+
raise _("Client did not send data within %{timeout} seconds of connecting") % { timeout: ("%.1f") % timeout }
|
31
29
|
end
|
32
30
|
sock.accept
|
33
31
|
@server.run(sock)
|
@@ -101,7 +99,7 @@ class Puppet::Network::HTTP::WEBrick
|
|
101
99
|
|
102
100
|
results[:SSLPrivateKey] = host.key.content
|
103
101
|
results[:SSLCertificate] = host.certificate.content
|
104
|
-
results[:SSLStartImmediately] =
|
102
|
+
results[:SSLStartImmediately] = false
|
105
103
|
results[:SSLEnable] = true
|
106
104
|
results[:SSLOptions] = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
|
107
105
|
|
data/lib/puppet/node.rb
CHANGED
@@ -27,10 +27,10 @@ class Puppet::Node
|
|
27
27
|
@name = data['name'] || (raise ArgumentError, _("No name provided in serialized data"))
|
28
28
|
@classes = data['classes'] || []
|
29
29
|
@parameters = data['parameters'] || {}
|
30
|
-
env_name = data['environment']
|
30
|
+
env_name = data['environment'] || @parameters[ENVIRONMENT]
|
31
31
|
env_name = env_name.intern unless env_name.nil?
|
32
32
|
@environment_name = env_name
|
33
|
-
environment = env_name
|
33
|
+
self.environment = env_name
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.from_data_hash(data)
|
@@ -45,10 +45,17 @@ class Puppet::Node
|
|
45
45
|
'environment' => environment.name.to_s,
|
46
46
|
}
|
47
47
|
result['classes'] = classes unless classes.empty?
|
48
|
-
|
48
|
+
serialized_params = self.serializable_parameters
|
49
|
+
result['parameters'] = serialized_params unless serialized_params.empty?
|
49
50
|
result
|
50
51
|
end
|
51
52
|
|
53
|
+
def serializable_parameters
|
54
|
+
new_params = parameters.dup
|
55
|
+
new_params.delete(ENVIRONMENT)
|
56
|
+
new_params
|
57
|
+
end
|
58
|
+
|
52
59
|
def environment
|
53
60
|
if @environment
|
54
61
|
@environment
|
@@ -60,7 +67,7 @@ class Puppet::Node
|
|
60
67
|
else
|
61
68
|
# This should not be :current_environment, this is the default
|
62
69
|
# for a node when it has not specified its environment
|
63
|
-
#
|
70
|
+
# it will be used to establish what the current environment is.
|
64
71
|
#
|
65
72
|
self.environment = Puppet.lookup(:environments).get!(Puppet[:environment])
|
66
73
|
end
|
@@ -78,7 +85,8 @@ class Puppet::Node
|
|
78
85
|
|
79
86
|
# Keep environment_name attribute and parameter in sync if they have been set
|
80
87
|
unless @environment.nil?
|
81
|
-
|
88
|
+
# always set the environment parameter. It becomes top scope $environment for a manifest during catalog compilation.
|
89
|
+
@parameters[ENVIRONMENT] = @environment.name.to_s
|
82
90
|
self.environment_name = @environment.name if instance_variable_defined?(:@environment_name)
|
83
91
|
end
|
84
92
|
@environment
|
@@ -132,7 +140,10 @@ class Puppet::Node
|
|
132
140
|
|
133
141
|
if !@facts.nil?
|
134
142
|
@facts.sanitize
|
143
|
+
# facts should never modify the environment parameter
|
144
|
+
orig_param_env = @parameters[ENVIRONMENT]
|
135
145
|
merge(@facts.values)
|
146
|
+
@parameters[ENVIRONMENT] = orig_param_env
|
136
147
|
end
|
137
148
|
end
|
138
149
|
|
@@ -145,8 +156,16 @@ class Puppet::Node
|
|
145
156
|
@parameters[name] = value
|
146
157
|
end
|
147
158
|
end
|
159
|
+
end
|
148
160
|
|
149
|
-
|
161
|
+
# Add extra facts, such as facts given to lookup on the command line The
|
162
|
+
# extra facts will override existing ones.
|
163
|
+
# @param extra_facts [Hash{String=>Object}] the facts to tadd
|
164
|
+
# @api private
|
165
|
+
def add_extra_facts(extra_facts)
|
166
|
+
@facts.add_extra_values(extra_facts)
|
167
|
+
@parameters.merge!(extra_facts)
|
168
|
+
nil
|
150
169
|
end
|
151
170
|
|
152
171
|
def add_server_facts(facts)
|
@@ -433,6 +433,20 @@ class Puppet::Node::Environment
|
|
433
433
|
deps
|
434
434
|
end
|
435
435
|
|
436
|
+
# Loads module translations for the current environment once for
|
437
|
+
# the lifetime of the environment.
|
438
|
+
def use_text_domain
|
439
|
+
return if Puppet[:disable_i18n]
|
440
|
+
|
441
|
+
if @text_domain.nil?
|
442
|
+
@text_domain = @name
|
443
|
+
Puppet::GettextConfig.reset_text_domain(@text_domain)
|
444
|
+
Puppet::ModuleTranslations.load_from_modulepath(modules)
|
445
|
+
else
|
446
|
+
Puppet::GettextConfig.use_text_domain(@text_domain)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
436
450
|
# Checks if a reparse is required (cache of files is stale).
|
437
451
|
#
|
438
452
|
def check_for_reparse
|
data/lib/puppet/node/facts.rb
CHANGED
@@ -59,6 +59,15 @@ class Puppet::Node::Facts
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
# Add extra values, such as facts given to lookup on the command line. The
|
63
|
+
# extra values will override existing values.
|
64
|
+
# @param extra_values [Hash{String=>Object}] the values to add
|
65
|
+
# @api private
|
66
|
+
def add_extra_values(extra_values)
|
67
|
+
@values.merge!(extra_values)
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
|
62
71
|
# Sanitize fact values by converting everything not a string, Boolean
|
63
72
|
# numeric, array or hash into strings.
|
64
73
|
def sanitize
|
data/lib/puppet/parameter.rb
CHANGED
@@ -338,7 +338,7 @@ class Puppet::Parameter
|
|
338
338
|
self.resource = resource
|
339
339
|
options.delete(:resource)
|
340
340
|
else
|
341
|
-
raise Puppet::DevError, "No resource set for
|
341
|
+
raise Puppet::DevError, _("No resource set for %{name}") % { name: self.class.name }
|
342
342
|
end
|
343
343
|
|
344
344
|
set_options(options)
|
@@ -425,7 +425,7 @@ class Puppet::Parameter
|
|
425
425
|
Puppet.debug "Reraising #{detail}"
|
426
426
|
raise
|
427
427
|
rescue => detail
|
428
|
-
raise Puppet::DevError, "Munging failed for value
|
428
|
+
raise Puppet::DevError, _("Munging failed for value %{value} in class %{class_name}: %{detail}") % { value: value.inspect, class_name: self.name, detail: detail }, detail.backtrace
|
429
429
|
end
|
430
430
|
ret
|
431
431
|
end
|
@@ -459,7 +459,7 @@ class Puppet::Parameter
|
|
459
459
|
rescue Puppet::Error, TypeError
|
460
460
|
raise
|
461
461
|
rescue => detail
|
462
|
-
raise Puppet::DevError, "Validate method failed for class
|
462
|
+
raise Puppet::DevError, _("Validate method failed for class %{class_name}: %{detail}") % { class_name: self.name, detail: detail }, detail.backtrace
|
463
463
|
end
|
464
464
|
end
|
465
465
|
|
@@ -19,7 +19,7 @@ class Puppet::Parameter::ValueCollection
|
|
19
19
|
def aliasvalue(name, other)
|
20
20
|
other = other.to_sym
|
21
21
|
unless value = match?(other)
|
22
|
-
raise Puppet::DevError, "Cannot alias nonexistent value
|
22
|
+
raise Puppet::DevError, _("Cannot alias nonexistent value %{value}") % { value: other }
|
23
23
|
end
|
24
24
|
|
25
25
|
value.alias(name)
|
@@ -133,7 +133,10 @@ class Puppet::Parameter::ValueCollection
|
|
133
133
|
call_opt = options[:call]
|
134
134
|
unless call_opt.nil?
|
135
135
|
devfail "Cannot use obsolete :call value '#{call_opt}' for property '#{self.class.name}'" unless call_opt == :none || call_opt == :instead
|
136
|
-
|
136
|
+
#TRANSLATORS ':call' is a property and should not be translated
|
137
|
+
message = _("Property option :call is deprecated and no longer used.")
|
138
|
+
message += ' ' + _("Please remove it.")
|
139
|
+
Puppet.deprecation_warning(message)
|
137
140
|
options = options.reject { |k,v| k == :call }
|
138
141
|
end
|
139
142
|
|
@@ -180,13 +183,10 @@ class Puppet::Parameter::ValueCollection
|
|
180
183
|
def validate(value)
|
181
184
|
return if empty?
|
182
185
|
|
183
|
-
unless @values.detect {
|
184
|
-
str = _("Invalid value %{value}.
|
185
|
-
|
186
|
-
str += _("Valid values
|
187
|
-
|
188
|
-
str += _("Valid values match %{pattern}.") % { pattern: regexes.join(", ") } unless regexes.empty?
|
189
|
-
|
186
|
+
unless @values.detect {|name, v| v.match?(value)}
|
187
|
+
str = _("Invalid value %{value}.") % { value: value.inspect }
|
188
|
+
str += " " + _("Valid values are %{value_list}.") % { value_list: values.join(", ") } unless values.empty?
|
189
|
+
str += " " + _("Valid values match %{pattern}.") % { pattern: regexes.join(", ") } unless regexes.empty?
|
190
190
|
raise ArgumentError, str
|
191
191
|
end
|
192
192
|
end
|
@@ -28,7 +28,7 @@ class Puppet::Parser::AST::HostName < Puppet::Parser::AST::Leaf
|
|
28
28
|
unless @value.is_a?(Regex)
|
29
29
|
@value = @value.to_s.downcase
|
30
30
|
if @value =~ /[^-\w.]/
|
31
|
-
raise Puppet::DevError, "'
|
31
|
+
raise Puppet::DevError, _("'%{value}' is not a valid hostname") % { value: @value }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -2,9 +2,9 @@ class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
|
|
2
2
|
attr_accessor :names, :context
|
3
3
|
|
4
4
|
def initialize(names, context = {})
|
5
|
-
raise ArgumentError, "names should be an array" unless names.is_a? Array
|
5
|
+
raise ArgumentError, _("names should be an array") unless names.is_a? Array
|
6
6
|
if context[:parent]
|
7
|
-
raise Puppet::DevError, "Node inheritance is removed in Puppet 4.0.0. See http://links.puppet.com/puppet-node-inheritance-deprecation"
|
7
|
+
raise Puppet::DevError, _("Node inheritance is removed in Puppet 4.0.0. See http://links.puppet.com/puppet-node-inheritance-deprecation")
|
8
8
|
end
|
9
9
|
|
10
10
|
@names = names
|
@@ -122,7 +122,7 @@ class Puppet::Parser::AST::PopsBridge
|
|
122
122
|
when Puppet::Pops::Model::Application
|
123
123
|
instantiate_ApplicationDefinition(d, modname)
|
124
124
|
else
|
125
|
-
raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '
|
125
|
+
raise Puppet::ParseError, _("Internal Error: Unknown type of definition - got '%{name}'") % { name: d.class }
|
126
126
|
end
|
127
127
|
end.flatten().compact() # flatten since node definition may have returned an array
|
128
128
|
# Compact since functions are not understood by compiler
|
@@ -24,8 +24,8 @@ class Puppet::Parser::Compiler
|
|
24
24
|
if !errors.empty?
|
25
25
|
errors.each { |e| Puppet.err(e) } if errors.size > 1
|
26
26
|
errmsg = [
|
27
|
-
"Compilation has been halted because:
|
28
|
-
"For more information, see https://docs.puppet.com/puppet/latest/reference/environments.html",
|
27
|
+
_("Compilation has been halted because: %{error}") % { error: errors.first },
|
28
|
+
_("For more information, see https://docs.puppet.com/puppet/latest/reference/environments.html"),
|
29
29
|
]
|
30
30
|
raise(Puppet::Error, errmsg.join(' '))
|
31
31
|
end
|
@@ -36,7 +36,7 @@ class Puppet::Parser::Compiler
|
|
36
36
|
Puppet.log_exception(detail)
|
37
37
|
raise
|
38
38
|
rescue => detail
|
39
|
-
message = "
|
39
|
+
message = _("%{message} on node %{node}") % { message: detail, node: node.name }
|
40
40
|
Puppet.log_exception(detail, message)
|
41
41
|
raise Puppet::Error, message, detail.backtrace
|
42
42
|
end
|
@@ -352,7 +352,7 @@ class Puppet::Parser::Compiler
|
|
352
352
|
# evaluated later in the process.
|
353
353
|
#
|
354
354
|
def evaluate_classes(classes, scope, lazy_evaluate = true)
|
355
|
-
raise Puppet::DevError, "No source for scope passed to evaluate_classes" unless scope.source
|
355
|
+
raise Puppet::DevError, _("No source for scope passed to evaluate_classes") unless scope.source
|
356
356
|
class_parameters = nil
|
357
357
|
# if we are a param class, save the classes hash
|
358
358
|
# and transform classes to be the keys
|
@@ -470,7 +470,8 @@ class Puppet::Parser::Compiler
|
|
470
470
|
component = krt.find_hostclass(component_name)
|
471
471
|
end
|
472
472
|
if component.nil?
|
473
|
-
raise Puppet::ParseError, "Capability mapping error:
|
473
|
+
raise Puppet::ParseError, _("Capability mapping error: %{kind} clause references nonexistent %{component_type} %{component_name}") %
|
474
|
+
{ kind: kind, component_type: component_type, component_name: component_name }
|
474
475
|
end
|
475
476
|
|
476
477
|
blueprint = args['blueprint']
|
@@ -152,7 +152,7 @@ module Puppet::Parser::Functions
|
|
152
152
|
ftype = options[:type] || :statement
|
153
153
|
|
154
154
|
unless ftype == :statement or ftype == :rvalue
|
155
|
-
raise Puppet::DevError, "Invalid statement type
|
155
|
+
raise Puppet::DevError, _("Invalid statement type %{type}") % { type: ftype.inspect }
|
156
156
|
end
|
157
157
|
|
158
158
|
# the block must be installed as a method because it may use "return",
|
@@ -21,13 +21,11 @@ Puppet::Parser::Functions::newfunction(:generate, :arity => -2, :type => :rvalue
|
|
21
21
|
end
|
22
22
|
|
23
23
|
unless valid
|
24
|
-
raise Puppet::ParseError,
|
25
|
-
_("Generators can only contain alphanumerics, file separators, and dashes")
|
24
|
+
raise Puppet::ParseError, _("Generators can only contain alphanumerics, file separators, and dashes")
|
26
25
|
end
|
27
26
|
|
28
27
|
if args[0] =~ /\.\./
|
29
|
-
raise Puppet::ParseError,
|
30
|
-
_("Can not use generators with '..' in them.")
|
28
|
+
raise Puppet::ParseError, _("Can not use generators with '..' in them.")
|
31
29
|
end
|
32
30
|
|
33
31
|
begin
|
@@ -14,8 +14,7 @@ Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :arit
|
|
14
14
|
begin
|
15
15
|
wrapper.result(string)
|
16
16
|
rescue => detail
|
17
|
-
raise Puppet::ParseError,
|
18
|
-
_("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
|
17
|
+
raise Puppet::ParseError, _("Failed to parse inline template: %{detail}") % { detail: detail }, detail.backtrace
|
19
18
|
end
|
20
19
|
end.join("")
|
21
20
|
end
|
@@ -29,8 +29,22 @@ Puppet::Parser::Functions::newfunction(
|
|
29
29
|
:arity => -2,
|
30
30
|
:doc => "Perform printf-style formatting of text.
|
31
31
|
|
32
|
-
|
32
|
+
The first parameter is format string describing how the rest of the parameters should be formatted.
|
33
|
+
See the documentation for the `Kernel::sprintf` function in Ruby for all the details."
|
33
34
|
) do |args|
|
34
|
-
fmt = args
|
35
|
-
|
35
|
+
fmt = args[0]
|
36
|
+
args = args[1..-1]
|
37
|
+
begin
|
38
|
+
return sprintf(fmt, *args)
|
39
|
+
rescue KeyError => e
|
40
|
+
if args.size == 1 && args[0].is_a?(Hash)
|
41
|
+
# map the single hash argument such that all top level string keys are symbols
|
42
|
+
# as that allows named arguments to be used in the format string.
|
43
|
+
#
|
44
|
+
result = {}
|
45
|
+
args[0].each_pair { |k,v| result[k.is_a?(String) ? k.to_sym : k] = v }
|
46
|
+
return sprintf(fmt, result)
|
47
|
+
end
|
48
|
+
raise e
|
49
|
+
end
|
36
50
|
end
|
@@ -23,8 +23,12 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :arity => -2
|
|
23
23
|
wrapper.result
|
24
24
|
rescue => detail
|
25
25
|
info = detail.backtrace.first.split(':')
|
26
|
-
|
27
|
-
|
26
|
+
message = []
|
27
|
+
message << _("Failed to parse template %{file}:") % { file: file }
|
28
|
+
message << _(" Filepath: %{file_path}") % { file_path: info[0] }
|
29
|
+
message << _(" Line: %{line}") % { line: info[1] }
|
30
|
+
message << _(" Detail: %{detail}") % { detail: detail }
|
31
|
+
raise Puppet::ParseError, message.join("\n") + "\n"
|
28
32
|
end
|
29
33
|
end.join("")
|
30
34
|
end
|
@@ -169,13 +169,20 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
169
169
|
end
|
170
170
|
|
171
171
|
if evaluated?
|
172
|
+
error_location_str = Puppet::Util::Errors.error_location(file, line)
|
173
|
+
msg = if error_location_str.empty?
|
174
|
+
_('Attempt to override an already evaluated resource with new values')
|
175
|
+
else
|
176
|
+
_('Attempt to override an already evaluated resource, defined at %{error_location}, with new values') % { error_location: error_location_str }
|
177
|
+
end
|
172
178
|
strict = Puppet[:strict]
|
173
179
|
unless strict == :off
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
180
|
+
if strict == :error
|
181
|
+
raise Puppet::ParseError.new(msg, resource.file, resource.line)
|
182
|
+
else
|
183
|
+
msg += Puppet::Util::Errors.error_location_with_space(resource.file, resource.line)
|
184
|
+
Puppet.warning(msg)
|
185
|
+
end
|
179
186
|
end
|
180
187
|
end
|
181
188
|
|
@@ -322,28 +329,6 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
322
329
|
|
323
330
|
private
|
324
331
|
|
325
|
-
# Append location to the message if location is present. If it is not, an empty string
|
326
|
-
# is returned instead.
|
327
|
-
#
|
328
|
-
# @param file [String] path to the file
|
329
|
-
# @param line [Integer] the line in the file
|
330
|
-
# @param prefix [String] string prefix
|
331
|
-
# @param suffix [String] string suffix
|
332
|
-
# @return [String] the formatted location or an empty string
|
333
|
-
def append_location(file, line, prefix = '', suffix = '')
|
334
|
-
if file && file != ''
|
335
|
-
if line
|
336
|
-
_('%{prefix} at %{file}:%{line}%{suffix}') % { prefix: prefix, suffix: suffix, file: file, line: line }
|
337
|
-
else
|
338
|
-
_('%{prefix} in %{file}%{suffix}') % { prefix: prefix, suffix: suffix, file: file }
|
339
|
-
end
|
340
|
-
elsif line
|
341
|
-
_('%{prefix} at line %{line}%{suffix}') % { prefix: prefix, suffix: suffix, line: line }
|
342
|
-
else
|
343
|
-
''
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
332
|
def add_scope_tags
|
348
333
|
scope_resource = scope.resource
|
349
334
|
unless scope_resource.nil? || scope_resource.equal?(self)
|
@@ -371,10 +356,24 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
371
356
|
|
372
357
|
# The parameter is already set. Fail if they're not allowed to override it.
|
373
358
|
unless param.source.child_of?(current.source) || param.source.equal?(current.source) && scope.is_default?(type, param.name, current.value)
|
374
|
-
|
375
|
-
msg
|
376
|
-
|
377
|
-
|
359
|
+
error_location_str = Puppet::Util::Errors.error_location(current.file, current.line)
|
360
|
+
msg = if current.source.to_s == ''
|
361
|
+
if error_location_str.empty?
|
362
|
+
_("Parameter '%{name}' is already set on %{resource}; cannot redefine") %
|
363
|
+
{ name: param.name, resource: ref }
|
364
|
+
else
|
365
|
+
_("Parameter '%{name}' is already set on %{resource} at %{error_location}; cannot redefine") %
|
366
|
+
{ name: param.name, resource: ref, error_location: error_location_str }
|
367
|
+
end
|
368
|
+
else
|
369
|
+
if error_location_str.empty?
|
370
|
+
_("Parameter '%{name}' is already set on %{resource} by %{source}; cannot redefine") %
|
371
|
+
{ name: param.name, resource: ref, source: current.source.to_s }
|
372
|
+
else
|
373
|
+
_("Parameter '%{name}' is already set on %{resource} by %{source} at %{error_location}; cannot redefine") %
|
374
|
+
{ name: param.name, resource: ref, source: current.source.to_s, error_location: error_location_str }
|
375
|
+
end
|
376
|
+
end
|
378
377
|
raise Puppet::ParseError.new(msg, param.file, param.line)
|
379
378
|
end
|
380
379
|
|