serverspec 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serverspec/commands/base.rb +4 -0
- data/lib/serverspec/type/file.rb +8 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/aix/file_spec.rb +18 -0
- data/spec/darwin/file_spec.rb +18 -0
- data/spec/debian/file_spec.rb +18 -0
- data/spec/freebsd/file_spec.rb +18 -0
- data/spec/gentoo/file_spec.rb +18 -0
- data/spec/plamo/cgroup_spec.rb +1 -1
- data/spec/plamo/file_spec.rb +18 -0
- data/spec/redhat/file_spec.rb +18 -0
- data/spec/solaris/file_spec.rb +18 -0
- data/spec/solaris11/file_spec.rb +18 -0
- metadata +1 -3
- data/spec/plamo/service_spec.rb.plamo +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee22569ea7858b5dc4817a5a94c5e078cd23b978
|
4
|
+
data.tar.gz: 901515d1acf81c1fa811e25fd7ba021b85e810d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38b35ba251f384147a3dc0a98e658ed4cd56c72087be4796e3ab2fb310e90cadc179a4cd0506023393dd435684444406e39fee6f636a896557829dd2f9677ef1
|
7
|
+
data.tar.gz: c98ab2cecdb1c54fca0c3971bfddb164a5d38280fac9c0eccfbf05258e8168d172c9c36f23b5e15704ebf384b02024baf4109ededdeec10d608b20cd635cf740
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Serverspec
|
2
2
|
module Type
|
3
3
|
class File < Base
|
4
|
+
attr_accessor :content
|
5
|
+
|
4
6
|
def file?
|
5
7
|
backend.check_file(@name)
|
6
8
|
end
|
@@ -73,6 +75,12 @@ module Serverspec
|
|
73
75
|
backend.check_file_sha256checksum(@name, sha256sum)
|
74
76
|
end
|
75
77
|
|
78
|
+
def content
|
79
|
+
if @content.nil?
|
80
|
+
@content = backend.run_command(commands.get_file_content(@name))[:stdout]
|
81
|
+
end
|
82
|
+
@content
|
83
|
+
end
|
76
84
|
end
|
77
85
|
end
|
78
86
|
end
|
data/lib/serverspec/version.rb
CHANGED
data/spec/aix/file_spec.rb
CHANGED
@@ -386,3 +386,21 @@ end
|
|
386
386
|
describe file('invalid-file') do
|
387
387
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
388
388
|
end
|
389
|
+
|
390
|
+
describe file('/etc/passwd') do
|
391
|
+
let(:stdout) {<<EOF
|
392
|
+
root:x:0:0:root:/root:/bin/bash
|
393
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
394
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
395
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
396
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
397
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
398
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
399
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
400
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
401
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
402
|
+
EOF
|
403
|
+
}
|
404
|
+
|
405
|
+
its(:content) { should match /root:x:0:0/ }
|
406
|
+
end
|
data/spec/darwin/file_spec.rb
CHANGED
@@ -395,3 +395,21 @@ end
|
|
395
395
|
describe file('invalid-file') do
|
396
396
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
397
|
end
|
398
|
+
|
399
|
+
describe file('/etc/passwd') do
|
400
|
+
let(:stdout) {<<EOF
|
401
|
+
root:x:0:0:root:/root:/bin/bash
|
402
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
403
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
404
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
405
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
406
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
407
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
408
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
409
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
410
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
411
|
+
EOF
|
412
|
+
}
|
413
|
+
|
414
|
+
its(:content) { should match /root:x:0:0/ }
|
415
|
+
end
|
data/spec/debian/file_spec.rb
CHANGED
@@ -395,3 +395,21 @@ end
|
|
395
395
|
describe file('invalid-file') do
|
396
396
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
397
|
end
|
398
|
+
|
399
|
+
describe file('/etc/passwd') do
|
400
|
+
let(:stdout) {<<EOF
|
401
|
+
root:x:0:0:root:/root:/bin/bash
|
402
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
403
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
404
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
405
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
406
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
407
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
408
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
409
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
410
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
411
|
+
EOF
|
412
|
+
}
|
413
|
+
|
414
|
+
its(:content) { should match /root:x:0:0/ }
|
415
|
+
end
|
data/spec/freebsd/file_spec.rb
CHANGED
@@ -367,3 +367,21 @@ end
|
|
367
367
|
describe file('invalid-file') do
|
368
368
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
369
369
|
end
|
370
|
+
|
371
|
+
describe file('/etc/passwd') do
|
372
|
+
let(:stdout) {<<EOF
|
373
|
+
root:x:0:0:root:/root:/bin/bash
|
374
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
375
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
376
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
377
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
378
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
379
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
380
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
381
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
382
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
383
|
+
EOF
|
384
|
+
}
|
385
|
+
|
386
|
+
its(:content) { should match /root:x:0:0/ }
|
387
|
+
end
|
data/spec/gentoo/file_spec.rb
CHANGED
@@ -393,3 +393,21 @@ end
|
|
393
393
|
describe file('invalid-file') do
|
394
394
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
395
395
|
end
|
396
|
+
|
397
|
+
describe file('/etc/passwd') do
|
398
|
+
let(:stdout) {<<EOF
|
399
|
+
root:x:0:0:root:/root:/bin/bash
|
400
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
401
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
402
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
403
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
404
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
405
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
406
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
407
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
408
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
409
|
+
EOF
|
410
|
+
}
|
411
|
+
|
412
|
+
its(:content) { should match /root:x:0:0/ }
|
413
|
+
end
|
data/spec/plamo/cgroup_spec.rb
CHANGED
data/spec/plamo/file_spec.rb
CHANGED
@@ -395,3 +395,21 @@ end
|
|
395
395
|
describe file('invalid-file') do
|
396
396
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
397
|
end
|
398
|
+
|
399
|
+
describe file('/etc/passwd') do
|
400
|
+
let(:stdout) {<<EOF
|
401
|
+
root:x:0:0:root:/root:/bin/bash
|
402
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
403
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
404
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
405
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
406
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
407
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
408
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
409
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
410
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
411
|
+
EOF
|
412
|
+
}
|
413
|
+
|
414
|
+
its(:content) { should match /root:x:0:0/ }
|
415
|
+
end
|
data/spec/redhat/file_spec.rb
CHANGED
@@ -395,3 +395,21 @@ end
|
|
395
395
|
describe file('invalid-file') do
|
396
396
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
397
|
end
|
398
|
+
|
399
|
+
describe file('/etc/passwd') do
|
400
|
+
let(:stdout) {<<EOF
|
401
|
+
root:x:0:0:root:/root:/bin/bash
|
402
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
403
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
404
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
405
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
406
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
407
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
408
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
409
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
410
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
411
|
+
EOF
|
412
|
+
}
|
413
|
+
|
414
|
+
its(:content) { should match /root:x:0:0/ }
|
415
|
+
end
|
data/spec/solaris/file_spec.rb
CHANGED
@@ -393,3 +393,21 @@ end
|
|
393
393
|
describe file('invalid-file') do
|
394
394
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
395
395
|
end
|
396
|
+
|
397
|
+
describe file('/etc/passwd') do
|
398
|
+
let(:stdout) {<<EOF
|
399
|
+
root:x:0:0:root:/root:/bin/bash
|
400
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
401
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
402
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
403
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
404
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
405
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
406
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
407
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
408
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
409
|
+
EOF
|
410
|
+
}
|
411
|
+
|
412
|
+
its(:content) { should match /root:x:0:0/ }
|
413
|
+
end
|
data/spec/solaris11/file_spec.rb
CHANGED
@@ -395,3 +395,21 @@ end
|
|
395
395
|
describe file('invalid-file') do
|
396
396
|
it { should_not match_sha256checksum 'INVALIDSHA256CHECKSUM' }
|
397
397
|
end
|
398
|
+
|
399
|
+
describe file('/etc/passwd') do
|
400
|
+
let(:stdout) {<<EOF
|
401
|
+
root:x:0:0:root:/root:/bin/bash
|
402
|
+
bin:x:1:1:bin:/bin:/sbin/nologin
|
403
|
+
daemon:x:2:2:daemon:/sbin:/sbin/nologin
|
404
|
+
sync:x:5:0:sync:/sbin:/bin/sync
|
405
|
+
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
|
406
|
+
halt:x:7:0:halt:/sbin:/sbin/halt
|
407
|
+
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
|
408
|
+
operator:x:11:0:operator:/root:/sbin/nologin
|
409
|
+
nobody:x:99:99:Nobody:/:/sbin/nologin
|
410
|
+
dbus:x:81:81:System message bus:/:/sbin/nologin
|
411
|
+
EOF
|
412
|
+
}
|
413
|
+
|
414
|
+
its(:content) { should match /root:x:0:0/ }
|
415
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
@@ -305,7 +305,6 @@ files:
|
|
305
305
|
- spec/plamo/routing_table_spec.rb
|
306
306
|
- spec/plamo/selinux_spec.rb
|
307
307
|
- spec/plamo/service_spec.rb
|
308
|
-
- spec/plamo/service_spec.rb.plamo
|
309
308
|
- spec/plamo/user_spec.rb
|
310
309
|
- spec/plamo/zfs_spec.rb
|
311
310
|
- spec/redhat/cgroup_spec.rb
|
@@ -503,7 +502,6 @@ test_files:
|
|
503
502
|
- spec/plamo/routing_table_spec.rb
|
504
503
|
- spec/plamo/selinux_spec.rb
|
505
504
|
- spec/plamo/service_spec.rb
|
506
|
-
- spec/plamo/service_spec.rb.plamo
|
507
505
|
- spec/plamo/user_spec.rb
|
508
506
|
- spec/plamo/zfs_spec.rb
|
509
507
|
- spec/redhat/cgroup_spec.rb
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.configure do |c|
|
4
|
-
c.os = 'Debian'
|
5
|
-
end
|
6
|
-
|
7
|
-
describe service('sshd') do
|
8
|
-
it { should be_enabled }
|
9
|
-
its(:command) { should eq "test -x /etc/rc.d/init.d/sshd" }
|
10
|
-
end
|
11
|
-
|
12
|
-
describe service('invalid-service') do
|
13
|
-
it { should_not be_enabled }
|
14
|
-
end
|
15
|
-
|
16
|
-
describe service('sshd') do
|
17
|
-
it { should be_enabled.with_level(4) }
|
18
|
-
its(:command) { should eq "test -x /etc/rc.d/init.d/sshd" }
|
19
|
-
end
|
20
|
-
|
21
|
-
describe service('invalid-service') do
|
22
|
-
it { should_not be_enabled.with_level(4) }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe service('sshd') do
|
26
|
-
it {
|
27
|
-
expect {
|
28
|
-
should be_running.under('not implemented')
|
29
|
-
}.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
describe service('sshd') do
|
34
|
-
let(:stdout) { "Process 'sshd'\r\n status running\r\n monitoring status monitored" }
|
35
|
-
it { should be_monitored_by('monit') }
|
36
|
-
its(:command) { should eq "monit status" }
|
37
|
-
end
|
38
|
-
|
39
|
-
describe service('sshd') do
|
40
|
-
let(:stdout) { "Process 'sshd'\r\n status not monitored\r\n monitoring status not monitored" }
|
41
|
-
it { should_not be_monitored_by('monit') }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe service('invalid-daemon') do
|
45
|
-
it { should_not be_monitored_by('monit') }
|
46
|
-
end
|
47
|
-
|
48
|
-
describe service('unicorn') do
|
49
|
-
it { should be_monitored_by('god') }
|
50
|
-
its(:command) { should eq "god status unicorn" }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe service('invalid-daemon') do
|
54
|
-
it { should_not be_monitored_by('god') }
|
55
|
-
end
|
56
|
-
|
57
|
-
describe service('sshd') do
|
58
|
-
it {
|
59
|
-
expect {
|
60
|
-
should be_monitored_by('not implemented')
|
61
|
-
}.to raise_error(ArgumentError, %r/\A`be_monitored_by` matcher doesn\'t support/)
|
62
|
-
}
|
63
|
-
end
|