puppet 7.1.0-universal-darwin → 7.3.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/Gemfile.lock +15 -13
- data/lib/puppet/application/agent.rb +1 -0
- data/lib/puppet/application/apply.rb +3 -2
- data/lib/puppet/application/device.rb +1 -0
- data/lib/puppet/application/script.rb +1 -0
- data/lib/puppet/application.rb +10 -6
- data/lib/puppet/configurer.rb +16 -3
- data/lib/puppet/defaults.rb +5 -14
- data/lib/puppet/face/facts.rb +15 -1
- data/lib/puppet/file_serving/configuration/parser.rb +5 -2
- 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 +67 -0
- data/lib/puppet/parser/ast/leaf.rb +3 -2
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +4 -0
- data/lib/puppet/reference/configuration.rb +6 -5
- data/lib/puppet/settings/alias_setting.rb +37 -0
- data/lib/puppet/settings.rb +33 -28
- data/lib/puppet/util/autoload.rb +1 -8
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +157 -141
- data/man/man5/puppet.conf.5 +6 -6
- 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 +5 -2
- 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-lookup.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 +2 -2
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
- data/spec/integration/application/agent_spec.rb +127 -3
- data/spec/integration/application/apply_spec.rb +19 -0
- data/spec/integration/defaults_spec.rb +0 -7
- data/spec/integration/indirector/file_content/file_server_spec.rb +0 -2
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +0 -2
- 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 +3 -1
- data/spec/integration/util/windows/registry_spec.rb +0 -10
- data/spec/spec_helper.rb +1 -4
- data/spec/unit/agent_spec.rb +8 -6
- data/spec/unit/application/agent_spec.rb +0 -1
- data/spec/unit/application/filebucket_spec.rb +0 -2
- data/spec/unit/application_spec.rb +17 -9
- data/spec/unit/confine/feature_spec.rb +1 -1
- data/spec/unit/confine_spec.rb +8 -2
- data/spec/unit/face/node_spec.rb +0 -11
- data/spec/unit/file_serving/configuration/parser_spec.rb +8 -1
- data/spec/unit/file_serving/metadata_spec.rb +3 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
- data/spec/unit/forge/module_release_spec.rb +2 -7
- data/spec/unit/indirector/face_spec.rb +0 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -5
- 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_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
- data/spec/unit/network/formats_spec.rb +41 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -4
- data/spec/unit/parser/compiler_spec.rb +3 -19
- data/spec/unit/parser/resource_spec.rb +14 -8
- data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
- data/spec/unit/property_spec.rb +1 -0
- data/spec/unit/provider/nameservice_spec.rb +66 -65
- data/spec/unit/provider/package/apt_spec.rb +4 -8
- data/spec/unit/provider/package/base_spec.rb +6 -5
- 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/user/hpux_spec.rb +1 -1
- data/spec/unit/provider_spec.rb +6 -8
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +11 -10
- data/spec/unit/settings_spec.rb +13 -6
- data/spec/unit/ssl/base_spec.rb +0 -1
- data/spec/unit/ssl/ssl_provider_spec.rb +5 -2
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
- data/spec/unit/transaction/event_manager_spec.rb +14 -11
- data/spec/unit/transaction_spec.rb +13 -4
- data/spec/unit/type/file/content_spec.rb +0 -1
- data/spec/unit/type/file/selinux_spec.rb +0 -2
- 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 +1 -1
- data/spec/unit/type/tidy_spec.rb +0 -1
- 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 +16 -10
- data/spec/unit/util/selinux_spec.rb +76 -52
- data/spec/unit/util/suidmanager_spec.rb +44 -41
- data/spec/unit/util_spec.rb +13 -6
- metadata +7 -2
@@ -11,12 +11,8 @@ describe Puppet::Resource::TypeCollection do
|
|
11
11
|
@dir = tmpfile("autoload_testing")
|
12
12
|
FileUtils.mkdir_p @dir
|
13
13
|
|
14
|
-
loader =
|
15
|
-
|
16
|
-
allow(loader).to receive(:set_entry)
|
17
|
-
|
18
|
-
loaders = Object.new
|
19
|
-
expect(loaders).to receive(:runtime3_type_loader).at_most(:once).and_return(loader)
|
14
|
+
loader = double('loader', load: nil, set_entry: nil)
|
15
|
+
loaders = double('loaders', runtime3_type_loader: loader)
|
20
16
|
expect(Puppet::Pops::Loaders).to receive(:loaders).at_most(:once).and_return(loaders)
|
21
17
|
|
22
18
|
environment = Puppet::Node::Environment.create(:env, [@dir])
|
@@ -61,7 +61,7 @@ describe Puppet::Transaction do
|
|
61
61
|
|
62
62
|
transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
|
63
63
|
|
64
|
-
expect(resource).not_to receive(:
|
64
|
+
expect(resource).not_to receive(:retrieve)
|
65
65
|
|
66
66
|
transaction.evaluate
|
67
67
|
end
|
@@ -86,7 +86,7 @@ describe Puppet::Transaction do
|
|
86
86
|
|
87
87
|
transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new)
|
88
88
|
|
89
|
-
expect(resource).not_to receive(:
|
89
|
+
expect(resource).not_to receive(:retrieve)
|
90
90
|
|
91
91
|
transaction.evaluate
|
92
92
|
end
|
@@ -315,16 +315,14 @@ describe Puppet::Transaction do
|
|
315
315
|
file1 = tmpfile("file1")
|
316
316
|
file2 = tmpfile("file2")
|
317
317
|
|
318
|
+
expect(Puppet::FileSystem).to_not be_exist(file2)
|
319
|
+
|
318
320
|
exec1 = Puppet::Type.type(:exec).new(
|
319
321
|
:name => "exec1",
|
320
322
|
:path => ENV["PATH"],
|
321
323
|
:command => touch(file1),
|
322
324
|
)
|
323
325
|
|
324
|
-
allow(exec1).to receive(:eval_generate).and_return(
|
325
|
-
[ Puppet::Type.type(:notify).new(:name => "eval1_notify") ]
|
326
|
-
)
|
327
|
-
|
328
326
|
exec2 = Puppet::Type.type(:exec).new(
|
329
327
|
:name => "exec2",
|
330
328
|
:path => ENV["PATH"],
|
@@ -332,9 +330,6 @@ describe Puppet::Transaction do
|
|
332
330
|
:refreshonly => true,
|
333
331
|
:subscribe => exec1,
|
334
332
|
)
|
335
|
-
allow(exec2).to receive(:eval_generate).and_return(
|
336
|
-
[ Puppet::Type.type(:notify).new(:name => "eval2_notify") ]
|
337
|
-
)
|
338
333
|
|
339
334
|
Puppet[:tags] = "exec"
|
340
335
|
catalog = mk_catalog(exec1, exec2)
|
@@ -157,7 +157,9 @@ describe Puppet::Util::Windows::ADSI::Group,
|
|
157
157
|
|
158
158
|
# touch the native_object member to have it lazily loaded, so COM objects can be stubbed
|
159
159
|
admins.native_object
|
160
|
-
|
160
|
+
without_partial_double_verification do
|
161
|
+
allow(admins.native_object).to receive(:Members).and_return(members)
|
162
|
+
end
|
161
163
|
|
162
164
|
# well-known NULL SID
|
163
165
|
expect(admins.members[0].sid).to eq('S-1-0-0')
|
@@ -146,16 +146,6 @@ describe Puppet::Util::Windows::Registry do
|
|
146
146
|
utf_8_bytes = ENDASH_UTF_8 + TM_UTF_8
|
147
147
|
utf_8_str = utf_8_bytes.pack('c*').force_encoding(Encoding::UTF_8)
|
148
148
|
|
149
|
-
# this problematic Ruby codepath triggers a conversion of UTF-16LE to
|
150
|
-
# a local codepage which can totally break when that codepage has no
|
151
|
-
# conversion from the given UTF-16LE characters to local codepage
|
152
|
-
# a prime example is that IBM437 has no conversion from a Unicode en-dash
|
153
|
-
expect(Win32::Registry).not_to receive(:export_string)
|
154
|
-
|
155
|
-
# also, expect that we're using our variants of keys / values, not Rubys
|
156
|
-
expect(Win32::Registry).not_to receive(:each_key)
|
157
|
-
expect(Win32::Registry).not_to receive(:each_value)
|
158
|
-
|
159
149
|
hklm.create("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_ALL_ACCESS | regsam) do |reg|
|
160
150
|
reg.write("#{guid}", Win32::Registry::REG_SZ, utf_16_str)
|
161
151
|
|
data/spec/spec_helper.rb
CHANGED
@@ -84,10 +84,7 @@ RSpec.configure do |config|
|
|
84
84
|
config.filter_run_when_matching :focus
|
85
85
|
|
86
86
|
config.mock_with :rspec do |mocks|
|
87
|
-
|
88
|
-
# need to go through and fix those tests first before it can be enabled
|
89
|
-
# for real.
|
90
|
-
mocks.verify_partial_doubles = false
|
87
|
+
mocks.verify_partial_doubles = true
|
91
88
|
end
|
92
89
|
|
93
90
|
tmpdir = Puppet::FileSystem.expand_path(Dir.mktmpdir("rspecrun"))
|
data/spec/unit/agent_spec.rb
CHANGED
@@ -3,9 +3,13 @@ require 'puppet/agent'
|
|
3
3
|
require 'puppet/configurer'
|
4
4
|
|
5
5
|
class AgentTestClient
|
6
|
-
def
|
6
|
+
def initialize(transaction_uuid = nil, job_id = nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
def run(client_args)
|
7
10
|
# no-op
|
8
11
|
end
|
12
|
+
|
9
13
|
def stop
|
10
14
|
# no-op
|
11
15
|
end
|
@@ -49,11 +53,10 @@ describe Puppet::Agent do
|
|
49
53
|
|
50
54
|
it "should create an instance of its client class and run it when asked to run" do
|
51
55
|
client = double('client')
|
52
|
-
|
53
|
-
|
54
|
-
expect(client).to receive(:run)
|
56
|
+
allow(AgentTestClient).to receive(:new).with(nil, nil).and_return(client)
|
55
57
|
|
56
58
|
allow(@agent).to receive(:disabled?).and_return(false)
|
59
|
+
expect(client).to receive(:run)
|
57
60
|
@agent.run
|
58
61
|
end
|
59
62
|
|
@@ -90,7 +93,6 @@ describe Puppet::Agent do
|
|
90
93
|
|
91
94
|
describe "when being run" do
|
92
95
|
before do
|
93
|
-
allow(AgentTestClient).to receive(:lockfile_path).and_return("/my/lock")
|
94
96
|
allow(@agent).to receive(:disabled?).and_return(false)
|
95
97
|
end
|
96
98
|
|
@@ -186,7 +188,7 @@ describe Puppet::Agent do
|
|
186
188
|
allow(lockfile).to receive(:lock).and_return(false)
|
187
189
|
end
|
188
190
|
|
189
|
-
it "should notify that a run is already in
|
191
|
+
it "should notify that a run is already in progress" do
|
190
192
|
client = AgentTestClient.new
|
191
193
|
expect(AgentTestClient).to receive(:new).and_return(client)
|
192
194
|
expect(Puppet).to receive(:notice).with(/Run of .* already in progress; skipping .* exists/)
|
@@ -202,7 +202,6 @@ describe Puppet::Application::Agent do
|
|
202
202
|
allow(Puppet::Resource::Catalog.indirection).to receive(:terminus_class=)
|
203
203
|
allow(Puppet::Resource::Catalog.indirection).to receive(:cache_class=)
|
204
204
|
allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=)
|
205
|
-
allow(Puppet).to receive(:settraps)
|
206
205
|
end
|
207
206
|
|
208
207
|
it "should not run with extra arguments" do
|
@@ -42,7 +42,6 @@ describe Puppet::Application::Filebucket do
|
|
42
42
|
describe "during setup" do
|
43
43
|
before :each do
|
44
44
|
allow(Puppet::Log).to receive(:newdestination)
|
45
|
-
allow(Puppet).to receive(:settraps)
|
46
45
|
allow(Puppet::FileBucket::Dipper).to receive(:new)
|
47
46
|
allow(@filebucket.options).to receive(:[])
|
48
47
|
end
|
@@ -159,7 +158,6 @@ describe Puppet::Application::Filebucket do
|
|
159
158
|
describe "when running" do
|
160
159
|
before :each do
|
161
160
|
allow(Puppet::Log).to receive(:newdestination)
|
162
|
-
allow(Puppet).to receive(:settraps)
|
163
161
|
allow(Puppet::FileBucket::Dipper).to receive(:new)
|
164
162
|
allow(@filebucket.options).to receive(:[])
|
165
163
|
|
@@ -7,8 +7,10 @@ require 'timeout'
|
|
7
7
|
|
8
8
|
describe Puppet::Application do
|
9
9
|
before(:each) do
|
10
|
-
@
|
11
|
-
|
10
|
+
@appclass = Class.new(Puppet::Application) do
|
11
|
+
def handle_unknown(opt, arg); end
|
12
|
+
end
|
13
|
+
@app = @appclass.new
|
12
14
|
|
13
15
|
allow(@app).to receive(:name).and_return("test_app")
|
14
16
|
end
|
@@ -594,13 +596,6 @@ describe Puppet::Application do
|
|
594
596
|
end
|
595
597
|
|
596
598
|
it "should raise an error if dispatch returns no command" do
|
597
|
-
allow(@app).to receive(:get_command).and_return(nil)
|
598
|
-
expect(Puppet).to receive(:send_log).with(:err, "Could not run: No valid command or main")
|
599
|
-
expect { @app.run }.to exit_with 1
|
600
|
-
end
|
601
|
-
|
602
|
-
it "should raise an error if dispatch returns an invalid command" do
|
603
|
-
allow(@app).to receive(:get_command).and_return(:this_function_doesnt_exist)
|
604
599
|
expect(Puppet).to receive(:send_log).with(:err, "Could not run: No valid command or main")
|
605
600
|
expect { @app.run }.to exit_with 1
|
606
601
|
end
|
@@ -718,5 +713,18 @@ describe Puppet::Application do
|
|
718
713
|
|
719
714
|
@app.handle_logdest_arg(nil)
|
720
715
|
end
|
716
|
+
|
717
|
+
it "accepts multiple destinations as a comma sepparated list" do
|
718
|
+
dest1 = '/tmp/path1'
|
719
|
+
dest2 = 'console'
|
720
|
+
dest3 = '/tmp/path2'
|
721
|
+
dest_args = [dest1, dest2, dest3].join(' , ')
|
722
|
+
|
723
|
+
[dest1, dest2, dest3].each do |dest|
|
724
|
+
expect(Puppet::Util::Log).to receive(:newdestination).with(dest)
|
725
|
+
end
|
726
|
+
|
727
|
+
@app.handle_logdest_arg(dest_args)
|
728
|
+
end
|
721
729
|
end
|
722
730
|
end
|
data/spec/unit/confine_spec.rb
CHANGED
@@ -2,6 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
require 'puppet/confine'
|
4
4
|
|
5
|
+
class Puppet::TestConfine < Puppet::Confine
|
6
|
+
def pass?(value)
|
7
|
+
false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
describe Puppet::Confine do
|
6
12
|
it "should require a value" do
|
7
13
|
expect { Puppet::Confine.new }.to raise_error(ArgumentError)
|
@@ -33,7 +39,7 @@ describe Puppet::Confine do
|
|
33
39
|
|
34
40
|
describe "when testing all values" do
|
35
41
|
before do
|
36
|
-
@confine = Puppet::
|
42
|
+
@confine = Puppet::TestConfine.new(%w{a b c})
|
37
43
|
@confine.label = "foo"
|
38
44
|
end
|
39
45
|
|
@@ -64,7 +70,7 @@ describe Puppet::Confine do
|
|
64
70
|
end
|
65
71
|
|
66
72
|
describe "when testing the result of the values" do
|
67
|
-
before { @confine = Puppet::
|
73
|
+
before { @confine = Puppet::TestConfine.new(%w{a b c d}) }
|
68
74
|
|
69
75
|
it "should return an array with the result of the test for each value" do
|
70
76
|
allow(@confine).to receive(:pass?).and_return(true)
|
data/spec/unit/face/node_spec.rb
CHANGED
@@ -15,13 +15,6 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe 'when running #clean' do
|
18
|
-
before :each do
|
19
|
-
allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=)
|
20
|
-
allow(Puppet::Node::Facts.indirection).to receive(:cache_class=)
|
21
|
-
allow(Puppet::Node).to receive(:terminus_class=)
|
22
|
-
allow(Puppet::Node).to receive(:cache_class=)
|
23
|
-
end
|
24
|
-
|
25
18
|
it 'should invoke #cleanup' do
|
26
19
|
expect(subject).to receive(:cleanup).with('hostname')
|
27
20
|
subject.clean('hostname')
|
@@ -30,10 +23,6 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
30
23
|
|
31
24
|
describe "clean action" do
|
32
25
|
before :each do
|
33
|
-
allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=)
|
34
|
-
allow(Puppet::Node::Facts.indirection).to receive(:cache_class=)
|
35
|
-
allow(Puppet::Node).to receive(:terminus_class=)
|
36
|
-
allow(Puppet::Node).to receive(:cache_class=)
|
37
26
|
allow(subject).to receive(:cleanup)
|
38
27
|
end
|
39
28
|
|
@@ -87,7 +87,6 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
87
87
|
before do
|
88
88
|
@mount = double('testmount', :name => "one", :validate => true)
|
89
89
|
expect(Puppet::FileServing::Mount::File).to receive(:new).with("one").and_return(@mount)
|
90
|
-
allow(@parser).to receive(:add_modules_mount)
|
91
90
|
end
|
92
91
|
|
93
92
|
it "should set the mount path to the path attribute from that section" do
|
@@ -122,6 +121,14 @@ describe Puppet::FileServing::Configuration::Parser do
|
|
122
121
|
end
|
123
122
|
}
|
124
123
|
|
124
|
+
it "should not generate an error when parsing 'allow *'" do
|
125
|
+
write_config_file "[one]\nallow *\n"
|
126
|
+
|
127
|
+
expect(Puppet).to receive(:err).never
|
128
|
+
|
129
|
+
@parser.parse
|
130
|
+
end
|
131
|
+
|
125
132
|
it "should return comprehensible error message, if failed on invalid attribute" do
|
126
133
|
write_config_file "[one]\ndo something\n"
|
127
134
|
|
@@ -266,9 +266,9 @@ describe Puppet::FileServing::Metadata, :uses_checksums => true do
|
|
266
266
|
path = tmpfile('bar')
|
267
267
|
FileUtils.touch(path)
|
268
268
|
|
269
|
-
allow(Puppet::Util::Windows::Security).to receive(:get_owner).with(path
|
270
|
-
allow(Puppet::Util::Windows::Security).to receive(:get_group).with(path
|
271
|
-
allow(Puppet::Util::Windows::Security).to receive(:get_mode).with(path
|
269
|
+
allow(Puppet::Util::Windows::Security).to receive(:get_owner).with(path).and_raise(invalid_error)
|
270
|
+
allow(Puppet::Util::Windows::Security).to receive(:get_group).with(path).and_raise(invalid_error)
|
271
|
+
allow(Puppet::Util::Windows::Security).to receive(:get_mode).with(path).and_raise(invalid_error)
|
272
272
|
|
273
273
|
stat = Puppet::FileSystem.stat(path)
|
274
274
|
|
@@ -2,13 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
require 'puppet/file_serving/terminus_helper'
|
4
4
|
|
5
|
+
class Puppet::FileServing::TestHelper
|
6
|
+
include Puppet::FileServing::TerminusHelper
|
7
|
+
|
8
|
+
attr_reader :model
|
9
|
+
|
10
|
+
def initialize(model)
|
11
|
+
@model = model
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
describe Puppet::FileServing::TerminusHelper do
|
6
16
|
before do
|
7
|
-
@helper = Object.new
|
8
|
-
@helper.extend(Puppet::FileServing::TerminusHelper)
|
9
|
-
|
10
17
|
@model = double('model')
|
11
|
-
|
18
|
+
@helper = Puppet::FileServing::TestHelper.new(@model)
|
12
19
|
|
13
20
|
@request = double('request', :key => "url", :options => {})
|
14
21
|
|
@@ -22,13 +22,8 @@ describe Puppet::Forge::ModuleRelease do
|
|
22
22
|
let(:uri) { " "}
|
23
23
|
let(:release) { Puppet::Forge::ModuleRelease.new(ssl_repository, JSON.parse(release_json)) }
|
24
24
|
|
25
|
-
let(:mock_file) {
|
26
|
-
|
27
|
-
allow(mock_io).to receive(:path).and_return('/dev/null')
|
28
|
-
mock_io
|
29
|
-
}
|
30
|
-
|
31
|
-
let(:mock_dir) { '/tmp' }
|
25
|
+
let(:mock_file) { double('file', path: '/dev/null') }
|
26
|
+
let(:mock_dir) { tmpdir('dir') }
|
32
27
|
|
33
28
|
let(:destination) { tmpfile('forge_module_release') }
|
34
29
|
|
@@ -33,7 +33,6 @@ describe Puppet::Indirector::Face do
|
|
33
33
|
describe "as an instance" do
|
34
34
|
it "should be able to determine its indirection" do
|
35
35
|
# Loading actions here can get, um, complicated
|
36
|
-
allow(Puppet::Face).to receive(:load_actions)
|
37
36
|
expect(Puppet::Indirector::Face.new(:catalog, '0.0.1').indirection).to equal(Puppet::Resource::Catalog.indirection)
|
38
37
|
end
|
39
38
|
end
|
@@ -22,7 +22,6 @@ describe Puppet::Node::Facts::Facter do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
before :each do
|
25
|
-
allow(Puppet::Node::Facts::Facter).to receive(:reload_facter)
|
26
25
|
@facter = Puppet::Node::Facts::Facter.new
|
27
26
|
allow(Facter).to receive(:to_hash).and_return({})
|
28
27
|
@name = "me"
|
@@ -154,19 +153,17 @@ describe Puppet::Node::Facts::Facter do
|
|
154
153
|
end
|
155
154
|
|
156
155
|
describe 'when :resolve_options is true' do
|
157
|
-
let(:options) { { resolve_options: true, user_query: ["os", "timezone"]
|
156
|
+
let(:options) { { resolve_options: true, user_query: ["os", "timezone"] } }
|
158
157
|
let(:facts) { Puppet::Node::Facts.new("foo") }
|
159
158
|
|
160
159
|
before :each do
|
161
160
|
allow(@request).to receive(:options).and_return(options)
|
162
161
|
allow(Puppet::Node::Facts).to receive(:new).and_return(facts)
|
163
|
-
allow(Facter).to receive(:respond_to?).and_return(false)
|
164
|
-
allow(Facter).to receive(:respond_to?).with(:resolve).and_return(true)
|
165
162
|
allow(facts).to receive(:add_local_facts)
|
166
163
|
end
|
167
164
|
|
168
165
|
it 'should call Facter.resolve method' do
|
169
|
-
expect(Facter).to receive(:resolve).with("os timezone
|
166
|
+
expect(Facter).to receive(:resolve).with("os timezone")
|
170
167
|
@facter.find(@request)
|
171
168
|
end
|
172
169
|
|
@@ -176,6 +173,15 @@ describe Puppet::Node::Facts::Facter do
|
|
176
173
|
@facter.find(@request)
|
177
174
|
end
|
178
175
|
|
176
|
+
context 'when --show-legacy flag is present' do
|
177
|
+
let(:options) { { resolve_options: true, user_query: ["os", "timezone"], show_legacy: true } }
|
178
|
+
|
179
|
+
it 'should call Facter.resolve method with show-legacy' do
|
180
|
+
expect(Facter).to receive(:resolve).with("os timezone --show-legacy")
|
181
|
+
@facter.find(@request)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
179
185
|
describe 'when Facter version is lower than 4.0.40' do
|
180
186
|
before :each do
|
181
187
|
allow(Facter).to receive(:respond_to?).and_return(false)
|
@@ -5,22 +5,40 @@ require 'puppet/indirector/file_bucket_file/file'
|
|
5
5
|
require 'puppet/indirector/file_bucket_file/rest'
|
6
6
|
|
7
7
|
describe Puppet::FileBucketFile::Selector do
|
8
|
+
let(:model) { Puppet::FileBucket::File.new('') }
|
9
|
+
let(:indirection) { Puppet::FileBucket::File.indirection }
|
10
|
+
let(:terminus) { indirection.terminus(:selector) }
|
11
|
+
|
8
12
|
%w[head find save search destroy].each do |method|
|
9
13
|
describe "##{method}" do
|
10
14
|
it "should proxy to rest terminus for https requests" do
|
11
|
-
|
15
|
+
key = "https://example.com/path/to/file"
|
12
16
|
|
13
|
-
|
17
|
+
expect(indirection.terminus(:rest)).to receive(method)
|
14
18
|
|
15
|
-
|
19
|
+
if method == 'save'
|
20
|
+
terminus.send(method, indirection.request(method, key, model))
|
21
|
+
else
|
22
|
+
terminus.send(method, indirection.request(method, key, nil))
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
it "should proxy to file terminus for other requests" do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
key = "file:///path/to/file"
|
28
|
+
|
29
|
+
case method
|
30
|
+
when 'save'
|
31
|
+
expect(indirection.terminus(:file)).to receive(method)
|
32
|
+
terminus.send(method, indirection.request(method, key, model))
|
33
|
+
when 'find', 'head'
|
34
|
+
expect(indirection.terminus(:file)).to receive(method)
|
35
|
+
terminus.send(method, indirection.request(method, key, nil))
|
36
|
+
else
|
37
|
+
# file terminus doesn't implement search or destroy
|
38
|
+
expect {
|
39
|
+
terminus.send(method, indirection.request(method, key, nil))
|
40
|
+
}.to raise_error(NoMethodError)
|
41
|
+
end
|
24
42
|
end
|
25
43
|
end
|
26
44
|
end
|
@@ -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
|
|
@@ -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
|
|