puppet 5.3.3 → 5.3.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +3 -0
- data/ext/puppet-test +3 -2
- data/lib/hiera/puppet_function.rb +5 -2
- data/lib/hiera_puppet.rb +3 -3
- data/lib/puppet.rb +2 -5
- data/lib/puppet/agent.rb +22 -2
- data/lib/puppet/agent/locker.rb +6 -5
- data/lib/puppet/application.rb +18 -1
- data/lib/puppet/application/agent.rb +9 -2
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/config.rb +1 -0
- data/lib/puppet/application/device.rb +1 -2
- data/lib/puppet/application/filebucket.rb +22 -5
- data/lib/puppet/application/help.rb +1 -0
- data/lib/puppet/application/lookup.rb +1 -3
- data/lib/puppet/application_support.rb +6 -1
- data/lib/puppet/bindings.rb +2 -1
- data/lib/puppet/configurer.rb +9 -4
- data/lib/puppet/configurer/downloader_factory.rb +10 -0
- data/lib/puppet/configurer/plugin_handler.rb +11 -4
- data/lib/puppet/daemon.rb +2 -2
- data/lib/puppet/defaults.rb +99 -27
- data/lib/puppet/environments.rb +2 -0
- data/lib/puppet/error.rb +5 -15
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/config.rb +14 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +12 -14
- data/lib/puppet/face/man.rb +1 -0
- data/lib/puppet/face/module/build.rb +1 -1
- data/lib/puppet/face/module/list.rb +6 -17
- data/lib/puppet/face/module/uninstall.rb +14 -3
- data/lib/puppet/face/node.rb +1 -0
- data/lib/puppet/face/status.rb +1 -0
- data/lib/puppet/file_serving/base.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +3 -0
- data/lib/puppet/file_serving/configuration/parser.rb +23 -9
- data/lib/puppet/file_serving/mount/locales.rb +35 -0
- data/lib/puppet/forge.rb +2 -1
- data/lib/puppet/forge/errors.rb +24 -22
- data/lib/puppet/functions/binary_file.rb +1 -0
- data/lib/puppet/functions/each.rb +10 -4
- data/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/lib/puppet/functions/lookup.rb +2 -2
- data/lib/puppet/functions/map.rb +12 -2
- data/lib/puppet/functions/slice.rb +2 -3
- data/lib/puppet/functions/unique.rb +1 -1
- data/lib/puppet/functions/yaml_data.rb +1 -1
- data/lib/puppet/gettext/config.rb +144 -41
- data/lib/puppet/gettext/module_translations.rb +42 -0
- data/lib/puppet/graph/relationship_graph.rb +1 -1
- data/lib/puppet/graph/simple_graph.rb +3 -3
- data/lib/puppet/indirector/catalog/compiler.rb +40 -25
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +3 -3
- data/lib/puppet/indirector/facts/network_device.rb +2 -2
- data/lib/puppet/indirector/file_bucket_file/file.rb +4 -1
- data/lib/puppet/indirector/indirection.rb +17 -9
- data/lib/puppet/indirector/ldap.rb +2 -2
- data/lib/puppet/indirector/node/write_only_yaml.rb +3 -1
- data/lib/puppet/indirector/rest.rb +8 -5
- data/lib/puppet/indirector/ssl_file.rb +2 -2
- data/lib/puppet/indirector/terminus.rb +3 -3
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +41 -24
- data/lib/puppet/interface/action_builder.rb +14 -5
- data/lib/puppet/interface/action_manager.rb +1 -1
- data/lib/puppet/interface/documentation.rb +21 -10
- data/lib/puppet/interface/face_collection.rb +4 -2
- data/lib/puppet/interface/option.rb +36 -15
- data/lib/puppet/interface/option_builder.rb +23 -9
- data/lib/puppet/interface/option_manager.rb +8 -3
- data/lib/puppet/metatype/manager.rb +7 -3
- data/lib/puppet/module.rb +18 -21
- data/lib/puppet/module_tool/errors/installer.rb +18 -20
- data/lib/puppet/module_tool/errors/shared.rb +20 -15
- data/lib/puppet/module_tool/errors/uninstaller.rb +1 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/tar/mini.rb +57 -4
- data/lib/puppet/network/auth_config_parser.rb +18 -13
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/client_request.rb +1 -1
- data/lib/puppet/network/format.rb +3 -3
- data/lib/puppet/network/http/api/indirection_type.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +5 -2
- data/lib/puppet/network/http/error.rb +7 -7
- data/lib/puppet/network/http/factory.rb +9 -0
- data/lib/puppet/network/http/rack.rb +2 -2
- data/lib/puppet/network/http/webrick.rb +2 -4
- data/lib/puppet/node.rb +25 -6
- data/lib/puppet/node/environment.rb +14 -0
- data/lib/puppet/node/facts.rb +9 -0
- data/lib/puppet/parameter.rb +3 -3
- data/lib/puppet/parameter/value_collection.rb +9 -9
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/ast/node.rb +2 -2
- data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
- data/lib/puppet/parser/compiler.rb +6 -5
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +2 -4
- data/lib/puppet/parser/functions/inline_template.rb +1 -2
- data/lib/puppet/parser/functions/sprintf.rb +17 -3
- data/lib/puppet/parser/functions/template.rb +6 -2
- data/lib/puppet/parser/resource.rb +30 -31
- data/lib/puppet/parser/scope.rb +20 -11
- data/lib/puppet/parser/templatewrapper.rb +4 -3
- data/lib/puppet/pops/evaluator/collector_transformer.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +21 -8
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +2 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/functions/dispatch.rb +1 -1
- data/lib/puppet/pops/functions/function.rb +8 -2
- data/lib/puppet/pops/issue_reporter.rb +7 -2
- data/lib/puppet/pops/issues.rb +10 -4
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/loader/module_loaders.rb +5 -2
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/loaders.rb +7 -3
- data/lib/puppet/pops/lookup/explainer.rb +2 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
- data/lib/puppet/pops/lookup/lookup_adapter.rb +4 -4
- data/lib/puppet/pops/merge_strategy.rb +6 -3
- data/lib/puppet/pops/migration/migration_checker.rb +8 -8
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/lib/puppet/pops/serialization/abstract_writer.rb +2 -1
- data/lib/puppet/pops/types/iterable.rb +2 -0
- data/lib/puppet/pops/types/p_object_type.rb +36 -15
- data/lib/puppet/pops/types/type_calculator.rb +2 -1
- data/lib/puppet/pops/types/type_factory.rb +3 -1
- data/lib/puppet/pops/types/type_mismatch_describer.rb +19 -6
- data/lib/puppet/pops/types/type_parser.rb +7 -7
- data/lib/puppet/pops/types/types.rb +10 -4
- data/lib/puppet/pops/validation.rb +14 -12
- data/lib/puppet/property.rb +14 -6
- data/lib/puppet/property/ensure.rb +2 -2
- data/lib/puppet/provider.rb +4 -4
- data/lib/puppet/provider/group/aix.rb +4 -2
- data/lib/puppet/provider/ldap.rb +2 -2
- data/lib/puppet/provider/naginator.rb +1 -1
- data/lib/puppet/provider/nameservice.rb +7 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +4 -3
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +7 -8
- data/lib/puppet/provider/package/opkg.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +9 -6
- data/lib/puppet/provider/package/pkgutil.rb +3 -3
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/parsedfile.rb +4 -4
- data/lib/puppet/provider/selmodule/semodule.rb +5 -3
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/init.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +1 -0
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +13 -6
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -1
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +4 -2
- data/lib/puppet/relationship.rb +2 -1
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/resource.rb +7 -5
- data/lib/puppet/resource/capability_finder.rb +14 -11
- data/lib/puppet/resource/catalog.rb +33 -18
- data/lib/puppet/resource/type.rb +5 -5
- data/lib/puppet/settings.rb +19 -13
- data/lib/puppet/settings/base_setting.rb +23 -8
- data/lib/puppet/settings/config_file.rb +14 -4
- data/lib/puppet/settings/environment_conf.rb +19 -9
- data/lib/puppet/ssl/base.rb +9 -4
- data/lib/puppet/ssl/oids.rb +8 -2
- data/lib/puppet/syntax_checkers/base64.rb +5 -6
- data/lib/puppet/transaction.rb +7 -3
- data/lib/puppet/transaction/persistence.rb +16 -1
- data/lib/puppet/transaction/report.rb +6 -0
- data/lib/puppet/type.rb +27 -35
- data/lib/puppet/type/file.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/group.rb +1 -1
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/schedule.rb +26 -14
- data/lib/puppet/type/user.rb +9 -3
- data/lib/puppet/type/zone.rb +1 -1
- data/lib/puppet/util.rb +27 -21
- data/lib/puppet/util/at_fork/solaris.rb +6 -4
- data/lib/puppet/util/command_line.rb +5 -0
- data/lib/puppet/util/command_line/trollop.rb +6 -5
- data/lib/puppet/util/errors.rb +61 -8
- data/lib/puppet/util/fileparsing.rb +3 -5
- data/lib/puppet/util/http_proxy.rb +14 -6
- data/lib/puppet/util/instance_loader.rb +1 -3
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +19 -24
- data/lib/puppet/util/logging.rb +21 -28
- data/lib/puppet/util/methodhelper.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +21 -13
- data/lib/puppet/util/plist.rb +3 -1
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/lib/puppet/util/reference.rb +2 -3
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/storage.rb +2 -2
- data/lib/puppet/util/windows/eventlog.rb +10 -5
- data/lib/puppet/util/windows/file.rb +61 -9
- data/lib/puppet/util/windows/process.rb +1 -1
- data/lib/puppet/util/windows/taskscheduler.rb +2 -2
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +5 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/en/puppet.po +19 -0
- data/locales/ja/puppet.po +2739 -809
- data/locales/puppet.pot +2367 -734
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
- data/spec/integration/agent/logging_spec.rb +2 -0
- data/spec/integration/faces/plugin_spec.rb +1 -0
- data/spec/integration/network/authconfig_spec.rb +2 -2
- data/spec/integration/parser/collection_spec.rb +2 -2
- data/spec/integration/parser/scope_spec.rb +16 -3
- data/spec/integration/provider/cron/crontab_spec.rb +1 -0
- data/spec/integration/transaction/report_spec.rb +5 -0
- data/spec/lib/matchers/json.rb +14 -13
- data/spec/unit/agent_spec.rb +33 -0
- data/spec/unit/application/config_spec.rb +4 -0
- data/spec/unit/application/lookup_spec.rb +30 -0
- data/spec/unit/application_spec.rb +18 -0
- data/spec/unit/configurer/downloader_factory_spec.rb +33 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +71 -16
- data/spec/unit/environments_spec.rb +15 -0
- data/spec/unit/face/config_spec.rb +8 -9
- data/spec/unit/face/epp_face_spec.rb +2 -2
- data/spec/unit/face/plugin_spec.rb +50 -4
- data/spec/unit/file_serving/configuration/parser_spec.rb +2 -2
- data/spec/unit/file_serving/mount/locales_spec.rb +73 -0
- data/spec/unit/functions/break_spec.rb +108 -50
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/hiera_spec.rb +0 -1
- data/spec/unit/functions/lookup_spec.rb +85 -19
- data/spec/unit/functions/next_spec.rb +1 -1
- data/spec/unit/functions/return_spec.rb +2 -2
- data/spec/unit/gettext/config_spec.rb +125 -0
- data/spec/unit/gettext/module_loading_spec.rb +53 -0
- data/spec/unit/indirector/json_spec.rb +0 -11
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +1 -1
- data/spec/unit/interface_spec.rb +12 -0
- data/spec/unit/module_spec.rb +0 -28
- data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
- data/spec/unit/network/http/factory_spec.rb +22 -0
- data/spec/unit/network/http/webrick_spec.rb +30 -29
- data/spec/unit/node/environment_spec.rb +16 -0
- data/spec/unit/node_spec.rb +102 -16
- data/spec/unit/parser/environment_compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
- data/spec/unit/parser/resource/param_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +9 -9
- data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_containers_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
- data/spec/unit/provider/selmodule_spec.rb +6 -0
- data/spec/unit/provider/service/init_spec.rb +1 -1
- data/spec/unit/provider/service/smf_spec.rb +2 -0
- data/spec/unit/provider/service/systemd_spec.rb +14 -0
- data/spec/unit/resource/catalog_spec.rb +12 -2
- data/spec/unit/settings/config_file_spec.rb +1 -1
- data/spec/unit/transaction/persistence_spec.rb +42 -0
- data/spec/unit/transaction/report_spec.rb +19 -4
- data/spec/unit/transaction_spec.rb +27 -0
- data/spec/unit/type/schedule_spec.rb +14 -0
- data/spec/unit/type_spec.rb +3 -3
- data/spec/unit/util/errors_spec.rb +1 -1
- data/spec/unit/util/http_proxy_spec.rb +37 -0
- data/spec/unit/util/log_spec.rb +3 -3
- data/spec/unit/util/logging_spec.rb +7 -7
- data/spec/unit/util/monkey_patches_spec.rb +6 -2
- metadata +3433 -3416
- checksums.yaml +0 -7
- data/spec/unit/gettext_config_spec.rb +0 -57
data/CONTRIBUTING.md
CHANGED
@@ -76,7 +76,7 @@ for the translators.
|
|
76
76
|
|
77
77
|
When adding user-facing strings to your work, follow these guidelines:
|
78
78
|
* Use full sentences. Strings built up out of concatenated bits are hard to translate.
|
79
|
-
* Use string formatting instead of interpolation.
|
79
|
+
* Use string formatting instead of interpolation. Use the hash format and give good names to the placeholder values that can be used by translators to understand the meaning of the formatted values.
|
80
80
|
Ex. `_('Creating new user %{name}.') % { name: user.name }`
|
81
81
|
* Use `n_()` for pluralization. (see gettext gem docs linked above for details)
|
82
82
|
|
data/Gemfile
CHANGED
@@ -56,6 +56,7 @@ group(:development, :test) do
|
|
56
56
|
if RUBY_VERSION >= '2.0'
|
57
57
|
# pin rubocop as 0.50 requires a higher version of the rainbow gem (see below)
|
58
58
|
gem 'rubocop', '~> 0.49.1', :platforms => [:ruby]
|
59
|
+
gem 'rubocop-i18n', '~> 1.2.0', :platforms => [:ruby]
|
59
60
|
end
|
60
61
|
|
61
62
|
# pin rainbow gem as 2.2.1 requires rubygems 2.6.9+ and (donotwant)
|
@@ -76,6 +77,8 @@ group(:development) do
|
|
76
77
|
if RUBY_PLATFORM != 'java'
|
77
78
|
gem 'ruby-prof', '>= 0.16.0', :require => false
|
78
79
|
end
|
80
|
+
|
81
|
+
gem 'gettext-setup', '~> 0.28', :require => false
|
79
82
|
end
|
80
83
|
|
81
84
|
group(:extra) do
|
data/ext/puppet-test
CHANGED
@@ -195,10 +195,11 @@ class Suite
|
|
195
195
|
|
196
196
|
$options[:repeat].times do |i|
|
197
197
|
@count = i
|
198
|
+
escaped_doc = doc.gsub(/%/, '%%')
|
198
199
|
if forked?
|
199
|
-
msg =
|
200
|
+
msg = escaped_doc + " in PID %{process_id} in %%{seconds} seconds" % { process_id: Process.pid }
|
200
201
|
else
|
201
|
-
msg =
|
202
|
+
msg = escaped_doc + " in %{seconds} seconds"
|
202
203
|
end
|
203
204
|
Puppet::Util.benchmark(:notice, msg) do
|
204
205
|
begin
|
@@ -60,8 +60,11 @@ class Hiera::PuppetFunction < Puppet::Functions::InternalFunction
|
|
60
60
|
|
61
61
|
def lookup(scope, key, default, has_default, override, &default_block)
|
62
62
|
unless Puppet[:strict] == :off
|
63
|
-
|
64
|
-
|
63
|
+
#TRANSLATORS 'lookup' is a puppet function and should not be translated
|
64
|
+
message = _("The function '%{class_name}' is deprecated in favor of using 'lookup'.") % { class_name: self.class.name }
|
65
|
+
message += ' '+ _("See https://docs.puppet.com/puppet/%{minor_version}/reference/deprecated_language.html") %
|
66
|
+
{ minor_version: Puppet.minor_version }
|
67
|
+
Puppet.warn_once('deprecations', self.class.name, message)
|
65
68
|
end
|
66
69
|
lookup_invocation = Puppet::Pops::Lookup::Invocation.new(scope, {}, {})
|
67
70
|
adapter = lookup_invocation.lookup_adapter
|
data/lib/hiera_puppet.rb
CHANGED
@@ -11,7 +11,7 @@ module HieraPuppet
|
|
11
11
|
answer = hiera.lookup(key, default, scope, override, resolution_type)
|
12
12
|
|
13
13
|
if answer.nil?
|
14
|
-
raise
|
14
|
+
raise Puppet::ParseError, _("Could not find data item %{key} in any Hiera data file and no default supplied") % { key: key }
|
15
15
|
end
|
16
16
|
|
17
17
|
answer
|
@@ -38,7 +38,7 @@ module HieraPuppet
|
|
38
38
|
end
|
39
39
|
|
40
40
|
if args.empty?
|
41
|
-
raise
|
41
|
+
raise Puppet::ParseError, _("Please supply a parameter to perform a Hiera lookup")
|
42
42
|
end
|
43
43
|
|
44
44
|
key = args[0]
|
@@ -71,7 +71,7 @@ module HieraPuppet
|
|
71
71
|
if Puppet::FileSystem.exist?(hiera_config)
|
72
72
|
hiera_config
|
73
73
|
else
|
74
|
-
Puppet.warning "Config file
|
74
|
+
Puppet.warning _("Config file %{hiera_config} not found, using Hiera defaults") % { hiera_config: hiera_config }
|
75
75
|
nil
|
76
76
|
end
|
77
77
|
end
|
data/lib/puppet.rb
CHANGED
@@ -42,11 +42,8 @@ module Puppet
|
|
42
42
|
require 'puppet/environments'
|
43
43
|
|
44
44
|
class << self
|
45
|
-
Puppet::GettextConfig.
|
46
|
-
|
47
|
-
if Puppet::GettextConfig.load_translations('puppet', locale_dir, Puppet::GettextConfig.translation_mode(locale_dir))
|
48
|
-
Puppet::GettextConfig.set_locale(Locale.current.language)
|
49
|
-
end
|
45
|
+
Puppet::GettextConfig.setup_locale
|
46
|
+
Puppet::GettextConfig.create_default_text_domain
|
50
47
|
|
51
48
|
include Puppet::Util
|
52
49
|
attr_reader :features
|
data/lib/puppet/agent.rb
CHANGED
@@ -2,6 +2,8 @@ require 'puppet/application'
|
|
2
2
|
require 'puppet/error'
|
3
3
|
require 'puppet/util/at_fork'
|
4
4
|
|
5
|
+
require 'timeout'
|
6
|
+
|
5
7
|
# A general class for triggering a run of another
|
6
8
|
# class.
|
7
9
|
class Puppet::Agent
|
@@ -14,6 +16,10 @@ class Puppet::Agent
|
|
14
16
|
require 'puppet/util/splayer'
|
15
17
|
include Puppet::Util::Splayer
|
16
18
|
|
19
|
+
# Special exception class used to signal an agent run has timed out.
|
20
|
+
class RunTimeoutError < Exception
|
21
|
+
end
|
22
|
+
|
17
23
|
attr_reader :client_class, :client, :should_fork
|
18
24
|
|
19
25
|
def initialize(client_class, should_fork=true)
|
@@ -41,12 +47,26 @@ class Puppet::Agent
|
|
41
47
|
splay client_options.fetch :splay, Puppet[:splay]
|
42
48
|
result = run_in_fork(should_fork) do
|
43
49
|
with_client(client_options[:transaction_uuid], client_options[:job_id]) do |client|
|
50
|
+
client_args = client_options.merge(:pluginsync => Puppet::Configurer.should_pluginsync?)
|
44
51
|
begin
|
45
|
-
|
46
|
-
|
52
|
+
lock do
|
53
|
+
# NOTE: Timeout is pretty heinous as the location in which it
|
54
|
+
# throws an error is entirely unpredictable, which means that
|
55
|
+
# it can interrupt code blocks that perform cleanup or enforce
|
56
|
+
# sanity. The only thing a Puppet agent should do after this
|
57
|
+
# error is thrown is die with as much dignity as possible.
|
58
|
+
Timeout.timeout(Puppet[:runtimeout], RunTimeoutError) do
|
59
|
+
client.run(client_args)
|
60
|
+
end
|
61
|
+
end
|
47
62
|
rescue Puppet::LockError
|
48
63
|
Puppet.notice _("Run of %{client_class} already in progress; skipping (%{lockfile_path} exists)") % { client_class: client_class, lockfile_path: lockfile_path }
|
49
64
|
return
|
65
|
+
rescue RunTimeoutError => detail
|
66
|
+
Puppet.log_exception(detail, _("Execution of %{client_class} did not complete within %{runtimeout} seconds and was terminated.") %
|
67
|
+
{client_class: client_class,
|
68
|
+
runtimeout: Puppet[:runtimeout]})
|
69
|
+
return 1
|
50
70
|
rescue StandardError => detail
|
51
71
|
Puppet.log_exception(detail, _("Could not run %{client_class}: %{detail}") % { client_class: client_class, detail: detail })
|
52
72
|
1
|
data/lib/puppet/agent/locker.rb
CHANGED
@@ -29,11 +29,12 @@ module Puppet::Agent::Locker
|
|
29
29
|
|
30
30
|
# @deprecated
|
31
31
|
def running?
|
32
|
-
Puppet.
|
33
|
-
Puppet::Agent::Locker.running? is deprecated as it is inherently unsafe.
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
#TRANSLATORS 'Puppet::Agent::Locker.running?' is a method name and should not be translated
|
33
|
+
message = _('Puppet::Agent::Locker.running? is deprecated as it is inherently unsafe.')
|
34
|
+
#TRANSLATORS 'LockError' should not be translated
|
35
|
+
message += ' ' + _('The only safe way to know if the lock is locked is to try lock and perform some '\
|
36
|
+
'action and then handle the LockError that may result.')
|
37
|
+
Puppet.deprecation_warning(message)
|
37
38
|
lockfile.locked?
|
38
39
|
end
|
39
40
|
|
data/lib/puppet/application.rb
CHANGED
@@ -281,6 +281,23 @@ class Application
|
|
281
281
|
@run_mode = Puppet::Util::RunMode[ mode_name || Puppet.settings.preferred_run_mode ]
|
282
282
|
end
|
283
283
|
|
284
|
+
# Sets environment_mode name
|
285
|
+
# @param mode_name [Symbol] The name of the environment mode to run in. May
|
286
|
+
# be one of :local, :remote, or :not_required. This impacts where the
|
287
|
+
# application looks for its specified environment. If :not_required or
|
288
|
+
# :remote are set, the application will not fail if the environment does
|
289
|
+
# not exist on the local filesystem.
|
290
|
+
def environment_mode(mode_name)
|
291
|
+
raise Puppet::Error, _("Invalid environment mode '%{mode_name}'") % { mode_name: mode_name } unless [:local, :remote, :not_required].include?(mode_name)
|
292
|
+
@environment_mode = mode_name
|
293
|
+
end
|
294
|
+
|
295
|
+
# Gets environment_mode name. If none is set with `environment_mode=`,
|
296
|
+
# default to :local.
|
297
|
+
def get_environment_mode
|
298
|
+
@environment_mode || :local
|
299
|
+
end
|
300
|
+
|
284
301
|
# This is for testing only
|
285
302
|
def clear_everything_for_tests
|
286
303
|
@run_mode = @banner = @run_status = @option_parser_commands = nil
|
@@ -343,7 +360,7 @@ class Application
|
|
343
360
|
initialize_app_defaults
|
344
361
|
end
|
345
362
|
|
346
|
-
Puppet::ApplicationSupport.push_application_context(self.class.run_mode)
|
363
|
+
Puppet::ApplicationSupport.push_application_context(self.class.run_mode, self.class.get_environment_mode)
|
347
364
|
|
348
365
|
exit_on_fail(_("Could not initialize")) { preinit }
|
349
366
|
exit_on_fail(_("Could not parse application options")) { parse_options }
|
@@ -38,6 +38,7 @@ class Puppet::Application::Agent < Puppet::Application
|
|
38
38
|
:digest => 'SHA256',
|
39
39
|
:graph => true,
|
40
40
|
:fingerprint => false,
|
41
|
+
:sourceaddress => nil,
|
41
42
|
}.each do |opt,val|
|
42
43
|
options[opt] = val
|
43
44
|
end
|
@@ -59,6 +60,8 @@ class Puppet::Application::Agent < Puppet::Application
|
|
59
60
|
option("--fingerprint")
|
60
61
|
option("--digest DIGEST")
|
61
62
|
|
63
|
+
option("--sourceaddress IP_ADDRESS")
|
64
|
+
|
62
65
|
option("--detailed-exitcodes") do |arg|
|
63
66
|
options[:detailed_exitcodes] = true
|
64
67
|
end
|
@@ -98,8 +101,8 @@ USAGE
|
|
98
101
|
-----
|
99
102
|
puppet agent [--certname <NAME>] [-D|--daemonize|--no-daemonize]
|
100
103
|
[-d|--debug] [--detailed-exitcodes] [--digest <DIGEST>] [--disable [MESSAGE]] [--enable]
|
101
|
-
[--fingerprint] [-h|--help] [-l|--logdest syslog|eventlog|<
|
102
|
-
[--masterport <PORT>] [--noop] [-o|--onetime] [-t|--test]
|
104
|
+
[--fingerprint] [-h|--help] [-l|--logdest syslog|eventlog|<ABS FILEPATH>|console]
|
105
|
+
[--masterport <PORT>] [--noop] [-o|--onetime] [--sourceaddress <IP_ADDRESS>] [-t|--test]
|
103
106
|
[-v|--verbose] [-V|--version] [-w|--waitforcert <SECONDS>]
|
104
107
|
|
105
108
|
|
@@ -273,6 +276,10 @@ generated by running puppet agent with '--genconfig'.
|
|
273
276
|
(This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
|
274
277
|
prefix for boolean settings on the command line.)
|
275
278
|
|
279
|
+
* --sourceaddress:
|
280
|
+
Set the source IP address for transactions. This defaults to automatically selected.
|
281
|
+
(This is a Puppet setting, and can go in puppet.conf.)
|
282
|
+
|
276
283
|
* --test:
|
277
284
|
Enable the most common options used for testing. These are 'onetime',
|
278
285
|
'verbose', 'no-daemonize', 'no-usecacheonfailure', 'detailed-exitcodes',
|
@@ -50,7 +50,7 @@ USAGE
|
|
50
50
|
-----
|
51
51
|
puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
|
52
52
|
[-e|--execute] [--detailed-exitcodes] [-L|--loadclasses]
|
53
|
-
[-l|--logdest syslog|eventlog|<
|
53
|
+
[-l|--logdest syslog|eventlog|<ABS FILEPATH>|console] [--noop]
|
54
54
|
[--catalog <catalog>] [--write-catalog-summary] <file>
|
55
55
|
|
56
56
|
|
@@ -155,8 +155,7 @@ you can specify '--server <servername>' as an argument.
|
|
155
155
|
device run against only that device/certificate.
|
156
156
|
|
157
157
|
* --user:
|
158
|
-
The user to run as.
|
159
|
-
for runs that create device certificates or keys.
|
158
|
+
The user to run as.
|
160
159
|
|
161
160
|
* --verbose:
|
162
161
|
Turn on verbose reporting.
|
@@ -111,38 +111,55 @@ configuration options can also be generated by running puppet with
|
|
111
111
|
* --version:
|
112
112
|
Print version information.
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
EXAMPLES
|
115
|
+
--------
|
116
|
+
## Backup a file to the filebucket, then restore it to a temporary directory
|
117
117
|
$ puppet filebucket backup /etc/passwd
|
118
118
|
/etc/passwd: 429b225650b912a2ee067b0a4cf1e949
|
119
119
|
$ puppet filebucket restore /tmp/passwd 429b225650b912a2ee067b0a4cf1e949
|
120
|
+
|
120
121
|
## Diff between two files in the filebucket
|
121
122
|
$ puppet filebucket -l diff d43a6ecaa892a1962398ac9170ea9bf2 7ae322f5791217e031dc60188f4521ef
|
122
123
|
1a2
|
123
124
|
> again
|
124
|
-
|
125
|
+
|
126
|
+
## Diff between the file in the filebucket and a local file
|
125
127
|
$ puppet filebucket -l diff d43a6ecaa892a1962398ac9170ea9bf2 /tmp/testFile
|
126
128
|
1a2
|
127
129
|
> again
|
130
|
+
|
131
|
+
## Backup a file to the filebucket and observe that it keeps each backup separate
|
128
132
|
$ puppet filebucket -l list
|
129
133
|
d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
|
134
|
+
|
130
135
|
$ echo again >> /tmp/TestFile
|
136
|
+
|
131
137
|
$ puppet filebucket -l backup /tmp/TestFile
|
132
138
|
/tmp/TestFile: 7ae322f5791217e031dc60188f4521ef
|
133
|
-
|
139
|
+
|
140
|
+
$ puppet filebucket -l list
|
134
141
|
d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
|
135
142
|
7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
|
143
|
+
|
144
|
+
## List files in a filebucket within date ranges
|
136
145
|
$ puppet filebucket -l -f 2015-01-01 -t 2015-01-11 list
|
137
146
|
<Empty Output>
|
147
|
+
|
138
148
|
$ puppet filebucket -l -f 2015-05-10 list
|
139
149
|
d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
|
140
150
|
7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
|
151
|
+
|
141
152
|
$ puppet filebucket -l -f "2015-05-11 09:30:00" list
|
142
153
|
7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
|
154
|
+
|
143
155
|
$ puppet filebucket -l -t "2015-05-11 09:30:00" list
|
144
156
|
d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
|
145
157
|
|
158
|
+
## From a Puppet master, list files in the master bucketdir
|
159
|
+
$ puppet filebucket -b $(puppet config print bucketdir --section master) list
|
160
|
+
d43a6ecaa892a1962398ac9170ea9bf2 2015-05-11 09:27:56 /tmp/TestFile
|
161
|
+
7ae322f5791217e031dc60188f4521ef 2015-05-11 09:52:15 /tmp/TestFile
|
162
|
+
|
146
163
|
AUTHOR
|
147
164
|
------
|
148
165
|
Luke Kanies
|
@@ -340,7 +340,6 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
340
340
|
fact_file = options[:fact_file]
|
341
341
|
|
342
342
|
if fact_file
|
343
|
-
original_facts = node.parameters
|
344
343
|
if fact_file.end_with?("json")
|
345
344
|
given_facts = JSON.parse(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
|
346
345
|
else
|
@@ -350,8 +349,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
350
349
|
unless given_facts.instance_of?(Hash)
|
351
350
|
raise _("Incorrect formatted data in %{fact_file} given via the --facts flag") % { fact_file: fact_file }
|
352
351
|
end
|
353
|
-
|
354
|
-
node.parameters = original_facts.merge(given_facts)
|
352
|
+
node.add_extra_facts(given_facts)
|
355
353
|
end
|
356
354
|
|
357
355
|
Puppet[:code] = 'undef' unless options[:compile]
|
@@ -14,9 +14,11 @@ module Puppet
|
|
14
14
|
# before being set in a pushed Puppet Context.
|
15
15
|
#
|
16
16
|
# @param run_mode [Puppet::Util::RunMode] Puppet's current Run Mode.
|
17
|
+
# @param environment_mode [Symbol] optional, Puppet's
|
18
|
+
# current Environment Mode. Defaults to :local
|
17
19
|
# @return [void]
|
18
20
|
# @api private
|
19
|
-
def self.push_application_context(run_mode)
|
21
|
+
def self.push_application_context(run_mode, environment_mode = :local)
|
20
22
|
Puppet.push_context(Puppet.base_context(Puppet.settings), "Update for application settings (#{run_mode})")
|
21
23
|
# This use of configured environment is correct, this is used to establish
|
22
24
|
# the defaults for an application that does not override, or where an override
|
@@ -25,6 +27,9 @@ module Puppet
|
|
25
27
|
configured_environment_name = Puppet[:environment]
|
26
28
|
if run_mode.name == :agent
|
27
29
|
configured_environment = Puppet::Node::Environment.remote(configured_environment_name)
|
30
|
+
elsif environment_mode == :not_required
|
31
|
+
configured_environment =
|
32
|
+
Puppet.lookup(:environments).get(configured_environment_name) || Puppet::Node::Environment.remote(configured_environment_name)
|
28
33
|
else
|
29
34
|
configured_environment = Puppet.lookup(:environments).get!(configured_environment_name)
|
30
35
|
end
|
data/lib/puppet/bindings.rb
CHANGED
@@ -134,7 +134,8 @@ class Puppet::Bindings
|
|
134
134
|
|
135
135
|
def []=(name, value)
|
136
136
|
unless value.is_a?(Puppet::Pops::Binder::Bindings::NamedBindings) || value.is_a?(Proc)
|
137
|
-
|
137
|
+
#TRANSLATORS 'NameBindings' is a class name and should not be translated, 'Proc' refers to a Ruby proc.
|
138
|
+
raise ArgumentError, _("Given value must be a NamedBindings, or a Proc producing one, got: %{class_name}.") % { class_name: value.class }
|
138
139
|
end
|
139
140
|
@named_bindings[name] = value
|
140
141
|
end
|
data/lib/puppet/configurer.rb
CHANGED
@@ -116,6 +116,9 @@ class Puppet::Configurer
|
|
116
116
|
if options[:pluginsync]
|
117
117
|
remote_environment_for_plugins = Puppet::Node::Environment.remote(@environment)
|
118
118
|
download_plugins(remote_environment_for_plugins)
|
119
|
+
|
120
|
+
Puppet::GettextConfig.reset_text_domain('agent')
|
121
|
+
Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
|
119
122
|
end
|
120
123
|
|
121
124
|
facts_hash = {}
|
@@ -168,7 +171,7 @@ class Puppet::Configurer
|
|
168
171
|
begin
|
169
172
|
report.configuration_version = catalog.version
|
170
173
|
|
171
|
-
benchmark(:notice, _("Applied catalog")) do
|
174
|
+
benchmark(:notice, _("Applied catalog in %{seconds} seconds")) do
|
172
175
|
catalog.apply(options)
|
173
176
|
end
|
174
177
|
ensure
|
@@ -233,6 +236,9 @@ class Puppet::Configurer
|
|
233
236
|
# If a cached catalog is explicitly requested, attempt to retrieve it. Skip the node request,
|
234
237
|
# don't pluginsync and switch to the catalog's environment if we successfully retrieve it.
|
235
238
|
if Puppet[:use_cached_catalog]
|
239
|
+
Puppet::GettextConfig.reset_text_domain('agent')
|
240
|
+
Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
|
241
|
+
|
236
242
|
if catalog = prepare_and_retrieve_catalog_from_cache
|
237
243
|
options[:catalog] = catalog
|
238
244
|
@cached_catalog_status = 'explicitly_requested'
|
@@ -293,11 +299,10 @@ class Puppet::Configurer
|
|
293
299
|
end
|
294
300
|
|
295
301
|
current_environment = Puppet.lookup(:current_environment)
|
296
|
-
local_node_environment =
|
297
302
|
if current_environment.name == @environment.intern
|
298
|
-
current_environment
|
303
|
+
local_node_environment = current_environment
|
299
304
|
else
|
300
|
-
Puppet::Node::Environment.create(@environment,
|
305
|
+
local_node_environment = Puppet::Node::Environment.create(@environment,
|
301
306
|
current_environment.modulepath,
|
302
307
|
current_environment.manifest,
|
303
308
|
current_environment.config_version)
|
@@ -31,4 +31,14 @@ class Puppet::Configurer::DownloaderFactory
|
|
31
31
|
source_permissions
|
32
32
|
)
|
33
33
|
end
|
34
|
+
|
35
|
+
def create_locales_downloader(environment)
|
36
|
+
locales_downloader = Puppet::Configurer::Downloader.new(
|
37
|
+
"locales",
|
38
|
+
Puppet[:localedest],
|
39
|
+
Puppet[:localesource],
|
40
|
+
Puppet[:pluginsignore] + " config.yaml",
|
41
|
+
environment
|
42
|
+
)
|
43
|
+
end
|
34
44
|
end
|
@@ -3,7 +3,10 @@
|
|
3
3
|
# easier to test.
|
4
4
|
require 'puppet/configurer'
|
5
5
|
|
6
|
+
|
6
7
|
class Puppet::Configurer::PluginHandler
|
8
|
+
SUPPORTED_LOCALES_MOUNT_AGENT_VERSION = Gem::Version.new("5.3.4")
|
9
|
+
|
7
10
|
def initialize(factory)
|
8
11
|
@factory = factory
|
9
12
|
end
|
@@ -11,13 +14,17 @@ class Puppet::Configurer::PluginHandler
|
|
11
14
|
# Retrieve facts from the central server.
|
12
15
|
def download_plugins(environment)
|
13
16
|
plugin_downloader = @factory.create_plugin_downloader(environment)
|
14
|
-
|
15
|
-
result = []
|
16
|
-
|
17
17
|
plugin_fact_downloader = @factory.create_plugin_facts_downloader(environment)
|
18
|
+
result = []
|
18
19
|
result += plugin_fact_downloader.evaluate
|
19
|
-
|
20
20
|
result += plugin_downloader.evaluate
|
21
|
+
|
22
|
+
server_agent_version = Puppet.lookup(:server_agent_version) { "0.0" }
|
23
|
+
if Gem::Version.new(server_agent_version) >= SUPPORTED_LOCALES_MOUNT_AGENT_VERSION
|
24
|
+
locales_downloader = @factory.create_locales_downloader(environment)
|
25
|
+
result += locales_downloader.evaluate
|
26
|
+
end
|
27
|
+
|
21
28
|
Puppet::Util::Autoload.reload_changed
|
22
29
|
|
23
30
|
result
|