puppet 6.4.5-universal-darwin → 6.5.0-universal-darwin
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 +26 -20
- 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
@@ -33,7 +33,7 @@ module Runtime3Support
|
|
33
33
|
# @raise [Puppet::ParseError] an evaluation error initialized from the arguments (TODO: Change to EvaluationError?)
|
34
34
|
#
|
35
35
|
def optionally_fail(issue, semantic, options={}, except=nil)
|
36
|
-
if except.nil?
|
36
|
+
if except.nil?
|
37
37
|
# Want a stacktrace, and it must be passed as an exception
|
38
38
|
begin
|
39
39
|
raise EvaluationError.new()
|
@@ -299,10 +299,10 @@ module Runtime3Support
|
|
299
299
|
# 'ruby -wc' thinks that _func is unused, because the only reference to it
|
300
300
|
# is inside of the Kernel.eval string below. By prefixing it with the
|
301
301
|
# underscore, we let Ruby know to not worry about whether it's unused or not.
|
302
|
-
if loader &&
|
302
|
+
if loader && _func = loader.load(:function, name)
|
303
303
|
Puppet::Util::Profiler.profile(name, [:functions, name]) do
|
304
|
-
# Add stack frame when calling.
|
305
|
-
return
|
304
|
+
# Add stack frame when calling. See Puppet::Pops::PuppetStack
|
305
|
+
return Kernel.eval('_func.call(scope, *args, &block)'.freeze, Kernel.binding, file || '', line)
|
306
306
|
end
|
307
307
|
end
|
308
308
|
# Call via 3x API if function exists there without having been autoloaded
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# The null loader is empty and delegates everything to its parent if it has one.
|
2
|
+
#
|
3
|
+
class Puppet::Pops::Loader::NullLoader < Puppet::Pops::Loader::Loader
|
4
|
+
attr_reader :loader_name
|
5
|
+
|
6
|
+
# Construct a NullLoader, optionally with a parent loader
|
7
|
+
#
|
8
|
+
def initialize(parent_loader=nil, loader_name = "null-loader")
|
9
|
+
super(loader_name)
|
10
|
+
@parent = parent_loader
|
11
|
+
end
|
12
|
+
|
13
|
+
# Has parent if one was set when constructed
|
14
|
+
def parent
|
15
|
+
@parent
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(typed_name)
|
19
|
+
if @parent.nil?
|
20
|
+
nil
|
21
|
+
else
|
22
|
+
@parent.find(typed_name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_typed(typed_name)
|
27
|
+
if @parent.nil?
|
28
|
+
nil
|
29
|
+
else
|
30
|
+
@parent.load_typed(typed_name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def loaded_entry(typed_name, check_dependencies = false)
|
35
|
+
if @parent.nil?
|
36
|
+
nil
|
37
|
+
else
|
38
|
+
@parent.loaded_entry(typed_name, check_dependencies)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Has no entries on its own - always nil
|
43
|
+
def get_entry(typed_name)
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
47
|
+
# Finds nothing, there are no entries
|
48
|
+
def find(name)
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
# Cannot store anything
|
53
|
+
def set_entry(typed_name, value, origin = nil)
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_s()
|
58
|
+
"(NullLoader '#{loader_name}')"
|
59
|
+
end
|
60
|
+
end
|
@@ -19,9 +19,10 @@ class Puppet::Pops::Loader::RubyLegacyFunctionInstantiator
|
|
19
19
|
# When func3x turned on, assert content by parsing, when turned off continue with (legacy) undefined behavior
|
20
20
|
if Puppet[:func3x_check]
|
21
21
|
assertion_result = []
|
22
|
-
assert_code(ruby_code_string, assertion_result)
|
23
|
-
|
24
|
-
|
22
|
+
if assert_code(ruby_code_string, assertion_result)
|
23
|
+
unless ruby_code_string.is_a?(String) && assertion_result.include?(:found_newfunction)
|
24
|
+
raise ArgumentError, _("The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call.") % { source_ref: source_ref }
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -72,8 +73,9 @@ class Puppet::Pops::Loader::RubyLegacyFunctionInstantiator
|
|
72
73
|
|
73
74
|
def self.assert_code(code_string, result)
|
74
75
|
ripped = Ripper.sexp(code_string)
|
75
|
-
return if ripped.nil? # Let the next real parse crash and tell where and what is wrong
|
76
|
+
return false if ripped.nil? # Let the next real parse crash and tell where and what is wrong
|
76
77
|
ripped.each {|x| walk(x, result) }
|
78
|
+
true
|
77
79
|
end
|
78
80
|
private_class_method :assert_code
|
79
81
|
|
@@ -18,10 +18,6 @@ class TaskInstantiator
|
|
18
18
|
task = { 'name' => name, 'metadata' => metadata, 'files' => files }
|
19
19
|
|
20
20
|
begin
|
21
|
-
unless metadata['parameters'].is_a?(Hash) || metadata['parameters'].nil?
|
22
|
-
msg = _('Failed to load metadata for task %{name}: \'parameters\' must be a hash') % { name: name }
|
23
|
-
raise Puppet::ParseError.new(msg, metadata_file)
|
24
|
-
end
|
25
21
|
task['parameters'] = convert_types(metadata['parameters'])
|
26
22
|
|
27
23
|
Types::TypeFactory.task.from_hash(task)
|
data/lib/puppet/pops/loaders.rb
CHANGED
@@ -283,7 +283,7 @@ class Loaders
|
|
283
283
|
nil
|
284
284
|
elsif File.directory?(file)
|
285
285
|
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file"
|
286
|
-
elsif File.
|
286
|
+
elsif File.exists?(file)
|
287
287
|
parser.parse_file(file)
|
288
288
|
else
|
289
289
|
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist"
|
@@ -339,7 +339,6 @@ class HieraConfig
|
|
339
339
|
def self.not_implemented(impl, method_name)
|
340
340
|
raise NotImplementedError, "The class #{impl.class.name} should have implemented the method #{method_name}()"
|
341
341
|
end
|
342
|
-
private_class_method :not_implemented
|
343
342
|
end
|
344
343
|
|
345
344
|
# @api private
|
@@ -30,7 +30,7 @@ module SubLookup
|
|
30
30
|
raise yield('Syntax error') unless segments.size * 2 == count + 1
|
31
31
|
segments.map! do |segment|
|
32
32
|
segment.strip!
|
33
|
-
if segment.start_with?('"'
|
33
|
+
if segment.start_with?('"') || segment.start_with?("'")
|
34
34
|
segment[1..-2]
|
35
35
|
elsif segment =~ /^(:?[+-]?[0-9]+)$/
|
36
36
|
segment.to_i
|
@@ -173,14 +173,12 @@ module Puppet::Pops
|
|
173
173
|
|
174
174
|
protected
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
@options_t ||=Types::TypeParser.singleton.parse("Struct[{strategy=>Optional[Pattern[/#{key}/]]}]")
|
183
|
-
end
|
176
|
+
# Returns the type used to validate the options hash
|
177
|
+
#
|
178
|
+
# @return [Types::PStructType] the puppet type
|
179
|
+
#
|
180
|
+
def self.options_t
|
181
|
+
@options_t ||=Types::TypeParser.singleton.parse("Struct[{strategy=>Optional[Pattern[/#{key}/]]}]")
|
184
182
|
end
|
185
183
|
|
186
184
|
# Returns the type used to validate the options hash
|
@@ -385,20 +383,18 @@ module Puppet::Pops
|
|
385
383
|
|
386
384
|
protected
|
387
385
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
'}]')
|
401
|
-
end
|
386
|
+
# Returns a type that allows all deep_merge options except 'preserve_unmergeables' since we force
|
387
|
+
# the setting of that option to false
|
388
|
+
#
|
389
|
+
# @return [Types::PAnyType] the puppet type used when validating the options hash
|
390
|
+
def self.options_t
|
391
|
+
@options_t ||= Types::TypeParser.singleton.parse('Struct[{'\
|
392
|
+
"strategy=>Optional[Pattern[#{key}]],"\
|
393
|
+
'knockout_prefix=>Optional[String],'\
|
394
|
+
'merge_debug=>Optional[Boolean],'\
|
395
|
+
'merge_hash_arrays=>Optional[Boolean],'\
|
396
|
+
'sort_merged_arrays=>Optional[Boolean],'\
|
397
|
+
'}]')
|
402
398
|
end
|
403
399
|
|
404
400
|
def value_t
|
@@ -136,7 +136,7 @@ module HeredocSupport
|
|
136
136
|
# simply leaves lines that have text in the margin untouched.
|
137
137
|
#
|
138
138
|
processed_lines = lines.collect {|s| s.gsub(leading_pattern, '') }
|
139
|
-
margin_per_line =
|
139
|
+
margin_per_line = processed_lines.length.times.map {|x| lines[x].length - processed_lines[x].length }
|
140
140
|
lines = processed_lines
|
141
141
|
else
|
142
142
|
# Array with a 0 per line
|
@@ -23,7 +23,7 @@ module Puppet::Pops::Parser::InterpolationSupport
|
|
23
23
|
value,terminator = slurp_dqstring()
|
24
24
|
text = value
|
25
25
|
after = scn.pos
|
26
|
-
|
26
|
+
while true
|
27
27
|
case terminator
|
28
28
|
when '"'
|
29
29
|
# simple case, there was no interpolation, return directly
|
@@ -63,7 +63,7 @@ module Puppet::Pops::Parser::InterpolationSupport
|
|
63
63
|
value,terminator = slurp_dqstring
|
64
64
|
text = value
|
65
65
|
after = scn.pos
|
66
|
-
|
66
|
+
while true
|
67
67
|
case terminator
|
68
68
|
when '"'
|
69
69
|
# simple case, there was no further interpolation, return directly
|
@@ -107,7 +107,7 @@ module Puppet::Pops::Parser::InterpolationSupport
|
|
107
107
|
value,terminator = slurp_uqstring()
|
108
108
|
text = value
|
109
109
|
after = scn.pos
|
110
|
-
|
110
|
+
while true
|
111
111
|
case terminator
|
112
112
|
when ''
|
113
113
|
# simple case, there was no interpolation, return directly
|
@@ -147,7 +147,7 @@ module Puppet::Pops::Parser::InterpolationSupport
|
|
147
147
|
value,terminator = slurp_uqstring
|
148
148
|
text = value
|
149
149
|
after = scn.pos
|
150
|
-
|
150
|
+
while true
|
151
151
|
case terminator
|
152
152
|
when ''
|
153
153
|
# simple case, there was no further interpolation, return directly
|
@@ -90,7 +90,7 @@ class Locator
|
|
90
90
|
f = Puppet::Util.path_to_uri(f).to_s
|
91
91
|
end
|
92
92
|
offset = ast.offset
|
93
|
-
URI("#{f}?line=#{line_for_offset(offset)}&pos=#{pos_on_line(offset)}")
|
93
|
+
URI("#{f}?line=#{line_for_offset(offset).to_s}&pos=#{pos_on_line(offset).to_s}")
|
94
94
|
end
|
95
95
|
|
96
96
|
class AbstractLocator < Locator
|
@@ -48,23 +48,6 @@ class PNParser
|
|
48
48
|
parse_next
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.char_types
|
52
|
-
unless instance_variable_defined?(:@char_types)
|
53
|
-
@char_types = Array.new(0x80, TYPE_IDENTIFIER)
|
54
|
-
@char_types[0] = TYPE_END
|
55
|
-
[0x09, 0x0d, 0x0a, 0x20].each { |n| @char_types[n] = TYPE_WS }
|
56
|
-
[TOKEN_LP, TOKEN_RP, TOKEN_LB, TOKEN_RB, TOKEN_LC, TOKEN_RC].each { |n| @char_types[n] = TYPE_DELIM }
|
57
|
-
@char_types[0x2d] = TYPE_MINUS
|
58
|
-
(0x30..0x39).each { |n| @char_types[n] = TYPE_DIGIT }
|
59
|
-
(0x41..0x5a).each { |n| @char_types[n] = TYPE_ALPHA }
|
60
|
-
(0x61..0x7a).each { |n| @char_types[n] = TYPE_ALPHA }
|
61
|
-
@char_types[TOKEN_KEY] = TYPE_KEY_START
|
62
|
-
@char_types[TOKEN_STRING] = TYPE_STRING_START
|
63
|
-
@char_types.freeze
|
64
|
-
end
|
65
|
-
@char_types
|
66
|
-
end
|
67
|
-
|
68
51
|
private
|
69
52
|
|
70
53
|
def parse_next
|
@@ -145,6 +128,22 @@ class PNParser
|
|
145
128
|
end
|
146
129
|
|
147
130
|
# All methods below belong to the PN lexer
|
131
|
+
def self.char_types
|
132
|
+
unless instance_variable_defined?(:@char_types)
|
133
|
+
@char_types = Array.new(0x80, TYPE_IDENTIFIER)
|
134
|
+
@char_types[0] = TYPE_END
|
135
|
+
[0x09, 0x0d, 0x0a, 0x20].each { |n| @char_types[n] = TYPE_WS }
|
136
|
+
[TOKEN_LP, TOKEN_RP, TOKEN_LB, TOKEN_RB, TOKEN_LC, TOKEN_RC].each { |n| @char_types[n] = TYPE_DELIM }
|
137
|
+
@char_types[0x2d] = TYPE_MINUS
|
138
|
+
(0x30..0x39).each { |n| @char_types[n] = TYPE_DIGIT }
|
139
|
+
(0x41..0x5a).each { |n| @char_types[n] = TYPE_ALPHA }
|
140
|
+
(0x61..0x7a).each { |n| @char_types[n] = TYPE_ALPHA }
|
141
|
+
@char_types[TOKEN_KEY] = TYPE_KEY_START
|
142
|
+
@char_types[TOKEN_STRING] = TYPE_STRING_START
|
143
|
+
@char_types.freeze
|
144
|
+
end
|
145
|
+
@char_types
|
146
|
+
end
|
148
147
|
|
149
148
|
def next_token
|
150
149
|
skip_white
|
@@ -1,59 +1,57 @@
|
|
1
|
-
module Puppet
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# ```
|
23
|
-
#
|
24
|
-
# To support testing, a given file that is an empty string, or nil
|
25
|
-
# as well as a nil line number are supported. Such stack frames
|
26
|
-
# will be represented with the text `unknown` and `0´ respectively.
|
27
|
-
module PuppetStack
|
28
|
-
@stack = Array.new
|
1
|
+
module Puppet::Pops
|
2
|
+
# Module for making a call such that there is an identifiable entry on
|
3
|
+
# the ruby call stack enabling getting a puppet call stack
|
4
|
+
# To use this make a call with:
|
5
|
+
# ```
|
6
|
+
# Puppet::Pops::PuppetStack.stack(file, line, receiver, message, args)
|
7
|
+
# ```
|
8
|
+
# To get the stack call:
|
9
|
+
# ```
|
10
|
+
# Puppet::Pops::PuppetStack.stacktrace
|
11
|
+
#
|
12
|
+
# When getting a backtrace in Ruby, the puppet stack frames are
|
13
|
+
# identified as coming from "in 'stack'" and having a ".pp" file
|
14
|
+
# name.
|
15
|
+
# To support testing, a given file that is an empty string, or nil
|
16
|
+
# as well as a nil line number are supported. Such stack frames
|
17
|
+
# will be represented with the text `unknown` and `0´ respectively.
|
18
|
+
#
|
19
|
+
module PuppetStack
|
20
|
+
# Pattern matching an entry in the ruby stack that is a puppet entry
|
21
|
+
PP_ENTRY_PATTERN = /^(.*\.pp)?:([0-9]+):in (`stack'|`block in call_function'|`<eval>')/
|
29
22
|
|
30
|
-
|
31
|
-
|
32
|
-
|
23
|
+
# Sends a message to an obj such that it appears to come from
|
24
|
+
# file, line when calling stacktrace.
|
25
|
+
#
|
26
|
+
def self.stack(file, line, obj, message, args, &block)
|
27
|
+
file = '' if file.nil?
|
28
|
+
line = 0 if line.nil?
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
result = obj.send(message, *args)
|
41
|
-
end
|
42
|
-
ensure
|
43
|
-
@stack.shift()
|
44
|
-
end
|
45
|
-
result
|
46
|
-
end
|
30
|
+
if block_given?
|
31
|
+
Kernel.eval("obj.send(message, *args, &block)", Kernel.binding(), file, line)
|
32
|
+
else
|
33
|
+
Kernel.eval("obj.send(message, *args)", Kernel.binding(), file, line)
|
34
|
+
end
|
35
|
+
end
|
47
36
|
|
48
|
-
|
49
|
-
|
37
|
+
def self.stacktrace
|
38
|
+
caller().reduce([]) do |memo, loc|
|
39
|
+
if loc =~ PP_ENTRY_PATTERN
|
40
|
+
memo << [$1.nil? ? 'unknown' : $1, $2.to_i]
|
50
41
|
end
|
42
|
+
memo
|
43
|
+
end
|
44
|
+
end
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
# Returns an Array with the top of the puppet stack, or an empty Array if there was no such entry.
|
47
|
+
#
|
48
|
+
def self.top_of_stack
|
49
|
+
caller.each do |loc|
|
50
|
+
if loc =~ PP_ENTRY_PATTERN
|
51
|
+
return [$1.nil? ? 'unknown' : $1, $2.to_i]
|
56
52
|
end
|
57
53
|
end
|
54
|
+
[]
|
58
55
|
end
|
59
|
-
end
|
56
|
+
end
|
57
|
+
end
|
@@ -728,7 +728,7 @@ class StringConverter
|
|
728
728
|
when :c
|
729
729
|
char = [val].pack("U")
|
730
730
|
char = f.alt? ? "\"#{char}\"" : char
|
731
|
-
Kernel.format(f.orig_fmt.
|
731
|
+
Kernel.format(f.orig_fmt.gsub('c','s'), char)
|
732
732
|
|
733
733
|
when :s
|
734
734
|
fmt = f.alt? ? 'p' : 's'
|
@@ -781,7 +781,7 @@ class StringConverter
|
|
781
781
|
|
782
782
|
when :p
|
783
783
|
# width & precision applied to string, not the the name of the type
|
784
|
-
"Binary(\"#{Kernel.format(f.orig_fmt.
|
784
|
+
"Binary(\"#{Kernel.format(f.orig_fmt.gsub('p', 's'), val.to_s)}\")"
|
785
785
|
|
786
786
|
when :b
|
787
787
|
Kernel.format(f.orig_fmt.gsub('b', substitute), val.relaxed_to_s)
|
@@ -817,23 +817,23 @@ class StringConverter
|
|
817
817
|
|
818
818
|
when :c
|
819
819
|
c_val = val.capitalize
|
820
|
-
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.
|
820
|
+
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.gsub('c', 's'), c_val)
|
821
821
|
|
822
822
|
when :C
|
823
823
|
c_val = val.split('::').map {|s| s.capitalize }.join('::')
|
824
|
-
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.
|
824
|
+
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.gsub('C', 's'), c_val)
|
825
825
|
|
826
826
|
when :u
|
827
827
|
c_val = val.upcase
|
828
|
-
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.
|
828
|
+
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.gsub('u', 's'), c_val)
|
829
829
|
|
830
830
|
when :d
|
831
831
|
c_val = val.downcase
|
832
|
-
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.
|
832
|
+
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.gsub('d', 's'), c_val)
|
833
833
|
|
834
834
|
when :t # trim
|
835
835
|
c_val = val.strip
|
836
|
-
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.
|
836
|
+
f.alt? ? apply_string_flags(f, puppet_quote(c_val)) : Kernel.format(f.orig_fmt.gsub('t', 's'), c_val)
|
837
837
|
|
838
838
|
else
|
839
839
|
raise FormatError.new('String', f.format, 'cCudspt')
|
@@ -921,7 +921,7 @@ class StringConverter
|
|
921
921
|
case f.format
|
922
922
|
when :p
|
923
923
|
str_regexp = PRegexpType.regexp_to_s_with_delimiters(val)
|
924
|
-
f.orig_fmt == '%p' ? str_regexp : Kernel.format(f.orig_fmt.
|
924
|
+
f.orig_fmt == '%p' ? str_regexp : Kernel.format(f.orig_fmt.gsub('p', 's'), str_regexp)
|
925
925
|
when :s
|
926
926
|
str_regexp = PRegexpType.regexp_to_s(val)
|
927
927
|
str_regexp = puppet_quote(str_regexp) if f.alt?
|
@@ -1098,10 +1098,10 @@ class StringConverter
|
|
1098
1098
|
f = get_format(val_type, format_map)
|
1099
1099
|
case f.format
|
1100
1100
|
when :s
|
1101
|
-
str_val = f.alt? ? "\"#{val}\"" : val.to_s
|
1101
|
+
str_val = f.alt? ? "\"#{val.to_s}\"" : val.to_s
|
1102
1102
|
Kernel.format(f.orig_fmt, str_val)
|
1103
1103
|
when :p
|
1104
|
-
Kernel.format(f.orig_fmt.
|
1104
|
+
Kernel.format(f.orig_fmt.gsub('p', 's'), val.to_s)
|
1105
1105
|
else
|
1106
1106
|
raise FormatError.new('Type', f.format, 'sp')
|
1107
1107
|
end
|