puppet 7.21.0-x64-mingw32 → 7.22.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +48 -34
- data/Guardfile.example +1 -1
- data/ext/project_data.yaml +1 -1
- data/ext/windows/service/daemon.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +4 -1
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +2 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- 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 +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-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 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/application/agent_spec.rb +1 -1
- data/spec/unit/application/agent_spec.rb +1 -1
- data/spec/unit/application/device_spec.rb +1 -1
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/file_serving/fileset_spec.rb +14 -14
- data/spec/unit/file_system_spec.rb +3 -1
- data/spec/unit/graph/simple_graph_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +18 -3
- data/spec/unit/indirector/file_server_spec.rb +5 -5
- data/spec/unit/indirector/node/plain_spec.rb +1 -1
- data/spec/unit/provider/file/posix_spec.rb +4 -4
- data/spec/unit/provider/ldap_spec.rb +1 -1
- data/spec/unit/provider/nameservice_spec.rb +15 -15
- data/spec/unit/provider/package/aix_spec.rb +1 -1
- data/spec/unit/provider/package/nim_spec.rb +2 -2
- data/spec/unit/provider/service/bsd_spec.rb +4 -4
- data/spec/unit/provider/service/debian_spec.rb +2 -2
- data/spec/unit/provider/service/gentoo_spec.rb +20 -20
- data/spec/unit/provider/service/openbsd_spec.rb +18 -18
- data/spec/unit/provider/service/openrc_spec.rb +19 -19
- data/spec/unit/provider/service/systemd_spec.rb +22 -22
- data/spec/unit/provider/service/upstart_spec.rb +6 -6
- data/spec/unit/provider/user/aix_spec.rb +1 -1
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/openbsd_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/resource/type_spec.rb +2 -2
- data/spec/unit/ssl/base_spec.rb +1 -1
- data/spec/unit/ssl/certificate_request_spec.rb +1 -1
- data/spec/unit/ssl/certificate_spec.rb +1 -1
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/util/backups_spec.rb +1 -1
- data/spec/unit/util/filetype_spec.rb +3 -3
- data/spec/unit/util/resource_template_spec.rb +1 -1
- metadata +9 -3
@@ -153,12 +153,12 @@ describe Puppet::FileServing::Fileset do
|
|
153
153
|
top_names = %w{one two .svn CVS}
|
154
154
|
sub_names = %w{file1 file2 .svn CVS 0 false}
|
155
155
|
|
156
|
-
allow(Dir).to receive(:entries).with(path, encoding: Encoding::UTF_8).and_return(top_names)
|
156
|
+
allow(Dir).to receive(:entries).with(path, {encoding: Encoding::UTF_8}).and_return(top_names)
|
157
157
|
top_names.each do |subdir|
|
158
158
|
@files << subdir # relative path
|
159
159
|
subpath = File.join(path, subdir)
|
160
160
|
allow(Puppet::FileSystem).to receive(stat_method).with(subpath).and_return(@dirstat)
|
161
|
-
allow(Dir).to receive(:entries).with(subpath, encoding: Encoding::UTF_8).and_return(sub_names)
|
161
|
+
allow(Dir).to receive(:entries).with(subpath, {encoding: Encoding::UTF_8}).and_return(sub_names)
|
162
162
|
sub_names.each do |file|
|
163
163
|
@files << File.join(subdir, file) # relative path
|
164
164
|
subfile_path = File.join(subpath, file)
|
@@ -176,12 +176,12 @@ describe Puppet::FileServing::Fileset do
|
|
176
176
|
top_names = (1..10).map {|i| "dir_#{i}" }
|
177
177
|
sub_names = (1..100).map {|i| "file__#{i}" }
|
178
178
|
|
179
|
-
allow(Dir).to receive(:entries).with(path, encoding: Encoding::UTF_8).and_return(top_names)
|
179
|
+
allow(Dir).to receive(:entries).with(path, {encoding: Encoding::UTF_8}).and_return(top_names)
|
180
180
|
top_names.each do |subdir|
|
181
181
|
@files << subdir # relative path
|
182
182
|
subpath = File.join(path, subdir)
|
183
183
|
allow(Puppet::FileSystem).to receive(stat_method).with(subpath).and_return(@dirstat)
|
184
|
-
allow(Dir).to receive(:entries).with(subpath, encoding: Encoding::UTF_8).and_return(sub_names)
|
184
|
+
allow(Dir).to receive(:entries).with(subpath, {encoding: Encoding::UTF_8}).and_return(sub_names)
|
185
185
|
sub_names.each do |file|
|
186
186
|
@files << File.join(subdir, file) # relative path
|
187
187
|
subfile_path = File.join(subpath, file)
|
@@ -193,7 +193,7 @@ describe Puppet::FileServing::Fileset do
|
|
193
193
|
def setup_mocks_for_dir(mock_dir, base_path)
|
194
194
|
path = File.join(base_path, mock_dir.name)
|
195
195
|
allow(Puppet::FileSystem).to receive(:lstat).with(path).and_return(MockStat.new(path, true))
|
196
|
-
allow(Dir).to receive(:entries).with(path, encoding: Encoding::UTF_8).and_return(['.', '..'] + mock_dir.entries.map(&:name))
|
196
|
+
allow(Dir).to receive(:entries).with(path, {encoding: Encoding::UTF_8}).and_return(['.', '..'] + mock_dir.entries.map(&:name))
|
197
197
|
mock_dir.entries.each do |entry|
|
198
198
|
setup_mocks_for_entry(entry, path)
|
199
199
|
end
|
@@ -360,7 +360,7 @@ describe Puppet::FileServing::Fileset do
|
|
360
360
|
link_path = File.join(path, "mylink")
|
361
361
|
expect(Puppet::FileSystem).to receive(:stat).with(link_path).and_raise(Errno::ENOENT)
|
362
362
|
|
363
|
-
allow(Dir).to receive(:entries).with(path, encoding: Encoding::UTF_8).and_return(["mylink"])
|
363
|
+
allow(Dir).to receive(:entries).with(path, {encoding: Encoding::UTF_8}).and_return(["mylink"])
|
364
364
|
|
365
365
|
fileset = Puppet::FileServing::Fileset.new(path)
|
366
366
|
|
@@ -377,16 +377,16 @@ describe Puppet::FileServing::Fileset do
|
|
377
377
|
|
378
378
|
@filesets = @paths.collect do |path|
|
379
379
|
allow(Puppet::FileSystem).to receive(:lstat).with(path).and_return(double('stat', :directory? => true))
|
380
|
-
Puppet::FileServing::Fileset.new(path, :recurse => true)
|
380
|
+
Puppet::FileServing::Fileset.new(path, {:recurse => true})
|
381
381
|
end
|
382
382
|
|
383
383
|
allow(Dir).to receive(:entries).and_return([])
|
384
384
|
end
|
385
385
|
|
386
386
|
it "returns a hash of all files in each fileset with the value being the base path" do
|
387
|
-
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).and_return(%w{one uno})
|
388
|
-
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).and_return(%w{two dos})
|
389
|
-
expect(Dir).to receive(:entries).with(make_absolute("/third/path"), encoding: Encoding::UTF_8).and_return(%w{three tres})
|
387
|
+
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), {encoding: Encoding::UTF_8}).and_return(%w{one uno})
|
388
|
+
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), {encoding: Encoding::UTF_8}).and_return(%w{two dos})
|
389
|
+
expect(Dir).to receive(:entries).with(make_absolute("/third/path"), {encoding: Encoding::UTF_8}).and_return(%w{three tres})
|
390
390
|
|
391
391
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)).to eq({
|
392
392
|
"." => make_absolute("/first/path"),
|
@@ -400,15 +400,15 @@ describe Puppet::FileServing::Fileset do
|
|
400
400
|
end
|
401
401
|
|
402
402
|
it "includes the base directory from the first fileset" do
|
403
|
-
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).and_return(%w{one})
|
404
|
-
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).and_return(%w{two})
|
403
|
+
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), {encoding: Encoding::UTF_8}).and_return(%w{one})
|
404
|
+
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), {encoding: Encoding::UTF_8}).and_return(%w{two})
|
405
405
|
|
406
406
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)["."]).to eq(make_absolute("/first/path"))
|
407
407
|
end
|
408
408
|
|
409
409
|
it "uses the base path of the first found file when relative file paths conflict" do
|
410
|
-
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).and_return(%w{one})
|
411
|
-
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).and_return(%w{one})
|
410
|
+
expect(Dir).to receive(:entries).with(make_absolute("/first/path"), {encoding: Encoding::UTF_8}).and_return(%w{one})
|
411
|
+
expect(Dir).to receive(:entries).with(make_absolute("/second/path"), {encoding: Encoding::UTF_8}).and_return(%w{one})
|
412
412
|
|
413
413
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)["one"]).to eq(make_absolute("/first/path"))
|
414
414
|
end
|
@@ -819,9 +819,11 @@ describe "Puppet::FileSystem" do
|
|
819
819
|
mode = Puppet::FileSystem.stat(dir).mode
|
820
820
|
Puppet::FileSystem.chmod(0, dir)
|
821
821
|
begin
|
822
|
+
# JRuby 9.2.21.0 drops the path from the message..
|
823
|
+
message = Puppet::Util::Platform.jruby? ? /^Permission denied/ : /^Permission denied .* #{path}/
|
822
824
|
expect {
|
823
825
|
Puppet::FileSystem.unlink(path)
|
824
|
-
}.to raise_error(Errno::EACCES,
|
826
|
+
}.to raise_error(Errno::EACCES, message)
|
825
827
|
ensure
|
826
828
|
Puppet::FileSystem.chmod(mode, dir)
|
827
829
|
end
|
@@ -475,7 +475,7 @@ describe Puppet::Graph::SimpleGraph do
|
|
475
475
|
|
476
476
|
it "should write a dot file based on the passed name" do
|
477
477
|
expect(File).to receive(:open).with(@file, "w:UTF-8").and_yield(double("file", :puts => nil))
|
478
|
-
expect(@graph).to receive(:to_dot).with("name" => @name.to_s.capitalize)
|
478
|
+
expect(@graph).to receive(:to_dot).with({"name" => @name.to_s.capitalize})
|
479
479
|
Puppet[:graph] = true
|
480
480
|
@graph.write_graph(@name)
|
481
481
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'puppet/indirector/facts/facter'
|
3
3
|
|
4
|
+
class Puppet::Node::Facts::Facter::MyCollection < Hash; end
|
5
|
+
|
4
6
|
describe Puppet::Node::Facts::Facter do
|
5
7
|
FS = Puppet::FileSystem
|
6
8
|
|
@@ -87,11 +89,24 @@ describe Puppet::Node::Facts::Facter do
|
|
87
89
|
it "can exclude legacy facts" do
|
88
90
|
Puppet[:include_legacy_facts] = false
|
89
91
|
|
90
|
-
facts = Puppet::Node::Facts.new("foo")
|
91
|
-
expect(Puppet::Node::Facts).to receive(:new).and_return(facts)
|
92
92
|
expect(Puppet.runtime[:facter]).to receive(:resolve).with('')
|
93
|
+
.and_return({'kernelversion' => '1.2.3'})
|
93
94
|
|
94
|
-
@facter.find(@request)
|
95
|
+
values = @facter.find(@request).values
|
96
|
+
expect(values).to be_an_instance_of(Hash)
|
97
|
+
expect(values).to include({'kernelversion' => '1.2.3'})
|
98
|
+
end
|
99
|
+
|
100
|
+
it "can exclude legacy facts using buggy facter implementations that return a Hash subclass" do
|
101
|
+
Puppet[:include_legacy_facts] = false
|
102
|
+
|
103
|
+
collection = Puppet::Node::Facts::Facter::MyCollection["kernelversion" => '1.2.3']
|
104
|
+
expect(Puppet.runtime[:facter]).to receive(:resolve).with('')
|
105
|
+
.and_return(collection)
|
106
|
+
|
107
|
+
values = @facter.find(@request).values
|
108
|
+
expect(values).to be_an_instance_of(Hash)
|
109
|
+
expect(values).to include({'kernelversion' => '1.2.3'})
|
95
110
|
end
|
96
111
|
end
|
97
112
|
|
@@ -183,10 +183,10 @@ describe Puppet::Indirector::FileServer do
|
|
183
183
|
expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one", "two" => "/two")
|
184
184
|
|
185
185
|
one = double('one', :collect => nil)
|
186
|
-
expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
|
186
|
+
expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
|
187
187
|
|
188
188
|
two = double('two', :collect => nil)
|
189
|
-
expect(model).to receive(:new).with("/two", :relative_path => "two").and_return(two)
|
189
|
+
expect(model).to receive(:new).with("/two", {:relative_path => "two"}).and_return(two)
|
190
190
|
|
191
191
|
# order can't be guaranteed
|
192
192
|
result = indirection.search(uri)
|
@@ -205,7 +205,7 @@ describe Puppet::Indirector::FileServer do
|
|
205
205
|
expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
|
206
206
|
|
207
207
|
one = double('one', :collect => nil)
|
208
|
-
expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
|
208
|
+
expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
|
209
209
|
expect(one).to receive(:links=).with(true)
|
210
210
|
|
211
211
|
indirection.search(uri, links: true)
|
@@ -221,7 +221,7 @@ describe Puppet::Indirector::FileServer do
|
|
221
221
|
expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
|
222
222
|
|
223
223
|
one = double('one', :collect => nil)
|
224
|
-
expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
|
224
|
+
expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
|
225
225
|
|
226
226
|
expect(one).to receive(:checksum_type=).with(:checksum)
|
227
227
|
|
@@ -238,7 +238,7 @@ describe Puppet::Indirector::FileServer do
|
|
238
238
|
expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
|
239
239
|
|
240
240
|
one = double('one')
|
241
|
-
expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
|
241
|
+
expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
|
242
242
|
expect(one).to receive(:collect)
|
243
243
|
|
244
244
|
indirection.search(uri)
|
@@ -21,7 +21,7 @@ describe Puppet::Node::Plain do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should find facts if none are supplied" do
|
24
|
-
expect(Puppet::Node::Facts.indirection).to receive(:find).with(nodename, :environment => environment).and_return(indirection_facts)
|
24
|
+
expect(Puppet::Node::Facts.indirection).to receive(:find).with(nodename, {:environment => environment}).and_return(indirection_facts)
|
25
25
|
request.options.delete(:facts)
|
26
26
|
node = node_indirection.find(request)
|
27
27
|
expect(node.parameters).to include(indirection_fact_values)
|
@@ -39,7 +39,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
|
|
39
39
|
|
40
40
|
describe "#uid2name" do
|
41
41
|
it "should return the name of the user identified by the id" do
|
42
|
-
allow(Etc).to receive(:getpwuid).with(501).and_return(
|
42
|
+
allow(Etc).to receive(:getpwuid).with(501).and_return(Etc::Passwd.new('jilluser', nil, 501))
|
43
43
|
|
44
44
|
expect(provider.uid2name(501)).to eq('jilluser')
|
45
45
|
end
|
@@ -61,7 +61,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
|
|
61
61
|
|
62
62
|
describe "#name2uid" do
|
63
63
|
it "should return the id of the user if it exists" do
|
64
|
-
passwd =
|
64
|
+
passwd = Etc::Passwd.new('bobbo', nil, 502)
|
65
65
|
|
66
66
|
allow(Etc).to receive(:getpwnam).with('bobbo').and_return(passwd)
|
67
67
|
allow(Etc).to receive(:getpwuid).with(502).and_return(passwd)
|
@@ -131,7 +131,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
|
|
131
131
|
|
132
132
|
describe "#gid2name" do
|
133
133
|
it "should return the name of the group identified by the id" do
|
134
|
-
allow(Etc).to receive(:getgrgid).with(501).and_return(
|
134
|
+
allow(Etc).to receive(:getgrgid).with(501).and_return(Etc::Passwd.new('unicorns', nil, nil, 501))
|
135
135
|
|
136
136
|
expect(provider.gid2name(501)).to eq('unicorns')
|
137
137
|
end
|
@@ -153,7 +153,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
|
|
153
153
|
|
154
154
|
describe "#name2gid" do
|
155
155
|
it "should return the id of the group if it exists" do
|
156
|
-
passwd =
|
156
|
+
passwd = Etc::Passwd.new('penguins', nil, nil, 502)
|
157
157
|
|
158
158
|
allow(Etc).to receive(:getgrnam).with('penguins').and_return(passwd)
|
159
159
|
allow(Etc).to receive(:getgrgid).with(502).and_return(passwd)
|
@@ -73,7 +73,7 @@ describe Puppet::Provider::Ldap do
|
|
73
73
|
it "should create a provider with :ensure => :absent" do
|
74
74
|
expect(@manager).to receive(:find).with("one").and_return(nil)
|
75
75
|
|
76
|
-
expect(@class).to receive(:new).with(:ensure => :absent).and_return("myprovider")
|
76
|
+
expect(@class).to receive(:new).with({:ensure => :absent}).and_return("myprovider")
|
77
77
|
|
78
78
|
expect(@resource).to receive(:provider=).with("myprovider")
|
79
79
|
|
@@ -30,8 +30,8 @@ describe Puppet::Provider::NameService do
|
|
30
30
|
# These are values getpwent might give you
|
31
31
|
let :users do
|
32
32
|
[
|
33
|
-
|
34
|
-
|
33
|
+
Etc::Passwd.new('root', 'x', 0, 0),
|
34
|
+
Etc::Passwd.new('foo', 'x', 1000, 2000),
|
35
35
|
nil
|
36
36
|
]
|
37
37
|
end
|
@@ -39,13 +39,13 @@ describe Puppet::Provider::NameService do
|
|
39
39
|
# These are values getgrent might give you
|
40
40
|
let :groups do
|
41
41
|
[
|
42
|
-
|
43
|
-
|
42
|
+
Etc::Group.new('root', 'x', 0, %w{root}),
|
43
|
+
Etc::Group.new('bin', 'x', 1, %w{root bin daemon}),
|
44
44
|
nil
|
45
45
|
]
|
46
46
|
end
|
47
47
|
|
48
|
-
# A fake struct besides
|
48
|
+
# A fake struct besides Etc::Group and Etc::Passwd
|
49
49
|
let :fakestruct do
|
50
50
|
Struct.new(:foo, :bar)
|
51
51
|
end
|
@@ -82,11 +82,11 @@ describe Puppet::Provider::NameService do
|
|
82
82
|
|
83
83
|
let(:utf_8_mixed_users) {
|
84
84
|
[
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
Etc::Passwd.new('root', 'x', 0, 0),
|
86
|
+
Etc::Passwd.new('foo', 'x', 1000, 2000),
|
87
|
+
Etc::Passwd.new(utf_8_jose, utf_8_jose, 1001, 2000), # UTF-8 character
|
88
88
|
# In a UTF-8 environment, ruby will return strings labeled as UTF-8 even if they're not valid in UTF-8
|
89
|
-
|
89
|
+
Etc::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000),
|
90
90
|
nil
|
91
91
|
]
|
92
92
|
}
|
@@ -94,10 +94,10 @@ describe Puppet::Provider::NameService do
|
|
94
94
|
let(:latin_1_mixed_users) {
|
95
95
|
[
|
96
96
|
# In a LATIN-1 environment, ruby will return *all* strings labeled as LATIN-1
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
Etc::Passwd.new('root'.force_encoding(Encoding::ISO_8859_1), 'x', 0, 0),
|
98
|
+
Etc::Passwd.new('foo'.force_encoding(Encoding::ISO_8859_1), 'x', 1000, 2000),
|
99
|
+
Etc::Passwd.new(utf_8_labeled_as_latin_1_jose, utf_8_labeled_as_latin_1_jose, 1002, 2000),
|
100
|
+
Etc::Passwd.new(valid_latin1_jose, valid_latin1_jose, 1001, 2000), # UTF-8 character
|
101
101
|
nil
|
102
102
|
]
|
103
103
|
}
|
@@ -197,9 +197,9 @@ describe Puppet::Provider::NameService do
|
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should pass the Puppet::Etc :canonical_name Struct member to the constructor" do
|
200
|
-
users = [
|
200
|
+
users = [ Etc::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000), nil ]
|
201
201
|
allow(Etc).to receive(:getpwent).and_return(*users)
|
202
|
-
expect(provider.class).to receive(:new).with(:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present)
|
202
|
+
expect(provider.class).to receive(:new).with({:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present})
|
203
203
|
provider.class.instances
|
204
204
|
end
|
205
205
|
end
|
@@ -16,7 +16,7 @@ describe Puppet::Type.type(:package).provider(:aix) do
|
|
16
16
|
|
17
17
|
it "should uninstall a package" do
|
18
18
|
expect(@provider).to receive(:installp).with('-gu', 'mypackage')
|
19
|
-
expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage').and_return(nil)
|
19
|
+
expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage'}).and_return(nil)
|
20
20
|
@provider.uninstall
|
21
21
|
end
|
22
22
|
|
@@ -158,14 +158,14 @@ OUTPUT
|
|
158
158
|
it "should call installp to uninstall a bff package" do
|
159
159
|
expect(@provider).to receive(:lslpp).with("-qLc", "mypackage.foo").and_return("#bos.atm:bos.atm.atmle:7.1.2.0: : :C: :ATM LAN Emulation Client Support : : : : : : :0:0:/:1241")
|
160
160
|
expect(@provider).to receive(:installp).with("-gu", "mypackage.foo")
|
161
|
-
expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage.foo').and_return(nil)
|
161
|
+
expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage.foo'}).and_return(nil)
|
162
162
|
@provider.uninstall
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should call rpm to uninstall an rpm package" do
|
166
166
|
expect(@provider).to receive(:lslpp).with("-qLc", "mypackage.foo").and_return("cdrecord:cdrecord-1.9-6:1.9-6: : :C:R:A command line CD/DVD recording program.: :/bin/rpm -e cdrecord: : : : :0: :/opt/freeware:Wed Jun 29 09:41:32 PDT 2005")
|
167
167
|
expect(@provider).to receive(:rpm).with("-e", "mypackage.foo")
|
168
|
-
expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage.foo').and_return(nil)
|
168
|
+
expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage.foo'}).and_return(nil)
|
169
169
|
@provider.uninstall
|
170
170
|
end
|
171
171
|
end
|
@@ -94,13 +94,13 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
94
94
|
|
95
95
|
it "should use the supplied start command if specified" do
|
96
96
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
97
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
97
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
98
98
|
provider.start
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should start the serviced directly otherwise" do
|
102
102
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
103
|
-
expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
103
|
+
expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
104
104
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/rc.d/sshd')
|
105
105
|
provider.start
|
106
106
|
end
|
@@ -113,13 +113,13 @@ describe 'Puppet::Type::Service::Provider::Bsd',
|
|
113
113
|
|
114
114
|
it "should use the supplied stop command if specified" do
|
115
115
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
116
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
116
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
117
117
|
provider.stop
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should stop the serviced directly otherwise" do
|
121
121
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
122
|
-
expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
122
|
+
expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
123
123
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/rc.d/sshd')
|
124
124
|
provider.stop
|
125
125
|
end
|
@@ -87,7 +87,7 @@ describe 'Puppet::Type::Service::Provider::Debian',
|
|
87
87
|
|
88
88
|
context "when checking whether it is enabled" do
|
89
89
|
it "should execute the query command" do
|
90
|
-
expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], :failonfail => false)
|
90
|
+
expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], {:failonfail => false})
|
91
91
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
92
92
|
@provider.enabled?
|
93
93
|
end
|
@@ -104,7 +104,7 @@ describe 'Puppet::Type::Service::Provider::Debian',
|
|
104
104
|
|
105
105
|
it "should consider nonexistent services to be disabled" do
|
106
106
|
@provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist'))
|
107
|
-
expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], :failonfail => false)
|
107
|
+
expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], {:failonfail => false})
|
108
108
|
.and_return(Puppet::Util::Execution::ProcessOutput.new("", 1))
|
109
109
|
expect(@provider.enabled?).to be(:false)
|
110
110
|
end
|
@@ -79,13 +79,13 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
79
79
|
describe "#start" do
|
80
80
|
it "should use the supplied start command if specified" do
|
81
81
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
82
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
82
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
83
83
|
provider.start
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should start the service with <initscript> start otherwise" do
|
87
87
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
88
|
-
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
88
|
+
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
89
89
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
90
90
|
provider.start
|
91
91
|
end
|
@@ -94,13 +94,13 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
94
94
|
describe "#stop" do
|
95
95
|
it "should use the supplied stop command if specified" do
|
96
96
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
97
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
97
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
98
98
|
provider.stop
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should stop the service with <initscript> stop otherwise" do
|
102
102
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
103
|
-
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
103
|
+
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
104
104
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
105
105
|
provider.stop
|
106
106
|
end
|
@@ -160,27 +160,27 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
160
160
|
describe "when a special status command is specified" do
|
161
161
|
it "should use the status command from the resource" do
|
162
162
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
163
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
163
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
164
164
|
expect(provider).to receive(:execute)
|
165
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
165
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
166
166
|
.and_return(process_output)
|
167
167
|
provider.status
|
168
168
|
end
|
169
169
|
|
170
170
|
it "should return :stopped when the status command returns with a non-zero exitcode" do
|
171
171
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
172
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
172
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
173
173
|
expect(provider).to receive(:execute)
|
174
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
174
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
175
175
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
|
176
176
|
expect(provider.status).to eq(:stopped)
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should return :running when the status command returns with a zero exitcode" do
|
180
180
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
181
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
181
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
182
182
|
expect(provider).to receive(:execute)
|
183
|
-
.with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
183
|
+
.with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
184
184
|
.and_return(process_output)
|
185
185
|
expect(provider.status).to eq(:running)
|
186
186
|
end
|
@@ -189,14 +189,14 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
189
189
|
describe "when hasstatus is false" do
|
190
190
|
it "should return running if a pid can be found" do
|
191
191
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
192
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
192
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
193
193
|
expect(provider).to receive(:getpid).and_return(1000)
|
194
194
|
expect(provider.status).to eq(:running)
|
195
195
|
end
|
196
196
|
|
197
197
|
it "should return stopped if no pid can be found" do
|
198
198
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
199
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
199
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
200
200
|
expect(provider).to receive(:getpid).and_return(nil)
|
201
201
|
expect(provider.status).to eq(:stopped)
|
202
202
|
end
|
@@ -207,7 +207,7 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
207
207
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
208
208
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
209
209
|
expect(provider).to receive(:execute)
|
210
|
-
.with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
210
|
+
.with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
211
211
|
.and_return(process_output)
|
212
212
|
expect(provider.status).to eq(:running)
|
213
213
|
end
|
@@ -216,7 +216,7 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
216
216
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
217
217
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
218
218
|
expect(provider).to receive(:execute)
|
219
|
-
.with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
|
219
|
+
.with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
|
220
220
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
|
221
221
|
expect(provider.status).to eq(:stopped)
|
222
222
|
end
|
@@ -226,24 +226,24 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
|
|
226
226
|
describe "#restart" do
|
227
227
|
it "should use the supplied restart command if specified" do
|
228
228
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
229
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
230
|
-
expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
229
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
230
|
+
expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
231
231
|
provider.restart
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should restart the service with <initscript> restart if hasrestart is true" do
|
235
235
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
|
236
236
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
237
|
-
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
237
|
+
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
238
238
|
provider.restart
|
239
239
|
end
|
240
240
|
|
241
241
|
it "should restart the service with <initscript> stop/start if hasrestart is false" do
|
242
242
|
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
|
243
243
|
expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
|
244
|
-
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
245
|
-
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
246
|
-
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
|
244
|
+
expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
245
|
+
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
246
|
+
expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
|
247
247
|
provider.restart
|
248
248
|
end
|
249
249
|
end
|