puppet 6.19.1-x64-mingw32 → 6.23.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CODEOWNERS +2 -16
- data/Gemfile +3 -1
- data/Gemfile.lock +51 -40
- data/ext/osx/puppet.plist +2 -0
- data/ext/project_data.yaml +2 -2
- data/lib/puppet/application.rb +10 -6
- data/lib/puppet/application/agent.rb +12 -4
- data/lib/puppet/application/apply.rb +4 -2
- data/lib/puppet/application/device.rb +2 -0
- data/lib/puppet/application/filebucket.rb +2 -2
- data/lib/puppet/application/resource.rb +2 -1
- data/lib/puppet/application/script.rb +2 -0
- data/lib/puppet/application/ssl.rb +11 -0
- data/lib/puppet/application_support.rb +7 -0
- data/lib/puppet/configurer.rb +28 -18
- data/lib/puppet/configurer/downloader.rb +2 -1
- data/lib/puppet/defaults.rb +51 -23
- data/lib/puppet/environments.rb +54 -55
- data/lib/puppet/face/config.rb +10 -0
- data/lib/puppet/face/epp.rb +12 -2
- data/lib/puppet/face/facts.rb +158 -0
- data/lib/puppet/ffi/posix.rb +10 -0
- data/lib/puppet/ffi/posix/constants.rb +14 -0
- data/lib/puppet/ffi/posix/functions.rb +24 -0
- data/lib/puppet/file_serving/fileset.rb +14 -2
- data/lib/puppet/file_system/memory_file.rb +8 -1
- data/lib/puppet/file_system/windows.rb +2 -0
- data/lib/puppet/functions/all.rb +1 -1
- data/lib/puppet/functions/camelcase.rb +1 -1
- data/lib/puppet/functions/capitalize.rb +2 -2
- data/lib/puppet/functions/downcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +1 -0
- data/lib/puppet/functions/get.rb +5 -5
- data/lib/puppet/functions/group_by.rb +13 -5
- data/lib/puppet/functions/inline_epp.rb +1 -0
- data/lib/puppet/functions/lest.rb +1 -1
- data/lib/puppet/functions/new.rb +100 -100
- data/lib/puppet/functions/partition.rb +12 -4
- data/lib/puppet/functions/require.rb +5 -5
- data/lib/puppet/functions/sort.rb +3 -3
- data/lib/puppet/functions/tree_each.rb +7 -9
- data/lib/puppet/functions/type.rb +4 -4
- data/lib/puppet/functions/upcase.rb +2 -2
- data/lib/puppet/http/resolver/server_list.rb +15 -4
- data/lib/puppet/http/service/compiler.rb +69 -0
- data/lib/puppet/http/service/file_server.rb +2 -1
- data/lib/puppet/indirector/catalog/compiler.rb +1 -0
- data/lib/puppet/indirector/fact_search.rb +60 -0
- data/lib/puppet/indirector/facts/facter.rb +24 -3
- data/lib/puppet/indirector/facts/json.rb +27 -0
- data/lib/puppet/indirector/facts/yaml.rb +3 -58
- data/lib/puppet/indirector/file_metadata/rest.rb +1 -0
- data/lib/puppet/indirector/json.rb +5 -1
- data/lib/puppet/indirector/node/json.rb +8 -0
- data/lib/puppet/indirector/report/json.rb +34 -0
- data/lib/puppet/module_tool/applications/installer.rb +48 -2
- data/lib/puppet/module_tool/errors/shared.rb +17 -2
- data/lib/puppet/network/formats.rb +69 -1
- data/lib/puppet/network/http/factory.rb +4 -0
- data/lib/puppet/pal/pal_impl.rb +70 -17
- data/lib/puppet/parser/ast/leaf.rb +3 -2
- data/lib/puppet/parser/functions/fqdn_rand.rb +14 -6
- data/lib/puppet/parser/templatewrapper.rb +1 -1
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -3
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
- data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +13 -8
- data/lib/puppet/provider/package/apt.rb +34 -2
- data/lib/puppet/provider/package/aptitude.rb +6 -0
- data/lib/puppet/provider/package/dnfmodule.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +11 -6
- data/lib/puppet/provider/service/debian.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +14 -4
- data/lib/puppet/provider/service/windows.rb +38 -0
- data/lib/puppet/provider/user/aix.rb +2 -2
- data/lib/puppet/provider/user/directoryservice.rb +25 -12
- data/lib/puppet/provider/user/useradd.rb +62 -8
- data/lib/puppet/reference/configuration.rb +7 -6
- data/lib/puppet/settings.rb +33 -28
- data/lib/puppet/settings/alias_setting.rb +37 -0
- data/lib/puppet/settings/base_setting.rb +26 -2
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
- data/lib/puppet/type/file.rb +19 -1
- data/lib/puppet/type/file/selcontext.rb +1 -1
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/type/service.rb +18 -38
- data/lib/puppet/type/tidy.rb +21 -2
- data/lib/puppet/type/user.rb +38 -20
- data/lib/puppet/util/autoload.rb +1 -8
- data/lib/puppet/util/fact_dif.rb +81 -0
- data/lib/puppet/util/monkey_patches.rb +7 -0
- data/lib/puppet/util/posix.rb +54 -5
- data/lib/puppet/util/rubygems.rb +5 -1
- data/lib/puppet/util/selinux.rb +30 -4
- data/lib/puppet/util/windows/adsi.rb +46 -0
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/principal.rb +9 -2
- data/lib/puppet/util/windows/service.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +4 -2
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +372 -288
- data/man/man5/puppet.conf.5 +282 -254
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +90 -1
- data/man/man8/puppet-filebucket.8 +3 -3
- 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 +4 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +4 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +2 -2
- data/man/man8/puppet-ssl.8 +5 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
- data/spec/fixtures/ssl/127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/127.0.0.1.pem +52 -31
- data/spec/fixtures/ssl/bad-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +57 -35
- data/spec/fixtures/ssl/ca.pem +57 -35
- data/spec/fixtures/ssl/crl.pem +28 -18
- data/spec/fixtures/ssl/ec-key.pem +11 -11
- data/spec/fixtures/ssl/ec.pem +33 -24
- data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
- data/spec/fixtures/ssl/encrypted-key.pem +108 -58
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +28 -19
- data/spec/fixtures/ssl/intermediate-agent.pem +57 -36
- data/spec/fixtures/ssl/intermediate-crl.pem +31 -21
- data/spec/fixtures/ssl/intermediate.pem +57 -36
- data/spec/fixtures/ssl/pluto-key.pem +107 -57
- data/spec/fixtures/ssl/pluto.pem +52 -30
- data/spec/fixtures/ssl/request-key.pem +107 -57
- data/spec/fixtures/ssl/request.pem +47 -26
- data/spec/fixtures/ssl/revoked-key.pem +107 -57
- data/spec/fixtures/ssl/revoked.pem +52 -30
- data/spec/fixtures/ssl/signed-key.pem +107 -57
- data/spec/fixtures/ssl/signed.pem +52 -30
- data/spec/fixtures/ssl/tampered-cert.pem +52 -30
- data/spec/fixtures/ssl/tampered-csr.pem +47 -26
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +50 -29
- data/spec/fixtures/ssl/unknown-ca-key.pem +107 -57
- data/spec/fixtures/ssl/unknown-ca.pem +55 -33
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services_vendor_preset +9 -0
- data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
- data/spec/integration/application/agent_spec.rb +160 -3
- data/spec/integration/application/apply_spec.rb +19 -0
- data/spec/integration/application/plugin_spec.rb +1 -1
- data/spec/integration/application/resource_spec.rb +30 -0
- data/spec/integration/defaults_spec.rb +0 -7
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/http/client_spec.rb +12 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
- data/spec/integration/resource/type_collection_spec.rb +2 -6
- data/spec/integration/transaction_spec.rb +4 -9
- data/spec/integration/util/windows/adsi_spec.rb +21 -1
- data/spec/integration/util/windows/principal_spec.rb +21 -0
- data/spec/integration/util/windows/registry_spec.rb +6 -10
- data/spec/lib/puppet/test_ca.rb +2 -2
- data/spec/lib/puppet_spec/settings.rb +6 -1
- data/spec/spec_helper.rb +12 -5
- data/spec/unit/agent_spec.rb +8 -6
- data/spec/unit/application/agent_spec.rb +7 -3
- data/spec/unit/application/config_spec.rb +224 -4
- data/spec/unit/application/facts_spec.rb +482 -3
- data/spec/unit/application/filebucket_spec.rb +0 -2
- data/spec/unit/application/ssl_spec.rb +23 -0
- data/spec/unit/application_spec.rb +51 -9
- data/spec/unit/configurer/downloader_spec.rb +6 -0
- data/spec/unit/configurer_spec.rb +23 -0
- data/spec/unit/confine/feature_spec.rb +1 -1
- data/spec/unit/confine_spec.rb +8 -2
- data/spec/unit/defaults_spec.rb +36 -1
- data/spec/unit/environments_spec.rb +221 -68
- data/spec/unit/face/config_spec.rb +27 -32
- data/spec/unit/face/facts_spec.rb +4 -0
- data/spec/unit/face/node_spec.rb +0 -11
- data/spec/unit/file_serving/configuration/parser_spec.rb +0 -1
- data/spec/unit/file_serving/fileset_spec.rb +60 -0
- data/spec/unit/file_serving/metadata_spec.rb +3 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
- data/spec/unit/file_system_spec.rb +9 -0
- data/spec/unit/forge/module_release_spec.rb +2 -7
- data/spec/unit/functions/inline_epp_spec.rb +26 -1
- data/spec/unit/gettext/config_spec.rb +12 -0
- data/spec/unit/http/service/compiler_spec.rb +172 -0
- data/spec/unit/http/service_spec.rb +1 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +14 -10
- data/spec/unit/indirector/face_spec.rb +0 -1
- data/spec/unit/indirector/facts/facter_spec.rb +95 -1
- data/spec/unit/indirector/facts/json_spec.rb +255 -0
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
- data/spec/unit/indirector/indirection_spec.rb +8 -12
- data/spec/unit/indirector/key/file_spec.rb +0 -1
- data/spec/unit/indirector/node/json_spec.rb +33 -0
- data/spec/{integration/indirector/report/yaml.rb → unit/indirector/report/json_spec.rb} +13 -24
- data/spec/unit/indirector/report/yaml_spec.rb +72 -8
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
- data/spec/unit/network/authconfig_spec.rb +0 -3
- data/spec/unit/network/formats_spec.rb +41 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -9
- data/spec/unit/network/http/factory_spec.rb +19 -0
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/parser/compiler_spec.rb +3 -19
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +15 -1
- data/spec/unit/parser/resource_spec.rb +14 -8
- data/spec/unit/parser/templatewrapper_spec.rb +4 -3
- data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
- data/spec/unit/property_spec.rb +1 -0
- data/spec/unit/provider/group/groupadd_spec.rb +5 -2
- data/spec/unit/provider/nameservice_spec.rb +66 -65
- data/spec/unit/provider/package/apt_spec.rb +28 -23
- data/spec/unit/provider/package/aptitude_spec.rb +1 -1
- data/spec/unit/provider/package/base_spec.rb +6 -5
- data/spec/unit/provider/package/dnfmodule_spec.rb +10 -1
- data/spec/unit/provider/package/nim_spec.rb +42 -0
- data/spec/unit/provider/package/pacman_spec.rb +18 -12
- data/spec/unit/provider/package/pip_spec.rb +6 -11
- data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
- data/spec/unit/provider/service/init_spec.rb +1 -0
- data/spec/unit/provider/service/openwrt_spec.rb +3 -1
- data/spec/unit/provider/service/systemd_spec.rb +53 -8
- data/spec/unit/provider/service/windows_spec.rb +202 -0
- data/spec/unit/provider/user/aix_spec.rb +5 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +67 -35
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/pw_spec.rb +2 -0
- data/spec/unit/provider/user/useradd_spec.rb +71 -3
- data/spec/unit/provider_spec.rb +8 -10
- data/spec/unit/puppet_pal_catalog_spec.rb +45 -0
- data/spec/unit/resource/capability_finder_spec.rb +6 -1
- data/spec/unit/resource/catalog_spec.rb +1 -1
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +11 -10
- data/spec/unit/settings_spec.rb +419 -242
- data/spec/unit/ssl/base_spec.rb +0 -1
- data/spec/unit/ssl/host_spec.rb +0 -5
- data/spec/unit/ssl/ssl_provider_spec.rb +14 -8
- data/spec/unit/ssl/state_machine_spec.rb +19 -5
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -9
- data/spec/unit/transaction/event_manager_spec.rb +14 -11
- data/spec/unit/transaction_spec.rb +18 -11
- data/spec/unit/type/file/content_spec.rb +0 -1
- data/spec/unit/type/file/selinux_spec.rb +3 -5
- data/spec/unit/type/file_spec.rb +0 -6
- data/spec/unit/type/group_spec.rb +13 -6
- data/spec/unit/type/resources_spec.rb +7 -7
- data/spec/unit/type/service_spec.rb +60 -189
- data/spec/unit/type/tidy_spec.rb +17 -8
- data/spec/unit/type/user_spec.rb +45 -0
- data/spec/unit/type_spec.rb +2 -2
- data/spec/unit/util/at_fork_spec.rb +2 -2
- data/spec/unit/util/autoload_spec.rb +5 -1
- data/spec/unit/util/backups_spec.rb +1 -2
- data/spec/unit/util/execution_spec.rb +15 -11
- data/spec/unit/util/inifile_spec.rb +6 -14
- data/spec/unit/util/log_spec.rb +8 -7
- data/spec/unit/util/logging_spec.rb +3 -3
- data/spec/unit/util/posix_spec.rb +363 -15
- data/spec/unit/util/rubygems_spec.rb +2 -2
- data/spec/unit/util/selinux_spec.rb +163 -68
- data/spec/unit/util/storage_spec.rb +3 -1
- data/spec/unit/util/suidmanager_spec.rb +44 -41
- data/spec/unit/util/windows/sid_spec.rb +6 -0
- data/spec/unit/util_spec.rb +13 -6
- data/tasks/generate_cert_fixtures.rake +2 -2
- metadata +33 -16
- data/spec/integration/application/config_spec.rb +0 -74
- data/spec/lib/matchers/include.rb +0 -27
- data/spec/lib/matchers/include_spec.rb +0 -32
- data/spec/unit/face/catalog_spec.rb +0 -6
- data/spec/unit/face/module_spec.rb +0 -3
@@ -178,29 +178,25 @@ describe Puppet::Indirector::Indirection do
|
|
178
178
|
|
179
179
|
describe "creates a request" do
|
180
180
|
it "should create it with its name as the request's indirection name" do
|
181
|
-
expect(
|
182
|
-
@indirection.request(:funtest, "yayness")
|
181
|
+
expect(@indirection.request(:funtest, "yayness", nil).indirection_name).to eq(@indirection.name)
|
183
182
|
end
|
184
183
|
|
185
184
|
it "should require a method and key" do
|
186
|
-
|
187
|
-
|
185
|
+
request = @indirection.request(:funtest, "yayness", nil)
|
186
|
+
expect(request.method).to eq(:funtest)
|
187
|
+
expect(request.key).to eq("yayness")
|
188
188
|
end
|
189
189
|
|
190
190
|
it "should support optional arguments" do
|
191
|
-
expect(
|
192
|
-
@indirection.request(:funtest, "yayness", :one => :two)
|
191
|
+
expect(@indirection.request(:funtest, "yayness", nil, :one => :two).options).to eq(:one => :two)
|
193
192
|
end
|
194
193
|
|
195
194
|
it "should not pass options if none are supplied" do
|
196
|
-
expect(
|
197
|
-
@indirection.request(:funtest, "yayness")
|
195
|
+
expect(@indirection.request(:funtest, "yayness", nil).options).to eq({})
|
198
196
|
end
|
199
197
|
|
200
198
|
it "should return the request" do
|
201
|
-
request
|
202
|
-
expect(Puppet::Indirector::Request).to receive(:new).and_return(request)
|
203
|
-
expect(@indirection.request(:funtest, "yayness")).to equal(request)
|
199
|
+
expect(@indirection.request(:funtest, "yayness", nil)).to be_a(Puppet::Indirector::Request)
|
204
200
|
end
|
205
201
|
end
|
206
202
|
|
@@ -833,7 +829,7 @@ describe Puppet::Indirector::Indirection do
|
|
833
829
|
end
|
834
830
|
|
835
831
|
it "should not create a terminus instance until one is actually needed" do
|
836
|
-
expect(
|
832
|
+
expect(@indirection).not_to receive(:terminus)
|
837
833
|
Puppet::Indirector::Indirection.new(double('model'), :lazytest)
|
838
834
|
end
|
839
835
|
|
@@ -19,7 +19,6 @@ describe Puppet::SSL::Key::File do
|
|
19
19
|
allow(Puppet.settings).to receive(:use)
|
20
20
|
|
21
21
|
@searcher = Puppet::SSL::Key::File.new
|
22
|
-
allow(@searcher).to receive(:ca?).and_return(false)
|
23
22
|
expect(@searcher.public_key_path("whatever")).to eq(File.expand_path("/public/key/dir/whatever.pem"))
|
24
23
|
end
|
25
24
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/node'
|
3
|
+
require 'puppet/indirector/node/json'
|
4
|
+
|
5
|
+
describe Puppet::Node::Json do
|
6
|
+
describe '#save' do
|
7
|
+
subject(:indirection) { described_class.indirection }
|
8
|
+
|
9
|
+
let(:env) { Puppet::Node::Environment.create(:testing, []) }
|
10
|
+
let(:node) { Puppet::Node.new('node_name', :environment => env) }
|
11
|
+
let(:file) { File.join(Puppet[:client_datadir], "node", "node_name.json") }
|
12
|
+
|
13
|
+
before do
|
14
|
+
indirection.terminus_class = :json
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'saves the instance of the node as JSON to disk' do
|
18
|
+
indirection.save(node)
|
19
|
+
json = Puppet::FileSystem.read(file, :encoding => 'bom|utf-8')
|
20
|
+
content = Puppet::Util::Json.load(json)
|
21
|
+
expect(content["name"]).to eq('node_name')
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when node cannot be saved' do
|
25
|
+
it 'raises Errno::EISDIR' do
|
26
|
+
FileUtils.mkdir_p(file)
|
27
|
+
expect {
|
28
|
+
indirection.save(node)
|
29
|
+
}.to raise_error(Errno::EISDIR, /node_name.json/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
require 'puppet/transaction/report'
|
4
|
-
require 'puppet/indirector/report/
|
4
|
+
require 'puppet/indirector/report/json'
|
5
5
|
|
6
|
-
describe Puppet::Transaction::Report::
|
6
|
+
describe Puppet::Transaction::Report::Json do
|
7
|
+
include PuppetSpec::Files
|
7
8
|
describe '#save' do
|
8
9
|
subject(:indirection) { described_class.indirection }
|
9
10
|
|
@@ -17,19 +18,17 @@ describe Puppet::Transaction::Report::Yaml do
|
|
17
18
|
let(:file) { request.path(:me) }
|
18
19
|
|
19
20
|
before do
|
20
|
-
|
21
|
-
end
|
21
|
+
Puppet[:lastrunreport] = File.join(Puppet[:statedir], "last_run_report.json")
|
22
22
|
|
23
|
-
|
24
|
-
indirection.save(report)
|
23
|
+
indirection.terminus_class = :json
|
25
24
|
end
|
26
25
|
|
27
|
-
it 'saves the instance of the report as
|
26
|
+
it 'saves the instance of the report as JSON to disk' do
|
27
|
+
|
28
28
|
indirection.save(report)
|
29
|
-
|
30
|
-
|
31
|
-
)
|
32
|
-
expect(content.host).to eq(certname)
|
29
|
+
json = Puppet::FileSystem.read(Puppet[:lastrunreport], :encoding => 'bom|utf-8')
|
30
|
+
content = Puppet::Util::Json.load(json)
|
31
|
+
expect(content["host"]).to eq(certname)
|
33
32
|
end
|
34
33
|
|
35
34
|
it 'allows mode overwrite' do
|
@@ -37,8 +36,7 @@ describe Puppet::Transaction::Report::Yaml do
|
|
37
36
|
indirection.save(report)
|
38
37
|
|
39
38
|
if Puppet::Util::Platform.windows?
|
40
|
-
|
41
|
-
mode = Puppet::Util::Windows::Security.get_mode(file)
|
39
|
+
mode = File.stat(file).mode
|
42
40
|
else
|
43
41
|
mode = Puppet::FileSystem.stat(file).mode
|
44
42
|
end
|
@@ -62,21 +60,12 @@ describe Puppet::Transaction::Report::Yaml do
|
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
|
-
context 'when repport is invalid' do
|
66
|
-
it 'logs error' do
|
67
|
-
expect(Puppet).to receive(:send_log).with(:err, /Could not save yaml ziggy: can't dump anonymous class/)
|
68
|
-
|
69
|
-
report.configuration_version = Class.new
|
70
|
-
indirection.save(report)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
63
|
context 'when report cannot be saved' do
|
75
|
-
it 'raises
|
64
|
+
it 'raises Error' do
|
76
65
|
FileUtils.mkdir_p(file)
|
77
66
|
expect {
|
78
67
|
indirection.save(report)
|
79
|
-
}.to raise_error(Errno::EISDIR, /last_run_report.
|
68
|
+
}.to raise_error(Errno::EISDIR, /last_run_report.json/)
|
80
69
|
end
|
81
70
|
end
|
82
71
|
end
|
@@ -4,14 +4,6 @@ require 'puppet/transaction/report'
|
|
4
4
|
require 'puppet/indirector/report/yaml'
|
5
5
|
|
6
6
|
describe Puppet::Transaction::Report::Yaml do
|
7
|
-
it "should be a subclass of the Yaml terminus" do
|
8
|
-
expect(Puppet::Transaction::Report::Yaml.superclass).to equal(Puppet::Indirector::Yaml)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should have documentation" do
|
12
|
-
expect(Puppet::Transaction::Report::Yaml.doc).not_to be_nil
|
13
|
-
end
|
14
|
-
|
15
7
|
it "should be registered with the report indirection" do
|
16
8
|
indirection = Puppet::Indirector::Indirection.instance(:report)
|
17
9
|
expect(Puppet::Transaction::Report::Yaml.indirection).to equal(indirection)
|
@@ -24,4 +16,76 @@ describe Puppet::Transaction::Report::Yaml do
|
|
24
16
|
it "should unconditionally save/load from the --lastrunreport setting" do
|
25
17
|
expect(subject.path(:me)).to eq(Puppet[:lastrunreport])
|
26
18
|
end
|
19
|
+
|
20
|
+
describe '#save' do
|
21
|
+
subject(:indirection) { described_class.indirection }
|
22
|
+
|
23
|
+
let(:request) { described_class.new }
|
24
|
+
let(:certname) { 'ziggy' }
|
25
|
+
let(:report) do
|
26
|
+
report = Puppet::Transaction::Report.new
|
27
|
+
report.host = certname
|
28
|
+
report
|
29
|
+
end
|
30
|
+
let(:file) { request.path(:me) }
|
31
|
+
|
32
|
+
before do
|
33
|
+
indirection.terminus_class = :yaml
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'saves the instance of the report as YAML to disk' do
|
37
|
+
indirection.save(report)
|
38
|
+
content = Puppet::Util::Yaml.safe_load_file(
|
39
|
+
Puppet[:lastrunreport], [Puppet::Transaction::Report]
|
40
|
+
)
|
41
|
+
expect(content.host).to eq(certname)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'allows mode overwrite' do
|
45
|
+
Puppet.settings.setting(:lastrunreport).mode = '0644'
|
46
|
+
indirection.save(report)
|
47
|
+
|
48
|
+
if Puppet::Util::Platform.windows?
|
49
|
+
mode = File.stat(file).mode
|
50
|
+
else
|
51
|
+
mode = Puppet::FileSystem.stat(file).mode
|
52
|
+
end
|
53
|
+
|
54
|
+
expect(mode & 07777).to eq(0644)
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when mode is invalid' do
|
58
|
+
before do
|
59
|
+
Puppet.settings.setting(:lastrunreport).mode = '9999'
|
60
|
+
end
|
61
|
+
|
62
|
+
after do
|
63
|
+
Puppet.settings.setting(:lastrunreport).mode = '0644'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'raises Puppet::DevError ' do
|
67
|
+
expect{
|
68
|
+
indirection.save(report)
|
69
|
+
}.to raise_error(Puppet::DevError, "replace_file mode: 9999 is invalid")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when repport is invalid' do
|
74
|
+
it 'logs error' do
|
75
|
+
expect(Puppet).to receive(:send_log).with(:err, /Could not save yaml ziggy: can't dump anonymous class/)
|
76
|
+
|
77
|
+
report.configuration_version = Class.new
|
78
|
+
indirection.save(report)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'when report cannot be saved' do
|
83
|
+
it 'raises Error' do
|
84
|
+
FileUtils.mkdir_p(file)
|
85
|
+
expect {
|
86
|
+
indirection.save(report)
|
87
|
+
}.to raise_error(Errno::EISDIR, /last_run_report.yaml/)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
27
91
|
end
|
@@ -112,8 +112,8 @@ describe Puppet::Indirector, "when registering an indirection" do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should pass any provided options to the indirection during initialization" do
|
115
|
-
expect(Puppet::Indirector::Indirection).to receive(:new).with(@thingie, :first, {:
|
116
|
-
@indirection = @thingie.indirects :first, :
|
115
|
+
expect(Puppet::Indirector::Indirection).to receive(:new).with(@thingie, :first, {:doc => 'some docs', :indirected_class => 'Thingie'})
|
116
|
+
@indirection = @thingie.indirects :first, :doc => 'some docs'
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should extend the class to handle serialization" do
|
@@ -247,6 +247,21 @@ describe Puppet::ModuleTool::Applications::Installer, :unless => RUBY_PLATFORM =
|
|
247
247
|
expect(subject).to include :result => :success
|
248
248
|
graph_should_include 'pmtacceptance-mysql', nil => v('0.8.0')
|
249
249
|
end
|
250
|
+
|
251
|
+
context 'with an already installed dependency' do
|
252
|
+
before { preinstall('pmtacceptance-stdlib', '2.6.0') }
|
253
|
+
|
254
|
+
def options
|
255
|
+
super.merge(:version => '0.7.0')
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'installs given version without errors and does not change version of dependency' do
|
259
|
+
expect(subject).to include :result => :success
|
260
|
+
graph_should_include 'pmtacceptance-mysql', nil => v('0.7.0')
|
261
|
+
expect(subject[:error]).to be_nil
|
262
|
+
graph_should_include 'pmtacceptance-stdlib', v('2.6.0') => v('2.6.0')
|
263
|
+
end
|
264
|
+
end
|
250
265
|
end
|
251
266
|
|
252
267
|
context 'with a --version that cannot satisfy' do
|
@@ -258,6 +273,20 @@ describe Puppet::ModuleTool::Applications::Installer, :unless => RUBY_PLATFORM =
|
|
258
273
|
expect(subject).to include :result => :failure
|
259
274
|
end
|
260
275
|
|
276
|
+
it 'prints a detailed error containing the modules that would not be satisfied' do
|
277
|
+
graph = double(SemanticPuppet::Dependency::Graph, :modules => ['pmtacceptance-mysql'])
|
278
|
+
exception = SemanticPuppet::Dependency::UnsatisfiableGraph.new(graph)
|
279
|
+
allow(exception).to receive(:respond_to?).and_return(true)
|
280
|
+
allow(exception).to receive(:unsatisfied).and_return('pmtacceptance-mysql')
|
281
|
+
allow(SemanticPuppet::Dependency).to receive(:resolve).and_raise(exception)
|
282
|
+
|
283
|
+
expect(subject[:error]).to include(:multiline)
|
284
|
+
expect(subject[:error][:multiline]).to include("Could not install module 'pmtacceptance-mysql' (> 1.0.0)")
|
285
|
+
expect(subject[:error][:multiline]).to include("The requested version cannot satisfy one or more of the following installed modules:")
|
286
|
+
expect(subject[:error][:multiline]).to include("pmtacceptance-keystone, expects 'pmtacceptance-mysql': >=0.6.1 <1.0.0")
|
287
|
+
expect(subject[:error][:multiline]).to include("Use `puppet module install 'pmtacceptance-mysql' --ignore-dependencies` to install only this module")
|
288
|
+
end
|
289
|
+
|
261
290
|
context 'with --ignore-dependencies' do
|
262
291
|
def options
|
263
292
|
super.merge(:ignore_dependencies => true)
|
@@ -278,6 +307,43 @@ describe Puppet::ModuleTool::Applications::Installer, :unless => RUBY_PLATFORM =
|
|
278
307
|
graph_should_include 'pmtacceptance-mysql', nil => v('2.1.0')
|
279
308
|
end
|
280
309
|
end
|
310
|
+
|
311
|
+
context 'with an already installed dependency' do
|
312
|
+
let(:graph) {
|
313
|
+
double(SemanticPuppet::Dependency::Graph,
|
314
|
+
:dependencies => {
|
315
|
+
'pmtacceptance-mysql' => {
|
316
|
+
:version => '2.1.0'
|
317
|
+
}
|
318
|
+
},
|
319
|
+
:modules => ['pmtacceptance-mysql'],
|
320
|
+
:unsatisfied => 'pmtacceptance-stdlib'
|
321
|
+
)
|
322
|
+
}
|
323
|
+
|
324
|
+
let(:unsatisfiable_graph_exception) { SemanticPuppet::Dependency::UnsatisfiableGraph.new(graph) }
|
325
|
+
|
326
|
+
before do
|
327
|
+
allow(SemanticPuppet::Dependency).to receive(:resolve).and_raise(unsatisfiable_graph_exception)
|
328
|
+
allow(unsatisfiable_graph_exception).to receive(:respond_to?).and_return(true)
|
329
|
+
allow(unsatisfiable_graph_exception).to receive(:unsatisfied).and_return(graph.unsatisfied)
|
330
|
+
|
331
|
+
preinstall('pmtacceptance-stdlib', '2.6.0')
|
332
|
+
end
|
333
|
+
|
334
|
+
def options
|
335
|
+
super.merge(:version => '2.1.0')
|
336
|
+
end
|
337
|
+
|
338
|
+
it 'fails to install and outputs a multiline error containing the versions, expectations and workaround' do
|
339
|
+
expect(subject).to include :result => :failure
|
340
|
+
expect(subject[:error]).to include(:multiline)
|
341
|
+
expect(subject[:error][:multiline]).to include("Could not install module 'pmtacceptance-mysql' (v2.1.0)")
|
342
|
+
expect(subject[:error][:multiline]).to include("The requested version cannot satisfy one or more of the following installed modules:")
|
343
|
+
expect(subject[:error][:multiline]).to include("pmtacceptance-stdlib, installed: 2.6.0, expected: >= 2.2.1")
|
344
|
+
expect(subject[:error][:multiline]).to include("Use `puppet module install 'pmtacceptance-mysql' --ignore-dependencies` to install only this module")
|
345
|
+
end
|
346
|
+
end
|
281
347
|
end
|
282
348
|
end
|
283
349
|
|
@@ -6,9 +6,6 @@ describe Puppet::Network::DefaultAuthProvider do
|
|
6
6
|
before :each do
|
7
7
|
allow(Puppet::FileSystem).to receive(:stat).and_return(double('stat', :ctime => :now))
|
8
8
|
allow(Time).to receive(:now).and_return(Time.now)
|
9
|
-
|
10
|
-
allow_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:exists?).and_return(true)
|
11
|
-
# FIXME @authprovider = Puppet::Network::DefaultAuthProvider.new("dummy")
|
12
9
|
end
|
13
10
|
|
14
11
|
describe "when initializing" do
|
@@ -534,4 +534,45 @@ EOT
|
|
534
534
|
end
|
535
535
|
end
|
536
536
|
end
|
537
|
+
|
538
|
+
describe ":flat format" do
|
539
|
+
let(:flat) { Puppet::Network::FormatHandler.format(:flat) }
|
540
|
+
|
541
|
+
it "should include a flat format" do
|
542
|
+
expect(flat).to be_an_instance_of Puppet::Network::Format
|
543
|
+
end
|
544
|
+
|
545
|
+
[:intern, :intern_multiple].each do |method|
|
546
|
+
it "should not implement #{method}" do
|
547
|
+
expect { flat.send(method, String, 'blah') }.to raise_error NotImplementedError
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
context "when rendering arrays" do
|
552
|
+
{
|
553
|
+
[] => "",
|
554
|
+
[1, 2] => "0=1\n1=2\n",
|
555
|
+
["one"] => "0=one\n",
|
556
|
+
[{"one" => 1}, {"two" => 2}] => "0.one=1\n1.two=2\n",
|
557
|
+
[['something', 'for'], ['the', 'test']] => "0=[\"something\", \"for\"]\n1=[\"the\", \"test\"]\n"
|
558
|
+
}.each_pair do |input, output|
|
559
|
+
it "should render #{input.inspect} as one item per line" do
|
560
|
+
expect(flat.render(input)).to eq(output)
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
context "when rendering hashes" do
|
566
|
+
{
|
567
|
+
{} => "",
|
568
|
+
{1 => 2} => "1=2\n",
|
569
|
+
{"one" => "two"} => "one=two\n",
|
570
|
+
{[1,2] => 3, [2,3] => 5, [3,4] => 7} => "[1, 2]=3\n[2, 3]=5\n[3, 4]=7\n",
|
571
|
+
}.each_pair do |input, output|
|
572
|
+
it "should render #{input.inspect}" do
|
573
|
+
expect(flat.render(input)).to eq(output)
|
574
|
+
end
|
575
|
+
end
|
576
|
+
end
|
577
|
+
end
|
537
578
|
end
|
@@ -17,7 +17,6 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
17
17
|
before do
|
18
18
|
Puppet::IndirectorTesting.indirection.terminus_class = :memory
|
19
19
|
Puppet::IndirectorTesting.indirection.terminus.clear
|
20
|
-
allow(handler).to receive(:warn_if_near_expiration)
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "when converting a URI into a request" do
|
@@ -25,10 +24,6 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
25
24
|
let(:env_loaders) { Puppet::Environments::Static.new(environment) }
|
26
25
|
let(:params) { { :environment => "env" } }
|
27
26
|
|
28
|
-
before do
|
29
|
-
allow(handler).to receive(:handler).and_return("foo")
|
30
|
-
end
|
31
|
-
|
32
27
|
around do |example|
|
33
28
|
Puppet.override(:environments => env_loaders) do
|
34
29
|
example.run
|
@@ -180,10 +175,6 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
180
175
|
let(:environment) { Puppet::Node::Environment.create(:myenv, []) }
|
181
176
|
let(:request) { Puppet::Indirector::Request.new(:foo, :find, "with spaces", nil, :foo => :bar, :environment => environment) }
|
182
177
|
|
183
|
-
before do
|
184
|
-
allow(handler).to receive(:handler).and_return("foo")
|
185
|
-
end
|
186
|
-
|
187
178
|
it "should include the environment in the query string of the URI" do
|
188
179
|
expect(handler.class.request_to_uri(request)).to eq("#{master_url_prefix}/foo/with%20spaces?environment=myenv&foo=bar")
|
189
180
|
end
|
@@ -144,4 +144,23 @@ describe Puppet::Network::HTTP::Factory do
|
|
144
144
|
expect(conn.local_host).to eq('127.0.0.1')
|
145
145
|
end
|
146
146
|
end
|
147
|
+
|
148
|
+
context 'tls' do
|
149
|
+
it "sets the minimum version to TLS 1.0", if: RUBY_VERSION.to_f >= 2.5 do
|
150
|
+
conn = create_connection(site)
|
151
|
+
expect(conn.min_version).to eq(OpenSSL::SSL::TLS1_VERSION)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "defaults to ciphersuites providing 128 bits of security or greater" do
|
155
|
+
conn = create_connection(site)
|
156
|
+
expect(conn.ciphers).to eq("ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256")
|
157
|
+
end
|
158
|
+
|
159
|
+
it "can be restricted to TLSv1.3 ciphers" do
|
160
|
+
tls13_ciphers = "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256"
|
161
|
+
Puppet[:ciphers] = tls13_ciphers
|
162
|
+
conn = create_connection(site)
|
163
|
+
expect(conn.ciphers).to eq(tls13_ciphers)
|
164
|
+
end
|
165
|
+
end
|
147
166
|
end
|