serverspec 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -35,16 +35,6 @@ Select number: 1
35
35
 
36
36
  Input target host name: www.example.jp
37
37
 
38
- Select OS type of target host:
39
-
40
- 1) Auto Detect
41
- 2) Red Hat
42
- 3) Debian
43
- 4) Gentoo
44
- 5) Solaris
45
-
46
- Select number: 1
47
-
48
38
  + spec/
49
39
  + spec/www.example.jp/
50
40
  + spec/www.example.jp/httpd_spec.rb
@@ -57,17 +47,20 @@ spec/www.example.jp/httpd_spec.rb is a sample spec file and its content is like
57
47
  ```ruby
58
48
  require 'spec_helper'
59
49
 
60
- describe 'httpd' do
50
+ describe package('httpd)' do
61
51
  it { should be_installed }
52
+ end
53
+
54
+ describe service('httpd') do
62
55
  it { should be_enabled }
63
56
  it { should be_running }
64
57
  end
65
58
 
66
- describe 'port 80' do
59
+ describe port(80) do
67
60
  it { should be_listening }
68
61
  end
69
62
 
70
- describe '/etc/httpd/conf/httpd.conf' do
63
+ describe file('/etc/httpd/conf/httpd.conf') do
71
64
  it { should be_file }
72
65
  it { should contain "ServerName www.example.jp" }
73
66
  end
@@ -19,7 +19,7 @@ module Serverspec
19
19
  end
20
20
 
21
21
  def check_routing_table destination
22
- "ip route | grep -E '^#{destination} |^default '"
22
+ "/sbin/ip route | grep -E '^#{destination} |^default '"
23
23
  end
24
24
 
25
25
  def check_reachable host, port, proto, timeout
@@ -66,7 +66,7 @@ module Serverspec
66
66
  end
67
67
 
68
68
  def check_running service
69
- "service #{escape(service)} status"
69
+ "/sbin/service #{escape(service)} status"
70
70
  end
71
71
 
72
72
  def check_running_under_supervisor service
@@ -10,7 +10,7 @@ module Serverspec
10
10
  end
11
11
 
12
12
  def check_iptables_rule rule, table=nil, chain=nil
13
- cmd = "iptables"
13
+ cmd = "/sbin/iptables"
14
14
  cmd += " -t #{escape(table)}" if table
15
15
  cmd += " -S"
16
16
  cmd += " #{escape(chain)}" if chain
@@ -3,11 +3,11 @@ module Serverspec
3
3
  class RedHat < Linux
4
4
  def check_access_by_user file, user, access
5
5
  # Redhat-specific
6
- "runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
6
+ "/sbin/runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
7
7
  end
8
8
 
9
9
  def check_enabled service
10
- "chkconfig --list #{escape(service)} | grep 3:on"
10
+ "/sbin/chkconfig --list #{escape(service)} | grep 3:on"
11
11
  end
12
12
 
13
13
  def check_installed package
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  describe 'check_routing_table' do
31
31
  subject { commands.check_routing_table('192.168.100.0/24') }
32
- it { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
32
+ it { should eq "/sbin/ip route | grep -E '^192.168.100.0/24 |^default '" }
33
33
  end
34
34
 
35
35
  describe 'check_resolvable' do
@@ -69,7 +69,7 @@ end
69
69
 
70
70
  describe 'check_running' do
71
71
  subject { commands.check_running('httpd') }
72
- it { should eq 'service httpd status' }
72
+ it { should eq '/sbin/service httpd status' }
73
73
  end
74
74
 
75
75
  describe 'check_running_under_supervisor' do
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  describe 'check_routing_table' do
21
21
  subject { commands.check_routing_table('192.168.100.0/24') }
22
- it { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
22
+ it { should eq "/sbin/ip route | grep -E '^192.168.100.0/24 |^default '" }
23
23
  end
24
24
 
25
25
  describe 'check_reachable' do
@@ -85,7 +85,7 @@ end
85
85
 
86
86
  describe 'check_running' do
87
87
  subject { commands.check_running('httpd') }
88
- it { should eq 'service httpd status' }
88
+ it { should eq '/sbin/service httpd status' }
89
89
  end
90
90
 
91
91
 
@@ -209,12 +209,12 @@ end
209
209
  describe 'check_ipatbles' do
210
210
  context 'check a rule without a table and a chain' do
211
211
  subject { commands.check_iptables_rule('-P INPUT ACCEPT') }
212
- it { should eq "iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
212
+ it { should eq "/sbin/iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
213
213
  end
214
214
 
215
215
  context 'chack a rule with a table and a chain' do
216
216
  subject { commands.check_iptables_rule('-P INPUT ACCEPT', 'mangle', 'INPUT') }
217
- it { should eq "iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
217
+ it { should eq "/sbin/iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
218
218
  end
219
219
  end
220
220
 
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  describe 'check_routing_table' do
21
21
  subject { commands.check_routing_table('192.168.100.0/24') }
22
- it { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
22
+ it { should eq "/sbin/ip route | grep -E '^192.168.100.0/24 |^default '" }
23
23
  end
24
24
 
25
25
  describe 'check_reachable' do
@@ -207,12 +207,12 @@ end
207
207
  describe 'check_ipatbles' do
208
208
  context 'check a rule without a table and a chain' do
209
209
  subject { commands.check_iptables_rule('-P INPUT ACCEPT') }
210
- it { should eq "iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
210
+ it { should eq "/sbin/iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
211
211
  end
212
212
 
213
213
  context 'chack a rule with a table and a chain' do
214
214
  subject { commands.check_iptables_rule('-P INPUT ACCEPT', 'mangle', 'INPUT') }
215
- it { should eq "iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
215
+ it { should eq "/sbin/iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
216
216
  end
217
217
  end
218
218
 
@@ -4,7 +4,7 @@ include Serverspec::Helper::RedHat
4
4
 
5
5
  describe 'check_enabled' do
6
6
  subject { commands.check_enabled('httpd') }
7
- it { should eq 'chkconfig --list httpd | grep 3:on' }
7
+ it { should eq '/sbin/chkconfig --list httpd | grep 3:on' }
8
8
  end
9
9
 
10
10
  describe 'check_file' do
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  describe 'check_routing_table' do
21
21
  subject { commands.check_routing_table('192.168.100.0/24') }
22
- it { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
22
+ it { should eq "/sbin/ip route | grep -E '^192.168.100.0/24 |^default '" }
23
23
  end
24
24
 
25
25
  describe 'check_reachable' do
@@ -79,7 +79,7 @@ end
79
79
 
80
80
  describe 'check_running' do
81
81
  subject { commands.check_running('httpd') }
82
- it { should eq 'service httpd status' }
82
+ it { should eq '/sbin/service httpd status' }
83
83
  end
84
84
 
85
85
  describe 'check_running_under_supervisor' do
@@ -207,12 +207,12 @@ end
207
207
  describe 'check_ipatbles' do
208
208
  context 'check a rule without a table and a chain' do
209
209
  subject { commands.check_iptables_rule('-P INPUT ACCEPT') }
210
- it { should eq "iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
210
+ it { should eq "/sbin/iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
211
211
  end
212
212
 
213
213
  context 'chack a rule with a table and a chain' do
214
214
  subject { commands.check_iptables_rule('-P INPUT ACCEPT', 'mangle', 'INPUT') }
215
- it { should eq "iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
215
+ it { should eq "/sbin/iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
216
216
  end
217
217
  end
218
218
 
@@ -241,16 +241,16 @@ end
241
241
  describe 'check_access_by_user' do
242
242
  context 'read access' do
243
243
  subject {commands.check_access_by_user '/tmp/something', 'dummyuser1', 'r'}
244
- it { should eq 'runuser -s /bin/sh -c "test -r /tmp/something" dummyuser1' }
244
+ it { should eq '/sbin/runuser -s /bin/sh -c "test -r /tmp/something" dummyuser1' }
245
245
  end
246
246
 
247
247
  context 'write access' do
248
248
  subject {commands.check_access_by_user '/tmp/somethingw', 'dummyuser2', 'w'}
249
- it { should eq 'runuser -s /bin/sh -c "test -w /tmp/somethingw" dummyuser2' }
249
+ it { should eq '/sbin/runuser -s /bin/sh -c "test -w /tmp/somethingw" dummyuser2' }
250
250
  end
251
251
 
252
252
  context 'execute access' do
253
253
  subject {commands.check_access_by_user '/tmp/somethingx', 'dummyuser3', 'x'}
254
- it { should eq 'runuser -s /bin/sh -c "test -x /tmp/somethingx" dummyuser3' }
254
+ it { should eq '/sbin/runuser -s /bin/sh -c "test -x /tmp/somethingx" dummyuser3' }
255
255
  end
256
256
  end
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  describe 'check_routing_table' do
21
21
  subject { commands.check_routing_table('192.168.100.0/24') }
22
- it { should eq "ip route | grep -E '^192.168.100.0/24 |^default '" }
22
+ it { should eq "/sbin/ip route | grep -E '^192.168.100.0/24 |^default '" }
23
23
  end
24
24
 
25
25
  describe 'check_reachable' do
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.4.7
4
+ version: 0.4.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-19 00:00:00.000000000 Z
12
+ date: 2013-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh