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/spec/unit/defaults_spec.rb
CHANGED
@@ -139,7 +139,7 @@ describe "Defaults" do
|
|
139
139
|
let(:installdir) { 'C:\Program Files\Puppet Labs\Puppet' }
|
140
140
|
|
141
141
|
it 'includes user and system modules' do
|
142
|
-
allow(
|
142
|
+
allow(Facter).to receive(:value).with(:env_windows_installdir).and_return(installdir)
|
143
143
|
|
144
144
|
expect(
|
145
145
|
Puppet.default_basemodulepath
|
@@ -147,7 +147,7 @@ describe "Defaults" do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'includes user modules if installdir fact is missing' do
|
150
|
-
allow(
|
150
|
+
allow(Facter).to receive(:value).with(:env_windows_installdir).and_return(nil)
|
151
151
|
|
152
152
|
expect(
|
153
153
|
Puppet.default_basemodulepath
|
@@ -167,7 +167,7 @@ describe "Defaults" do
|
|
167
167
|
let(:installdir) { 'C:\Program Files\Puppet Labs\Puppet' }
|
168
168
|
|
169
169
|
it 'includes the default vendormoduledir' do
|
170
|
-
allow(
|
170
|
+
allow(Facter).to receive(:value).with(:env_windows_installdir).and_return(installdir)
|
171
171
|
|
172
172
|
expect(
|
173
173
|
Puppet.default_vendormoduledir
|
@@ -175,7 +175,7 @@ describe "Defaults" do
|
|
175
175
|
end
|
176
176
|
|
177
177
|
it 'is nil if installdir fact is missing' do
|
178
|
-
allow(
|
178
|
+
allow(Facter).to receive(:value).with(:env_windows_installdir).and_return(nil)
|
179
179
|
|
180
180
|
expect(Puppet.default_vendormoduledir).to be_nil
|
181
181
|
end
|
@@ -45,15 +45,6 @@ CONF
|
|
45
45
|
subject.upload
|
46
46
|
end
|
47
47
|
|
48
|
-
it "passes the current environment" do
|
49
|
-
env = Puppet::Node::Environment.remote('qa')
|
50
|
-
expect(model.indirection).to receive(:save).with(anything, nil, :environment => env)
|
51
|
-
|
52
|
-
Puppet.override(:current_environment => env) do
|
53
|
-
subject.upload
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
48
|
it "uses settings from the agent section of puppet.conf" do
|
58
49
|
expect(facter_terminus).to receive(:find).with(have_attributes(key: 'puppet.node.test')).and_return(test_data)
|
59
50
|
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'puppet_spec/files'
|
3
3
|
|
4
4
|
require 'puppet/face'
|
5
|
+
require 'puppet/application/parser'
|
5
6
|
|
6
7
|
describe Puppet::Face[:parser, :current] do
|
7
8
|
include PuppetSpec::Files
|
@@ -9,6 +10,12 @@ describe Puppet::Face[:parser, :current] do
|
|
9
10
|
let(:parser) { Puppet::Face[:parser, :current] }
|
10
11
|
|
11
12
|
context "validate" do
|
13
|
+
let(:validate_app) do
|
14
|
+
Puppet::Application::Parser.new.tap do |app|
|
15
|
+
allow(app).to receive(:action).and_return(parser.get_action(:validate))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
12
19
|
context "from an interactive terminal" do
|
13
20
|
before :each do
|
14
21
|
from_an_interactive_terminal
|
@@ -25,14 +32,17 @@ describe Puppet::Face[:parser, :current] do
|
|
25
32
|
|
26
33
|
configured_environment = Puppet::Node::Environment.create(:default, [], manifest)
|
27
34
|
Puppet.override(:current_environment => configured_environment) do
|
28
|
-
|
35
|
+
parse_errors = parser.validate()
|
36
|
+
|
37
|
+
expect(parse_errors[manifest]).to be_a_kind_of(Puppet::ParseErrorWithIssue)
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
32
41
|
it "validates the given file" do
|
33
42
|
manifest = file_containing('site.pp', "{ invalid =>")
|
43
|
+
parse_errors = parser.validate(manifest)
|
34
44
|
|
35
|
-
expect
|
45
|
+
expect(parse_errors[manifest]).to be_a_kind_of(Puppet::ParseErrorWithIssue)
|
36
46
|
end
|
37
47
|
|
38
48
|
it "validates static heredoc with specified syntax" do
|
@@ -40,36 +50,40 @@ describe Puppet::Face[:parser, :current] do
|
|
40
50
|
{ invalid =>
|
41
51
|
EOT
|
42
52
|
")
|
43
|
-
|
53
|
+
parse_errors = parser.validate(manifest)
|
54
|
+
|
55
|
+
expect(parse_errors[manifest]).to be_a_kind_of(Puppet::ParseErrorWithIssue)
|
44
56
|
end
|
45
57
|
|
46
58
|
it "does not validates dynamic heredoc with specified syntax" do
|
47
59
|
manifest = file_containing('site.pp', "@(\"EOT\":pp)
|
48
60
|
{invalid => ${1+1}
|
49
61
|
EOT")
|
50
|
-
|
62
|
+
parse_errors = parser.validate(manifest)
|
63
|
+
|
64
|
+
expect(parse_errors).to be_empty
|
51
65
|
end
|
52
66
|
|
53
67
|
it "runs error free when there are no validation errors" do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
68
|
+
manifest = file_containing('site.pp', "notify { valid: }")
|
69
|
+
parse_errors = parser.validate(manifest)
|
70
|
+
|
71
|
+
expect(parse_errors).to be_empty
|
58
72
|
end
|
59
73
|
|
60
74
|
it "runs error free when there is a puppet function in manifest being validated" do
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
75
|
+
manifest = file_containing('site.pp', "function valid() { 'valid' } notify{ valid(): }")
|
76
|
+
parse_errors = parser.validate(manifest)
|
77
|
+
|
78
|
+
expect(parse_errors).to be_empty
|
65
79
|
end
|
66
80
|
|
67
81
|
it "runs error free when there is a type alias in a manifest that requires type resolution" do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
82
|
+
manifest = file_containing('site.pp',
|
83
|
+
"type A = String; type B = Array[A]; function valid(B $x) { $x } notify{ valid([valid]): }")
|
84
|
+
parse_errors = parser.validate(manifest)
|
85
|
+
|
86
|
+
expect(parse_errors).to be_empty
|
73
87
|
end
|
74
88
|
|
75
89
|
it "reports missing files" do
|
@@ -84,19 +98,52 @@ describe Puppet::Face[:parser, :current] do
|
|
84
98
|
env = Puppet::Node::Environment.create(:special, [])
|
85
99
|
env_loader = Puppet::Environments::Static.new(env)
|
86
100
|
Puppet.override({:environments => env_loader, :current_environment => env}) do
|
87
|
-
|
88
|
-
end
|
101
|
+
parse_errors = parser.validate(manifest)
|
89
102
|
|
90
|
-
|
103
|
+
expect(parse_errors[manifest]).to be_a_kind_of(Puppet::ParseErrorWithIssue)
|
104
|
+
end
|
91
105
|
end
|
92
|
-
|
93
106
|
end
|
94
107
|
|
95
108
|
it "validates the contents of STDIN when no files given and STDIN is not a tty" do
|
96
109
|
from_a_piped_input_of("{ invalid =>")
|
97
110
|
|
98
111
|
Puppet.override(:current_environment => Puppet::Node::Environment.create(:special, [])) do
|
99
|
-
|
112
|
+
parse_errors = parser.validate()
|
113
|
+
|
114
|
+
expect(parse_errors['STDIN']).to be_a_kind_of(Puppet::ParseErrorWithIssue)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when invoked with console output renderer" do
|
119
|
+
before(:each) do
|
120
|
+
validate_app.render_as = :console
|
121
|
+
end
|
122
|
+
|
123
|
+
it "logs errors using Puppet.log_exception" do
|
124
|
+
manifest = file_containing('test.pp', "{ invalid =>")
|
125
|
+
results = parser.validate(manifest)
|
126
|
+
|
127
|
+
results.each do |_, error|
|
128
|
+
expect(Puppet).to receive(:log_exception).with(error)
|
129
|
+
end
|
130
|
+
|
131
|
+
expect { validate_app.render(results, nil) }.to raise_error(SystemExit)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context "when invoked with --render-as=json" do
|
136
|
+
before(:each) do
|
137
|
+
validate_app.render_as = :json
|
138
|
+
end
|
139
|
+
|
140
|
+
it "outputs errors in a JSON document to stdout" do
|
141
|
+
manifest = file_containing('test.pp', "{ invalid =>")
|
142
|
+
results = parser.validate(manifest)
|
143
|
+
|
144
|
+
expected_json = /\A{.*#{Regexp.escape('"message":')}\s*#{Regexp.escape('"Syntax error at end of input"')}.*}\Z/m
|
145
|
+
|
146
|
+
expect { validate_app.render(results, nil) }.to output(expected_json).to_stdout.and raise_error(SystemExit)
|
100
147
|
end
|
101
148
|
end
|
102
149
|
end
|
@@ -50,14 +50,6 @@ describe Puppet::Face[:plugin, :current] do
|
|
50
50
|
expect(receive_count).to eq(3)
|
51
51
|
expect(render(result)).to eq('Downloaded these plugins: /a, /b, /c')
|
52
52
|
end
|
53
|
-
|
54
|
-
it "uses persistent HTTP pool" do
|
55
|
-
allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
|
56
|
-
expect(Puppet.lookup(:http_pool)).to be_instance_of(Puppet::Network::HTTP::Pool)
|
57
|
-
end.and_return([])
|
58
|
-
|
59
|
-
pluginface.download
|
60
|
-
end
|
61
53
|
end
|
62
54
|
|
63
55
|
context "download when server_agent_version is 5.3.3" do
|
@@ -223,7 +223,7 @@ describe "Puppet::FileSystem" do
|
|
223
223
|
expect do
|
224
224
|
Puppet::FileSystem.exclusive_open(file, 0666, 'a', 0.1) do |f|
|
225
225
|
end
|
226
|
-
end.to raise_error(Timeout::Error)
|
226
|
+
end.to raise_error(Timeout::Error, /Timeout waiting for exclusive lock on #{file}/)
|
227
227
|
|
228
228
|
Process.kill(9, child)
|
229
229
|
end
|
@@ -1089,4 +1089,33 @@ describe "Puppet::FileSystem" do
|
|
1089
1089
|
end
|
1090
1090
|
end
|
1091
1091
|
end
|
1092
|
+
|
1093
|
+
context '#touch' do
|
1094
|
+
let(:dest) { tmpfile('touch_file') }
|
1095
|
+
|
1096
|
+
it 'creates a file' do
|
1097
|
+
Puppet::FileSystem.touch(dest)
|
1098
|
+
|
1099
|
+
expect(File).to be_file(dest)
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
it 'updates the mtime for an existing file' do
|
1103
|
+
Puppet::FileSystem.touch(dest)
|
1104
|
+
|
1105
|
+
now = Time.now
|
1106
|
+
allow(Time).to receive(:now).and_return(now)
|
1107
|
+
|
1108
|
+
Puppet::FileSystem.touch(dest)
|
1109
|
+
|
1110
|
+
expect(File.mtime(dest)).to be_within(1).of(now)
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
it 'allows the mtime to be passed in' do
|
1114
|
+
tomorrow = Time.now + (24 * 60 * 60)
|
1115
|
+
|
1116
|
+
Puppet::FileSystem.touch(dest, mtime: tomorrow)
|
1117
|
+
|
1118
|
+
expect(File.mtime(dest)).to be_within(1).of(tomorrow)
|
1119
|
+
end
|
1120
|
+
end
|
1092
1121
|
end
|
@@ -97,8 +97,10 @@ describe Puppet::Forge do
|
|
97
97
|
def mock_proxy(port, proxy_args, result, &block)
|
98
98
|
http = double("http client")
|
99
99
|
proxy = double("http proxy")
|
100
|
+
proxy_class = double("http proxy class")
|
100
101
|
|
101
|
-
expect(Net::HTTP).to receive(:
|
102
|
+
expect(Net::HTTP).to receive(:Proxy).with(*proxy_args).and_return(proxy_class)
|
103
|
+
expect(proxy_class).to receive(:new).with(host, port).and_return(proxy)
|
102
104
|
|
103
105
|
expect(proxy).to receive(:open_timeout=)
|
104
106
|
expect(proxy).to receive(:read_timeout=)
|
@@ -234,8 +234,10 @@ describe Puppet::Forge::Repository do
|
|
234
234
|
def mock_proxy(port, proxy_args, result, &block)
|
235
235
|
http = double("http client")
|
236
236
|
proxy = double("http proxy")
|
237
|
+
proxy_class = double("http proxy class")
|
237
238
|
|
238
|
-
expect(Net::HTTP).to receive(:
|
239
|
+
expect(Net::HTTP).to receive(:Proxy).with(*proxy_args).and_return(proxy_class)
|
240
|
+
expect(proxy_class).to receive(:new).with("fake.com", port).and_return(proxy)
|
239
241
|
|
240
242
|
expect(proxy).to receive(:open_timeout=)
|
241
243
|
expect(proxy).to receive(:read_timeout=)
|
@@ -4,12 +4,6 @@ require 'matchers/resource'
|
|
4
4
|
|
5
5
|
require 'puppet/indirector/catalog/compiler'
|
6
6
|
|
7
|
-
def set_facts(fact_hash)
|
8
|
-
fact_hash.each do |key, value|
|
9
|
-
allow(Facter).to receive(:value).with(key).and_return(value)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
7
|
describe Puppet::Resource::Catalog::Compiler do
|
14
8
|
let(:compiler) { described_class.new }
|
15
9
|
let(:node_name) { "foo" }
|
@@ -22,11 +16,8 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
22
16
|
describe "when initializing" do
|
23
17
|
before do
|
24
18
|
expect(Puppet).to receive(:version).and_return(1)
|
25
|
-
|
26
|
-
|
27
|
-
'ipaddress' => "my.ip.address",
|
28
|
-
'ipaddress6' => nil
|
29
|
-
})
|
19
|
+
expect(Facter).to receive(:value).with('fqdn').and_return("my.server.com")
|
20
|
+
expect(Facter).to receive(:value).with('ipaddress').and_return("my.ip.address")
|
30
21
|
end
|
31
22
|
|
32
23
|
it "should gather data about itself" do
|
@@ -399,12 +390,9 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
399
390
|
|
400
391
|
describe "after finding nodes" do
|
401
392
|
before do
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
'ipaddress' => "my.ip.address",
|
406
|
-
'ipaddress6' => nil
|
407
|
-
})
|
393
|
+
expect(Puppet).to receive(:version).and_return(1)
|
394
|
+
expect(Facter).to receive(:value).with('fqdn').and_return("my.server.com")
|
395
|
+
expect(Facter).to receive(:value).with('ipaddress').and_return("my.ip.address")
|
408
396
|
@request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil)
|
409
397
|
allow(compiler).to receive(:compile)
|
410
398
|
allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node)
|
@@ -424,51 +412,6 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
424
412
|
expect(node).to receive(:merge).with(hash_including("serverip" => "my.ip.address"))
|
425
413
|
compiler.find(@request)
|
426
414
|
end
|
427
|
-
|
428
|
-
it "shouldn't warn if there is at least one ip fact" do
|
429
|
-
expect(node).to receive(:merge).with(hash_including("serverip" => "my.ip.address"))
|
430
|
-
compiler.find(@request)
|
431
|
-
expect(@logs).not_to be_any {|log| log.level == :warning and log.message =~ /Could not retrieve either serverip or serverip6 fact/}
|
432
|
-
end
|
433
|
-
end
|
434
|
-
|
435
|
-
describe "in an IPv6 only environment" do
|
436
|
-
before do |example|
|
437
|
-
allow(Puppet).to receive(:version).and_return(1)
|
438
|
-
set_facts({
|
439
|
-
'fqdn' => "my.server.com",
|
440
|
-
'ipaddress' => nil,
|
441
|
-
})
|
442
|
-
if example.metadata[:nil_ipv6]
|
443
|
-
set_facts({
|
444
|
-
'ipaddress6' => nil
|
445
|
-
})
|
446
|
-
else
|
447
|
-
set_facts({
|
448
|
-
'ipaddress6' => "my.ipv6.address"
|
449
|
-
})
|
450
|
-
end
|
451
|
-
@request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil)
|
452
|
-
allow(compiler).to receive(:compile)
|
453
|
-
allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node)
|
454
|
-
end
|
455
|
-
|
456
|
-
it "should populate the :serverip6 fact" do
|
457
|
-
expect(node).to receive(:merge).with(hash_including("serverip6" => "my.ipv6.address"))
|
458
|
-
compiler.find(@request)
|
459
|
-
end
|
460
|
-
|
461
|
-
it "shouldn't warn if there is at least one ip fact" do
|
462
|
-
expect(node).to receive(:merge).with(hash_including("serverip6" => "my.ipv6.address"))
|
463
|
-
compiler.find(@request)
|
464
|
-
expect(@logs).not_to be_any {|log| log.level == :warning and log.message =~ /Could not retrieve either serverip or serverip6 fact/}
|
465
|
-
end
|
466
|
-
|
467
|
-
it "should warn if there are no ip facts", :nil_ipv6 do
|
468
|
-
expect(node).to receive(:merge)
|
469
|
-
compiler.find(@request)
|
470
|
-
expect(@logs).to be_any {|log| log.level == :warning and log.message =~ /Could not retrieve either serverip or serverip6 fact/}
|
471
|
-
end
|
472
415
|
end
|
473
416
|
|
474
417
|
describe "when filtering resources" do
|
@@ -48,7 +48,7 @@ describe "Puppet::Resource::Ral" do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should convert ral resources into regular resources" do
|
51
|
-
my_resource = double("my user resource"
|
51
|
+
my_resource = double("my user resource")
|
52
52
|
my_instance = double("my user", :name => "root", :to_resource => my_resource)
|
53
53
|
|
54
54
|
expect(Puppet::Type::User).to receive(:instances).and_return([ my_instance ])
|
@@ -56,7 +56,7 @@ describe "Puppet::Resource::Ral" do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should filter results by name if there's a name in the key" do
|
59
|
-
my_resource = double("my user resource"
|
59
|
+
my_resource = double("my user resource")
|
60
60
|
allow(my_resource).to receive(:to_resource).and_return(my_resource)
|
61
61
|
allow(my_resource).to receive(:[]).with(:name).and_return("root")
|
62
62
|
|
@@ -74,11 +74,11 @@ describe "Puppet::Resource::Ral" do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should filter results by query parameters" do
|
77
|
-
wrong_resource = double("my user resource"
|
77
|
+
wrong_resource = double("my user resource")
|
78
78
|
allow(wrong_resource).to receive(:to_resource).and_return(wrong_resource)
|
79
79
|
allow(wrong_resource).to receive(:[]).with(:name).and_return("root")
|
80
80
|
|
81
|
-
my_resource = double("wrong resource"
|
81
|
+
my_resource = double("wrong resource")
|
82
82
|
allow(my_resource).to receive(:to_resource).and_return(my_resource)
|
83
83
|
allow(my_resource).to receive(:[]).with(:name).and_return("bob")
|
84
84
|
|
@@ -82,7 +82,7 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
|
|
82
82
|
expect(Zlib::GzipReader).to receive(:open).with(sourcefile).and_yield(reader)
|
83
83
|
expect(minitar).to receive(:find_valid_files).with(reader).and_return([name])
|
84
84
|
entry = MockFileStatEntry.new(mode)
|
85
|
-
expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, [name]
|
85
|
+
expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, [name]).
|
86
86
|
and_yield(type, name, {:entry => entry})
|
87
87
|
entry
|
88
88
|
end
|
@@ -40,27 +40,19 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should fail if there is no environment specified" do
|
43
|
-
expect {
|
44
|
-
handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {})
|
45
|
-
}.to raise_error(bad_request_error)
|
43
|
+
expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {}) }).to raise_error(bad_request_error)
|
46
44
|
end
|
47
45
|
|
48
46
|
it "should fail if the environment is not alphanumeric" do
|
49
|
-
expect {
|
50
|
-
handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {:environment => "env ness"})
|
51
|
-
}.to raise_error(bad_request_error)
|
47
|
+
expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {:environment => "env ness"}) }).to raise_error(bad_request_error)
|
52
48
|
end
|
53
49
|
|
54
50
|
it "should fail if the indirection does not match the prefix" do
|
55
|
-
expect {
|
56
|
-
handler.uri2indirection("GET", "#{master_url_prefix}/certificate/foo", params)
|
57
|
-
}.to raise_error(bad_request_error)
|
51
|
+
expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/certificate/foo", params) }).to raise_error(bad_request_error)
|
58
52
|
end
|
59
53
|
|
60
54
|
it "should fail if the indirection does not have the correct version" do
|
61
|
-
expect {
|
62
|
-
handler.uri2indirection("GET", "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v1/node/bar", params)
|
63
|
-
}.to raise_error(bad_request_error)
|
55
|
+
expect(lambda { handler.uri2indirection("GET", "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v1/node/bar", params) }).to raise_error(bad_request_error)
|
64
56
|
end
|
65
57
|
|
66
58
|
it "should not pass a buck_path parameter through (See Bugs #13553, #13518, #13511)" do
|
@@ -84,9 +76,7 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
84
76
|
end
|
85
77
|
|
86
78
|
it "should fail if the indirection name is not alphanumeric" do
|
87
|
-
expect {
|
88
|
-
handler.uri2indirection("GET", "#{master_url_prefix}/foo ness/bar", params)
|
89
|
-
}.to raise_error(bad_request_error)
|
79
|
+
expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/foo ness/bar", params) }).to raise_error(bad_request_error)
|
90
80
|
end
|
91
81
|
|
92
82
|
it "should use the remainder of the URI as the indirection key" do
|
@@ -98,9 +88,7 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
98
88
|
end
|
99
89
|
|
100
90
|
it "should fail if no indirection key is specified" do
|
101
|
-
expect {
|
102
|
-
handler.uri2indirection("GET", "#{master_url_prefix}/node", params)
|
103
|
-
}.to raise_error(bad_request_error)
|
91
|
+
expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node", params) }).to raise_error(bad_request_error)
|
104
92
|
end
|
105
93
|
|
106
94
|
it "should choose 'find' as the indirection method if the http method is a GET and the indirection name is singular" do
|
@@ -140,9 +128,7 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
140
128
|
end
|
141
129
|
|
142
130
|
it "should fail if an indirection method cannot be picked" do
|
143
|
-
expect {
|
144
|
-
handler.uri2indirection("UPDATE", "#{master_url_prefix}/node/bar", params)
|
145
|
-
}.to raise_error(method_not_allowed_error)
|
131
|
+
expect(lambda { handler.uri2indirection("UPDATE", "#{master_url_prefix}/node/bar", params) }).to raise_error(method_not_allowed_error)
|
146
132
|
end
|
147
133
|
|
148
134
|
it "should not URI unescape the indirection key" do
|
@@ -162,10 +148,9 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
162
148
|
expect(handler).to receive(:check_authorization).with(anything,
|
163
149
|
anything,
|
164
150
|
excluding(:environment))
|
165
|
-
expect { handler.uri2indirection("GET",
|
166
|
-
|
167
|
-
|
168
|
-
}.to raise_error(not_found_error)
|
151
|
+
expect(lambda { handler.uri2indirection("GET",
|
152
|
+
"#{master_url_prefix}/node/bar",
|
153
|
+
{:environment => 'bogus'}) }).to raise_error(not_found_error)
|
169
154
|
end
|
170
155
|
|
171
156
|
it "should not URI unescape the indirection key as passed through to a call to check_authorization" do
|