puppet 6.4.5-x86-mingw32 → 6.5.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CODEOWNERS +10 -10
- data/Gemfile +6 -6
- data/Gemfile.lock +46 -52
- data/ext/build_defaults.yaml +0 -1
- data/ext/project_data.yaml +3 -3
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/solaris/smf/puppet.xml +0 -2
- data/ext/windows/eventlog/Rakefile +32 -0
- data/ext/windows/eventlog/puppetres.dll +0 -0
- data/ext/windows/eventlog/puppetres.mc +18 -0
- data/ext/windows/service/daemon.rb +8 -38
- data/install.rb +24 -6
- data/lib/puppet.rb +3 -1
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +11 -34
- data/lib/puppet/application/apply.rb +6 -6
- data/lib/puppet/application/describe.rb +9 -3
- data/lib/puppet/application/device.rb +4 -14
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +2 -2
- data/lib/puppet/application/resource.rb +4 -4
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/application/ssl.rb +10 -9
- data/lib/puppet/configurer.rb +30 -86
- data/lib/puppet/configurer/downloader.rb +6 -2
- data/lib/puppet/defaults.rb +50 -44
- data/lib/puppet/error.rb +14 -9
- data/lib/puppet/face/catalog.rb +20 -1
- data/lib/puppet/face/config.rb +48 -10
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/help.rb +1 -1
- data/lib/puppet/face/module/list.rb +5 -5
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +1 -1
- data/lib/puppet/face/parser.rb +48 -9
- data/lib/puppet/face/plugin.rb +2 -9
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +12 -2
- data/lib/puppet/file_system/file_impl.rb +6 -3
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +2 -3
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions.rb +2 -1
- data/lib/puppet/functions/camelcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/find_file.rb +9 -9
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/regsubst.rb +6 -8
- data/lib/puppet/gettext/module_translations.rb +1 -1
- data/lib/puppet/graph/rb_tree_map.rb +2 -2
- data/lib/puppet/graph/simple_graph.rb +3 -4
- data/lib/puppet/indirector/catalog/compiler.rb +5 -11
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +0 -2
- data/lib/puppet/indirector/resource/ral.rb +3 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +1 -2
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module/task.rb +4 -20
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
- data/lib/puppet/module_tool/tar/mini.rb +2 -12
- data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
- data/lib/puppet/network/http/connection.rb +12 -10
- data/lib/puppet/network/http/factory.rb +11 -1
- data/lib/puppet/network/http/pool.rb +0 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +2 -4
- data/lib/puppet/pal/pal_impl.rb +2 -2
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/fail.rb +8 -1
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/scope.rb +7 -8
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -3
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/loader/null_loader.rb +60 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
- data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +18 -22
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/pn_parser.rb +16 -17
- data/lib/puppet/pops/puppet_stack.rb +49 -51
- data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
- data/lib/puppet/pops/types/string_converter.rb +10 -10
- data/lib/puppet/pops/types/types.rb +6 -5
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/exec.rb +2 -6
- data/lib/puppet/provider/file/posix.rb +0 -5
- data/lib/puppet/provider/nameservice.rb +3 -10
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package.rb +0 -2
- data/lib/puppet/provider/package/apt.rb +1 -5
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +18 -34
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +13 -37
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +18 -56
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +5 -9
- data/lib/puppet/provider/package_targetable.rb +4 -7
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +5 -20
- data/lib/puppet/provider/service/openbsd.rb +1 -1
- data/lib/puppet/provider/service/rcng.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +8 -2
- data/lib/puppet/provider/service/systemd.rb +19 -14
- data/lib/puppet/provider/service/windows.rb +0 -8
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +3 -12
- data/lib/puppet/provider/user/user_role_add.rb +1 -5
- data/lib/puppet/provider/user/useradd.rb +20 -45
- data/lib/puppet/provider/user/windows_adsi.rb +5 -4
- data/lib/puppet/reference/configuration.rb +3 -3
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +3 -1
- data/lib/puppet/reference/providers.rb +3 -1
- data/lib/puppet/reference/type.rb +9 -3
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +1 -18
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/rest/routes.rb +30 -17
- data/lib/puppet/settings.rb +3 -43
- data/lib/puppet/settings/environment_conf.rb +0 -1
- data/lib/puppet/ssl/certificate_request.rb +12 -2
- data/lib/puppet/ssl/host.rb +2 -2
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/ssl/ssl_provider.rb +11 -5
- data/lib/puppet/ssl/state_machine.rb +102 -98
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +11 -33
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/type.rb +4 -2
- data/lib/puppet/type/exec.rb +17 -23
- data/lib/puppet/type/file.rb +39 -11
- data/lib/puppet/type/file/data_sync.rb +1 -5
- data/lib/puppet/type/group.rb +2 -4
- data/lib/puppet/type/notify.rb +3 -4
- data/lib/puppet/type/package.rb +3 -20
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/service.rb +3 -8
- data/lib/puppet/type/user.rb +2 -4
- data/lib/puppet/util.rb +29 -39
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +3 -4
- data/lib/puppet/util/http_proxy.rb +19 -27
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +2 -2
- data/lib/puppet/util/logging.rb +20 -32
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +33 -0
- data/lib/puppet/util/pidlock.rb +2 -3
- data/lib/puppet/util/provider_features.rb +4 -2
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +2 -8
- data/lib/puppet/util/skip_tags.rb +4 -0
- data/lib/puppet/util/windows/adsi.rb +18 -48
- data/lib/puppet/util/windows/process.rb +8 -8
- data/lib/puppet/util/windows/registry.rb +5 -7
- data/lib/puppet/util/windows/security.rb +0 -2
- data/lib/puppet/util/windows/service.rb +4 -149
- data/lib/puppet/util/windows/sid.rb +0 -1
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +81 -24
- data/locales/puppet.pot +462 -482
- data/man/man5/puppet.conf.5 +43 -44
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +3 -3
- data/man/man8/puppet-catalog.8 +31 -3
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +3 -3
- data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
- data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
- data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
- data/spec/fixtures/ssl/ca.pem +30 -30
- data/spec/fixtures/ssl/crl.pem +15 -15
- data/spec/fixtures/ssl/ec-key.pem +18 -0
- data/spec/fixtures/ssl/ec.pem +40 -0
- data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
- data/spec/fixtures/ssl/encrypted-key.pem +57 -57
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
- data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
- data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
- data/spec/fixtures/ssl/intermediate.pem +31 -31
- data/spec/fixtures/ssl/pluto-key.pem +56 -56
- data/spec/fixtures/ssl/pluto.pem +28 -28
- data/spec/fixtures/ssl/request-key.pem +56 -56
- data/spec/fixtures/ssl/request.pem +24 -24
- data/spec/fixtures/ssl/revoked-key.pem +56 -56
- data/spec/fixtures/ssl/revoked.pem +25 -25
- data/spec/fixtures/ssl/signed-key.pem +56 -56
- data/spec/fixtures/ssl/signed.pem +25 -25
- data/spec/fixtures/ssl/tampered-cert.pem +27 -27
- data/spec/fixtures/ssl/tampered-csr.pem +24 -24
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/configurer_spec.rb +0 -52
- data/spec/integration/provider/service/init_spec.rb +1 -0
- data/spec/integration/provider/service/systemd_spec.rb +5 -8
- data/spec/integration/type/file_spec.rb +38 -28
- data/spec/integration/util/execution_spec.rb +0 -27
- data/spec/lib/puppet/certificate_factory.rb +2 -2
- data/spec/lib/puppet/test_ca.rb +17 -4
- data/spec/lib/puppet_spec/fixtures.rb +4 -0
- data/spec/spec_helper.rb +0 -28
- data/spec/unit/application/agent_spec.rb +34 -67
- data/spec/unit/application/device_spec.rb +1 -27
- data/spec/unit/application/ssl_spec.rb +60 -35
- data/spec/unit/configurer_spec.rb +399 -395
- data/spec/unit/defaults_spec.rb +4 -4
- data/spec/unit/face/facts_spec.rb +0 -9
- data/spec/unit/face/parser_spec.rb +69 -22
- data/spec/unit/face/plugin_spec.rb +0 -8
- data/spec/unit/file_system_spec.rb +30 -1
- data/spec/unit/forge/forge_spec.rb +3 -1
- data/spec/unit/forge/repository_spec.rb +3 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/network/http/api/indirected_routes_spec.rb +10 -25
- data/spec/unit/network/http/connection_spec.rb +145 -119
- data/spec/unit/network/http/factory_spec.rb +5 -27
- data/spec/unit/parser/scope_spec.rb +0 -10
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
- data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
- data/spec/unit/pops/types/types_spec.rb +27 -0
- data/spec/unit/provider/exec_spec.rb +0 -209
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/dnf_spec.rb +0 -7
- data/spec/unit/provider/package/dpkg_spec.rb +80 -240
- data/spec/unit/provider/package/pip_spec.rb +8 -61
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/rpm_spec.rb +16 -150
- data/spec/unit/provider/package/yum_spec.rb +0 -7
- data/spec/unit/provider/service/daemontools_spec.rb +0 -24
- data/spec/unit/provider/service/launchd_spec.rb +0 -28
- data/spec/unit/provider/service/runit_spec.rb +0 -24
- data/spec/unit/provider/service/systemd_spec.rb +25 -39
- data/spec/unit/provider/service/windows_spec.rb +0 -20
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/pw_spec.rb +0 -37
- data/spec/unit/provider/user/useradd_spec.rb +0 -88
- data/spec/unit/resource_spec.rb +1 -26
- data/spec/unit/ssl/host_spec.rb +5 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
- data/spec/unit/ssl/state_machine_spec.rb +233 -158
- data/spec/unit/transaction_spec.rb +0 -64
- data/spec/unit/type/exec_spec.rb +12 -15
- data/spec/unit/type/file/content_spec.rb +3 -9
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/file_spec.rb +15 -11
- data/spec/unit/type/package_spec.rb +0 -5
- data/spec/unit/type/schedule_spec.rb +1 -3
- data/spec/unit/type/service_spec.rb +0 -16
- data/spec/unit/util/execution_spec.rb +0 -16
- data/spec/unit/util/http_proxy_spec.rb +21 -151
- data/spec/unit/util/ldap/manager_spec.rb +0 -15
- data/spec/unit/util/log/destinations_spec.rb +3 -7
- data/spec/unit/util/log_spec.rb +138 -0
- data/spec/unit/util/logging_spec.rb +0 -200
- data/spec/unit/util/pidlock_spec.rb +0 -26
- data/spec/unit/util/skip_tags_spec.rb +14 -0
- data/spec/unit/util/windows/adsi_spec.rb +0 -51
- data/spec/unit/util/windows/service_spec.rb +0 -9
- data/spec/unit/util_spec.rb +10 -0
- data/spec/unit/x509/cert_provider_spec.rb +82 -43
- data/tasks/generate_cert_fixtures.rake +13 -1
- data/tasks/manpages.rake +0 -1
- metadata +28 -22
- data/ext/cert_inspector +0 -140
- data/ext/envpuppet +0 -139
- data/ext/envpuppet.bat +0 -14
- data/ext/puppet-test +0 -476
- data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
- data/ext/upload_facts.rb +0 -119
- data/lib/puppet/provider/package/dnfmodule.rb +0 -87
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
- data/spec/integration/type/notify_spec.rb +0 -46
- data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
- data/spec/unit/provider/package_targetable_spec.rb +0 -60
data/lib/puppet/face/plugin.rb
CHANGED
@@ -41,15 +41,8 @@ Puppet::Face.define(:plugin, '0.0.1') do
|
|
41
41
|
when_invoked do |options|
|
42
42
|
remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment])
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
begin
|
47
|
-
handler = Puppet::Configurer::PluginHandler.new()
|
48
|
-
handler.download_plugins(remote_environment_for_plugins)
|
49
|
-
ensure
|
50
|
-
pool.close
|
51
|
-
end
|
52
|
-
end
|
44
|
+
handler = Puppet::Configurer::PluginHandler.new()
|
45
|
+
handler.download_plugins(remote_environment_for_plugins)
|
53
46
|
end
|
54
47
|
|
55
48
|
when_rendering :console do |value|
|
@@ -40,7 +40,7 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
|
|
40
40
|
[ @checksum_type, :md5, :sha256, :sha384, :sha512, :sha224, :mtime ].each do |type|
|
41
41
|
@checksum_type = type
|
42
42
|
@checksum = @checksums[type]
|
43
|
-
|
43
|
+
return if @checksum
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/lib/puppet/file_system.rb
CHANGED
@@ -92,6 +92,14 @@ module Puppet::FileSystem
|
|
92
92
|
@impl.path_string(@impl.basename(assert_path(path)))
|
93
93
|
end
|
94
94
|
|
95
|
+
# @return [Integer] the size of the file
|
96
|
+
#
|
97
|
+
# @api public
|
98
|
+
#
|
99
|
+
def self.size(path)
|
100
|
+
@impl.size(assert_path(path))
|
101
|
+
end
|
102
|
+
|
95
103
|
# Allows exclusive updates to a file to be made by excluding concurrent
|
96
104
|
# access using flock. This means that if the file is on a filesystem that
|
97
105
|
# does not support flock, this method will provide no protection.
|
@@ -206,10 +214,12 @@ module Puppet::FileSystem
|
|
206
214
|
|
207
215
|
# Touches the file. On most systems this updates the mtime of the file.
|
208
216
|
#
|
217
|
+
# @param mtime [Time] The last modified time or nil to use the current time
|
218
|
+
#
|
209
219
|
# @api public
|
210
220
|
#
|
211
|
-
def self.touch(path)
|
212
|
-
@impl.touch(assert_path(path))
|
221
|
+
def self.touch(path, mtime: nil)
|
222
|
+
@impl.touch(assert_path(path), mtime: mtime)
|
213
223
|
end
|
214
224
|
|
215
225
|
# Creates directories for all parts of the given path.
|
@@ -54,14 +54,17 @@ class Puppet::FileSystem::FileImpl
|
|
54
54
|
while !written
|
55
55
|
::File.open(path, options, mode) do |rf|
|
56
56
|
if rf.flock(::File::LOCK_EX|::File::LOCK_NB)
|
57
|
+
Puppet.debug(_("Locked '%{path}'") % { path: path })
|
57
58
|
yield rf
|
58
59
|
written = true
|
60
|
+
Puppet.debug(_("Unlocked '%{path}'") % { path: path })
|
59
61
|
else
|
62
|
+
Puppet.debug("Failed to lock '%s' retrying in %.2f milliseconds" % [path, wait * 1000])
|
60
63
|
sleep wait
|
61
64
|
timeout -= wait
|
62
65
|
wait *= 2
|
63
66
|
if timeout < 0
|
64
|
-
raise Timeout::Error, _("Timeout waiting for exclusive lock on %{path}") % { path:
|
67
|
+
raise Timeout::Error, _("Timeout waiting for exclusive lock on %{path}") % { path: path }
|
65
68
|
end
|
66
69
|
end
|
67
70
|
end
|
@@ -108,8 +111,8 @@ class Puppet::FileSystem::FileImpl
|
|
108
111
|
path.writable?
|
109
112
|
end
|
110
113
|
|
111
|
-
def touch(path)
|
112
|
-
::FileUtils.touch(path)
|
114
|
+
def touch(path, mtime: nil)
|
115
|
+
::FileUtils.touch(path, mtime: mtime)
|
113
116
|
end
|
114
117
|
|
115
118
|
def mkpath(path)
|
@@ -14,12 +14,11 @@ class Puppet::FileSystem::Posix < Puppet::FileSystem::FileImpl
|
|
14
14
|
bsize = stream_blksize(this, stream)
|
15
15
|
sa = "".force_encoding('ASCII-8BIT')
|
16
16
|
sb = "".force_encoding('ASCII-8BIT')
|
17
|
-
|
17
|
+
begin
|
18
18
|
this.read(bsize, sa)
|
19
19
|
stream.read(bsize, sb)
|
20
20
|
return true if sa.empty? && sb.empty?
|
21
|
-
|
22
|
-
end
|
21
|
+
end while sa == sb
|
23
22
|
false
|
24
23
|
end
|
25
24
|
end
|
data/lib/puppet/forge.rb
CHANGED
@@ -58,7 +58,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
58
58
|
matches = []
|
59
59
|
uri = "/v3/modules?query=#{term}"
|
60
60
|
if Puppet[:module_groups]
|
61
|
-
uri += "&module_groups=#{Puppet[:module_groups].
|
61
|
+
uri += "&module_groups=#{Puppet[:module_groups].gsub('+', ' ')}"
|
62
62
|
end
|
63
63
|
|
64
64
|
while uri
|
@@ -94,7 +94,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
94
94
|
name = input.tr('/', '-')
|
95
95
|
uri = "/v3/releases?module=#{name}&sort_by=version&exclude_fields=#{MODULE_RELEASE_EXCLUSIONS}"
|
96
96
|
if Puppet[:module_groups]
|
97
|
-
uri += "&module_groups=#{Puppet[:module_groups].
|
97
|
+
uri += "&module_groups=#{Puppet[:module_groups].gsub('+', ' ')}"
|
98
98
|
end
|
99
99
|
releases = []
|
100
100
|
|
@@ -239,6 +239,6 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
239
239
|
def decode_uri(uri)
|
240
240
|
return if uri.nil?
|
241
241
|
|
242
|
-
URI.decode(uri.
|
242
|
+
URI.decode(uri.gsub('+', ' '))
|
243
243
|
end
|
244
244
|
end
|
data/lib/puppet/functions.rb
CHANGED
@@ -624,7 +624,8 @@ module Puppet::Functions
|
|
624
624
|
# Get location to use in case of error - this produces ruby filename and where call to 'type' occurred
|
625
625
|
# but strips off the rest of the internal "where" as it is not meaningful to user.
|
626
626
|
#
|
627
|
-
rb_location = caller
|
627
|
+
rb_location = caller[0]
|
628
|
+
|
628
629
|
begin
|
629
630
|
result = parser.parse_string("type #{assignment_string}", nil)
|
630
631
|
rescue StandardError => e
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# @example Camelcase of strings in an Array
|
25
25
|
# ```puppet
|
26
|
-
# ['abc_def', 'bcd_xyz'].
|
27
|
-
#
|
26
|
+
# ['abc_def', 'bcd_xyz'].capitalize()
|
27
|
+
# capitalize(['abc_def', 'bcd_xyz'])
|
28
28
|
# ```
|
29
29
|
# Would both result in `['AbcDef', 'BcdXyz']`
|
30
30
|
#
|
data/lib/puppet/functions/epp.rb
CHANGED
@@ -6,12 +6,12 @@
|
|
6
6
|
# The first argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>`
|
7
7
|
# reference, which loads `<TEMPLATE FILE>` from `<MODULE NAME>`'s `templates`
|
8
8
|
# directory. In most cases, the last argument is optional; if used, it should be a
|
9
|
-
# [hash](
|
9
|
+
# [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
|
10
10
|
# pass to the template.
|
11
11
|
#
|
12
|
-
# - See the [template](
|
13
|
-
#
|
14
|
-
# - See the [EPP syntax](
|
12
|
+
# - See the [template](/puppet/latest/reference/lang_template.html) documentation
|
13
|
+
# for general template usage information.
|
14
|
+
# - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
|
15
15
|
# documentation for examples of EPP.
|
16
16
|
#
|
17
17
|
# For example, to call the apache module's `templates/vhost/_docroot.epp`
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# Finds an existing file from a module and returns its path.
|
2
2
|
#
|
3
|
-
#
|
4
|
-
# reference, which
|
3
|
+
# The argument to this function should be a String as a `<MODULE NAME>/<FILE>`
|
4
|
+
# reference, which will search for `<FILE>` relative to a module's `files`
|
5
5
|
# directory. (For example, the reference `mysql/mysqltuner.pl` will search for the
|
6
6
|
# file `<MODULES DIRECTORY>/mysql/files/mysqltuner.pl`.)
|
7
7
|
#
|
8
8
|
# This function can also accept:
|
9
|
+
#
|
10
|
+
# * An absolute String path, which will check for the existence of a file from anywhere on disk.
|
11
|
+
# * Multiple String arguments, which will return the path of the **first** file
|
12
|
+
# found, skipping non existing files.
|
13
|
+
# * An array of string paths, which will return the path of the **first** file
|
14
|
+
# found from the given paths in the array, skipping non existing files.
|
9
15
|
#
|
10
|
-
#
|
11
|
-
# * Multiple String arguments, which returns the path of the **first** file
|
12
|
-
# found, skipping nonexistent files.
|
13
|
-
# * An array of string paths, which returns the path of the **first** file
|
14
|
-
# found from the given paths in the array, skipping nonexistent files.
|
15
|
-
#
|
16
|
-
# The function returns `undef` if none of the given paths were found.
|
16
|
+
# The function returns `undef` if none of the given paths were found
|
17
17
|
#
|
18
18
|
# @since 4.8.0
|
19
19
|
#
|
@@ -5,12 +5,12 @@
|
|
5
5
|
#
|
6
6
|
# The first argument to this function should be a string containing an EPP
|
7
7
|
# template. In most cases, the last argument is optional; if used, it should be a
|
8
|
-
# [hash](
|
8
|
+
# [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
|
9
9
|
# pass to the template.
|
10
10
|
#
|
11
|
-
# - See the [template](
|
12
|
-
#
|
13
|
-
# - See the [EPP syntax](
|
11
|
+
# - See the [template](/puppet/latest/reference/lang_template.html) documentation
|
12
|
+
# for general template usage information.
|
13
|
+
# - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
|
14
14
|
# documentation for examples of EPP.
|
15
15
|
#
|
16
16
|
# For example, to evaluate an inline EPP template and pass it the `docroot` and
|
@@ -28,7 +28,7 @@
|
|
28
28
|
# `inline_epp` function fails to pass any required parameter.
|
29
29
|
#
|
30
30
|
# An inline EPP template should be written as a single-quoted string or
|
31
|
-
# [heredoc](
|
31
|
+
# [heredoc](/puppet/latest/reference/lang_data_string.html#heredocs).
|
32
32
|
# A double-quoted string is subject to expression interpolation before the string
|
33
33
|
# is parsed as an EPP template.
|
34
34
|
#
|
@@ -27,16 +27,14 @@
|
|
27
27
|
# @return [Array[String], String] The result of the substitution. Result type is the same as for the target parameter.
|
28
28
|
#
|
29
29
|
# @example Get the third octet from the node's IP address:
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# ```
|
30
|
+
# ```puppet
|
31
|
+
# $i3 = regsubst($ipaddress,'^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$','\\3')
|
32
|
+
# ```
|
34
33
|
#
|
35
34
|
# @example Put angle brackets around each octet in the node's IP address:
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
# ```
|
35
|
+
# ```puppet
|
36
|
+
# $x = regsubst($ipaddress, /([0-9]+)/, '<\\1>', 'G')
|
37
|
+
# ```
|
40
38
|
#
|
41
39
|
Puppet::Functions.create_function(:regsubst) do
|
42
40
|
dispatch :regsubst_string do
|
@@ -11,7 +11,7 @@ module Puppet::ModuleTranslations
|
|
11
11
|
modules.each do |mod|
|
12
12
|
next unless mod.forge_name && mod.has_translations?(Puppet::GettextConfig.current_locale)
|
13
13
|
|
14
|
-
module_name = mod.forge_name.
|
14
|
+
module_name = mod.forge_name.gsub('/', '-')
|
15
15
|
if Puppet::GettextConfig.load_translations(module_name, mod.locale_directory, :po)
|
16
16
|
Puppet.debug "Loaded translations for #{module_name}."
|
17
17
|
elsif Puppet::GettextConfig.gettext_loaded?
|
@@ -213,8 +213,8 @@ class Puppet::Graph::RbTreeMap
|
|
213
213
|
:color => @color,
|
214
214
|
}
|
215
215
|
}
|
216
|
-
h
|
217
|
-
h
|
216
|
+
h.merge!(:left => left.to_hash) if @left
|
217
|
+
h.merge!(:right => right.to_hash) if @right
|
218
218
|
h
|
219
219
|
end
|
220
220
|
|
@@ -133,12 +133,11 @@ class Puppet::Graph::SimpleGraph
|
|
133
133
|
else
|
134
134
|
if s[:lowlink][vertex] == s[:index][vertex] then
|
135
135
|
this_scc = []
|
136
|
-
|
136
|
+
begin
|
137
137
|
top = s[:stack].pop
|
138
138
|
s[:seen][top] = false
|
139
139
|
this_scc << top
|
140
|
-
|
141
|
-
end
|
140
|
+
end until top == vertex
|
142
141
|
s[:scc] << this_scc
|
143
142
|
end
|
144
143
|
recur.pop # done with this node, finally.
|
@@ -438,7 +437,7 @@ class Puppet::Graph::SimpleGraph
|
|
438
437
|
# rdot.rb. If an edge or vertex label is a kind of Hash then the keys
|
439
438
|
# which match +dot+ properties will be used as well.
|
440
439
|
def to_dot_graph(params = {})
|
441
|
-
params['name'] ||= self.class.name.
|
440
|
+
params['name'] ||= self.class.name.gsub(/:/,'_')
|
442
441
|
fontsize = params['fontsize'] ? params['fontsize'] : '8'
|
443
442
|
graph = (directed? ? DOT::DOTDigraph : DOT::DOTSubgraph).new(params)
|
444
443
|
edge_klass = directed? ? DOT::DOTDirectedEdge : DOT::DOTEdge
|
@@ -395,28 +395,22 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
395
395
|
|
396
396
|
# And then add the server name and IP
|
397
397
|
{"servername" => "fqdn",
|
398
|
-
"serverip"
|
399
|
-
"serverip6" => "ipaddress6"
|
398
|
+
"serverip" => "ipaddress"
|
400
399
|
}.each do |var, fact|
|
401
|
-
value = Facter.value(fact)
|
402
|
-
if !value.nil?
|
400
|
+
if value = Facter.value(fact)
|
403
401
|
@server_facts[var] = value
|
402
|
+
else
|
403
|
+
Puppet.warning _("Could not retrieve fact %{fact}") % { fact: fact }
|
404
404
|
end
|
405
405
|
end
|
406
406
|
|
407
407
|
if @server_facts["servername"].nil?
|
408
408
|
host = Facter.value(:hostname)
|
409
|
-
if
|
410
|
-
Puppet.warning _("Could not retrieve fact servername")
|
411
|
-
elsif domain = Facter.value(:domain)
|
409
|
+
if domain = Facter.value(:domain)
|
412
410
|
@server_facts["servername"] = [host, domain].join(".")
|
413
411
|
else
|
414
412
|
@server_facts["servername"] = host
|
415
413
|
end
|
416
414
|
end
|
417
|
-
|
418
|
-
if @server_facts["serverip"].nil? && @server_facts["serverip6"].nil?
|
419
|
-
Puppet.warning _("Could not retrieve either serverip or serverip6 fact")
|
420
|
-
end
|
421
415
|
end
|
422
416
|
end
|
@@ -15,7 +15,7 @@ module Puppet::FileBucketFile
|
|
15
15
|
request.options[:bucket_path] ||= Puppet[:bucketdir]
|
16
16
|
# If filebucket mode is 'list'
|
17
17
|
if request.options[:list_all]
|
18
|
-
return nil unless ::File.
|
18
|
+
return nil unless ::File.exists?(request.options[:bucket_path])
|
19
19
|
return list(request)
|
20
20
|
end
|
21
21
|
checksum, files_original_path = request_to_checksum_and_path(request)
|
@@ -25,7 +25,9 @@ class Puppet::Resource::Ral < Puppet::Indirector::Code
|
|
25
25
|
res.to_resource
|
26
26
|
end.find_all do |res|
|
27
27
|
conditions.all? {|property, value| res.to_resource[property].to_s == value.to_s}
|
28
|
-
end.
|
28
|
+
end.sort do |a,b|
|
29
|
+
a.title <=> b.title
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
def save( request )
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Puppet::Resource::Validator
|
2
2
|
def validate_key(request)
|
3
3
|
type, title = request.key.split('/', 2)
|
4
|
-
unless type.
|
4
|
+
unless type.downcase == request.instance.type.downcase and title == request.instance.title
|
5
5
|
raise Puppet::Indirector::ValidationError, _("Resource instance does not match request key")
|
6
6
|
end
|
7
7
|
end
|
data/lib/puppet/interface.rb
CHANGED
@@ -96,7 +96,7 @@ class Puppet::Interface
|
|
96
96
|
if Puppet::Interface::FaceCollection[name, :current]
|
97
97
|
raise Puppet::Error, "Could not find version #{version} of #{name}"
|
98
98
|
else
|
99
|
-
raise Puppet::Error, "Could not find Puppet Face #{name}"
|
99
|
+
raise Puppet::Error, "Could not find Puppet Face #{name.to_s}"
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -234,5 +234,4 @@ class Puppet::Interface
|
|
234
234
|
define_method(name, proc)
|
235
235
|
instance_method(name)
|
236
236
|
end
|
237
|
-
private_class_method :__add_method
|
238
237
|
end
|
data/lib/puppet/loaders.rb
CHANGED
@@ -9,6 +9,7 @@ module Puppet
|
|
9
9
|
require 'puppet/pops/loader/gem_support'
|
10
10
|
require 'puppet/pops/loader/module_loaders'
|
11
11
|
require 'puppet/pops/loader/dependency_loader'
|
12
|
+
require 'puppet/pops/loader/null_loader'
|
12
13
|
require 'puppet/pops/loader/static_loader'
|
13
14
|
require 'puppet/pops/loader/runtime3_type_loader'
|
14
15
|
require 'puppet/pops/loader/ruby_function_instantiator'
|
@@ -121,7 +121,7 @@ module Manager
|
|
121
121
|
|
122
122
|
# Now set up autoload any providers that might exist for this type.
|
123
123
|
|
124
|
-
klass.providerloader = Puppet::Util::Autoload.new(klass, "puppet/provider/#{klass.name}")
|
124
|
+
klass.providerloader = Puppet::Util::Autoload.new(klass, "puppet/provider/#{klass.name.to_s}")
|
125
125
|
|
126
126
|
# We have to load everything so that we can figure out the default provider.
|
127
127
|
klass.providerloader.loadall(Puppet.lookup(:current_environment))
|
data/lib/puppet/module.rb
CHANGED
@@ -203,7 +203,7 @@ class Puppet::Module
|
|
203
203
|
@metadata = data = read_metadata
|
204
204
|
return if data.empty?
|
205
205
|
|
206
|
-
@forge_name = data['name'].
|
206
|
+
@forge_name = data['name'].gsub('-', '/') if data['name']
|
207
207
|
|
208
208
|
[:source, :author, :version, :license, :dependencies].each do |attr|
|
209
209
|
value = data[attr.to_s]
|
data/lib/puppet/module/task.rb
CHANGED
@@ -76,23 +76,11 @@ class Puppet::Module
|
|
76
76
|
# Find task's required lib files and retrieve paths for both 'files' and 'implementation:files' metadata keys
|
77
77
|
def self.find_extra_files(metadata, envname = nil)
|
78
78
|
return [] if metadata.nil?
|
79
|
-
|
80
|
-
files = metadata.fetch('files', [])
|
81
|
-
unless files.is_a?(Array)
|
82
|
-
msg = _("The 'files' task metadata expects an array, got %{files}.") % {files: files}
|
83
|
-
raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')
|
84
|
-
end
|
85
|
-
impl_files = metadata.fetch('implementations', []).flat_map do |impl|
|
86
|
-
file_array = impl.fetch('files', [])
|
87
|
-
unless file_array.is_a?(Array)
|
88
|
-
msg = _("The 'files' task metadata expects an array, got %{files}.") % {files: file_array}
|
89
|
-
raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')
|
90
|
-
end
|
91
|
-
file_array
|
92
|
-
end
|
93
79
|
|
94
|
-
|
95
|
-
|
80
|
+
files = metadata.fetch('files', []) +
|
81
|
+
metadata.fetch('implementations', []).flat_map { |impl| impl.fetch('files', []) }
|
82
|
+
|
83
|
+
files.uniq.flat_map do |file|
|
96
84
|
module_name, mount, endpath = file.split("/", 3)
|
97
85
|
# If there's a mount directory with no trailing slash this will be nil
|
98
86
|
# We want it to be empty to construct a path
|
@@ -154,10 +142,6 @@ class Puppet::Module
|
|
154
142
|
end
|
155
143
|
|
156
144
|
implementations = metadata['implementations'].map do |impl|
|
157
|
-
unless impl['requirements'].is_a?(Array) || impl['requirements'].nil?
|
158
|
-
msg = _("Task metadata for task %{name} does not specify requirements as an array" % { name: name })
|
159
|
-
raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')
|
160
|
-
end
|
161
145
|
path = executables.find { |real_impl| File.basename(real_impl) == impl['name'] }
|
162
146
|
unless path
|
163
147
|
msg = _("Task metadata for task %{name} specifies missing implementation %{implementation}" % { name: name, implementation: impl['name'] })
|