serverspec 0.6.28 → 0.6.29

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.
@@ -17,7 +17,11 @@ module Serverspec
17
17
  end
18
18
 
19
19
  def check_selinux(mode)
20
- "getenforce | grep -i -- #{escape(mode)} && grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
20
+ cmd = ""
21
+ cmd += "test ! -f /etc/selinux/config || " if mode == "disabled"
22
+ cmd += "(getenforce | grep -i -- #{escape(mode)} "
23
+ cmd += "&& grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config)"
24
+ cmd
21
25
  end
22
26
 
23
27
  def check_kernel_module_loaded(name)
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.6.28"
2
+ VERSION = "0.6.29"
3
3
  end
@@ -4,15 +4,15 @@ include Serverspec::Helper::Debian
4
4
 
5
5
  describe selinux do
6
6
  it { should be_enforcing }
7
- its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
7
+ its(:command) { should eq "(getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config)" }
8
8
  end
9
9
 
10
10
  describe selinux do
11
11
  it { should be_permissive }
12
- its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
12
+ its(:command) { should eq "(getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config)" }
13
13
  end
14
14
 
15
15
  describe selinux do
16
16
  it { should be_disabled }
17
- its(:command) { should eq "getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config" }
17
+ its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
18
18
  end
@@ -4,15 +4,15 @@ include Serverspec::Helper::Gentoo
4
4
 
5
5
  describe selinux do
6
6
  it { should be_enforcing }
7
- its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
7
+ its(:command) { should eq "(getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config)" }
8
8
  end
9
9
 
10
10
  describe selinux do
11
11
  it { should be_permissive }
12
- its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
12
+ its(:command) { should eq "(getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config)" }
13
13
  end
14
14
 
15
15
  describe selinux do
16
16
  it { should be_disabled }
17
- its(:command) { should eq "getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config" }
17
+ its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
18
18
  end
@@ -4,15 +4,15 @@ include Serverspec::Helper::RedHat
4
4
 
5
5
  describe selinux do
6
6
  it { should be_enforcing }
7
- its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
7
+ its(:command) { should eq "(getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config)" }
8
8
  end
9
9
 
10
10
  describe selinux do
11
11
  it { should be_permissive }
12
- its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
12
+ its(:command) { should eq "(getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config)" }
13
13
  end
14
14
 
15
15
  describe selinux do
16
16
  it { should be_disabled }
17
- its(:command) { should eq "getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config" }
17
+ its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
18
18
  end
@@ -4,4 +4,5 @@ include Serverspec::Helper::Solaris
4
4
 
5
5
  describe ipfilter do
6
6
  it { should have_rule 'pass in quick on lo0 all' }
7
+ its(:command) { should eq "ipfstat -io 2> /dev/null | grep -- pass\\ in\\ quick\\ on\\ lo0\\ all" }
7
8
  end
@@ -4,4 +4,5 @@ include Serverspec::Helper::Solaris
4
4
 
5
5
  describe ipnat do
6
6
  it { should have_rule 'map net1 192.168.0.0/24 -> 0.0.0.0/32' }
7
+ its(:command) { should eq "ipnat -l 2> /dev/null | grep -- \\^map\\ net1\\ 192.168.0.0/24\\ -\\>\\ 0.0.0.0/32\\$" }
7
8
  end
@@ -4,5 +4,10 @@ include Serverspec::Helper::Solaris
4
4
 
5
5
  describe service('svc:/network/http:apache22') do
6
6
  it { should have_property 'httpd/enable_64bit' => false }
7
+ its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$" }
8
+ end
9
+
10
+ describe service('svc:/network/http:apache22') do
7
11
  it { should have_property 'httpd/enable_64bit' => false, 'httpd/server_type' => 'worker' }
12
+ its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep -- \\^worker\\$" }
8
13
  end
@@ -4,6 +4,15 @@ include Serverspec::Helper::Solaris
4
4
 
5
5
  describe zfs('rpool') do
6
6
  it { should exist }
7
+ its(:command) { should eq "zfs list -H rpool" }
8
+ end
9
+
10
+ describe zfs('rpool') do
7
11
  it { should have_property 'mountpoint' => '/rpool' }
12
+ its(:command) { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
13
+ end
14
+
15
+ describe zfs('rpool') do
8
16
  it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
17
+ its(:command) { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
9
18
  end
@@ -4,4 +4,5 @@ include Serverspec::Helper::Solaris11
4
4
 
5
5
  describe ipfilter do
6
6
  it { should have_rule 'pass in quick on lo0 all' }
7
+ its(:command) { should eq "ipfstat -io 2> /dev/null | grep -- pass\\ in\\ quick\\ on\\ lo0\\ all" }
7
8
  end
@@ -4,4 +4,5 @@ include Serverspec::Helper::Solaris11
4
4
 
5
5
  describe ipnat do
6
6
  it { should have_rule 'map net1 192.168.0.0/24 -> 0.0.0.0/32' }
7
+ its(:command) { should eq "ipnat -l 2> /dev/null | grep -- \\^map\\ net1\\ 192.168.0.0/24\\ -\\>\\ 0.0.0.0/32\\$" }
7
8
  end
@@ -4,5 +4,10 @@ include Serverspec::Helper::Solaris11
4
4
 
5
5
  describe service('svc:/network/http:apache22') do
6
6
  it { should have_property 'httpd/enable_64bit' => false }
7
+ its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$" }
8
+ end
9
+
10
+ describe service('svc:/network/http:apache22') do
7
11
  it { should have_property 'httpd/enable_64bit' => false, 'httpd/server_type' => 'worker' }
12
+ its(:command) { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep -- \\^worker\\$" }
8
13
  end
@@ -4,6 +4,15 @@ include Serverspec::Helper::Solaris11
4
4
 
5
5
  describe zfs('rpool') do
6
6
  it { should exist }
7
+ its(:command) { should eq "zfs list -H rpool" }
8
+ end
9
+
10
+ describe zfs('rpool') do
7
11
  it { should have_property 'mountpoint' => '/rpool' }
12
+ its(:command) { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
13
+ end
14
+
15
+ describe zfs('rpool') do
8
16
  it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
17
+ its(:command) { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
9
18
  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.6.28
4
+ version: 0.6.29
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-07-07 00:00:00.000000000 Z
12
+ date: 2013-07-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh
@@ -287,7 +287,6 @@ files:
287
287
  - spec/redhat/yumrepo_spec.rb
288
288
  - spec/smartos/commands_spec.rb
289
289
  - spec/solaris/command_spec.rb
290
- - spec/solaris/commands_spec.rb
291
290
  - spec/solaris/cron_spec.rb
292
291
  - spec/solaris/default_gateway_spec.rb
293
292
  - spec/solaris/file_spec.rb
@@ -306,7 +305,6 @@ files:
306
305
  - spec/solaris10/commands_spec.rb
307
306
  - spec/solaris10/php_config_spec.rb
308
307
  - spec/solaris11/command_spec.rb
309
- - spec/solaris11/commands_spec.rb
310
308
  - spec/solaris11/cron_spec.rb
311
309
  - spec/solaris11/default_gateway_spec.rb
312
310
  - spec/solaris11/file_spec.rb
@@ -419,7 +417,6 @@ test_files:
419
417
  - spec/redhat/yumrepo_spec.rb
420
418
  - spec/smartos/commands_spec.rb
421
419
  - spec/solaris/command_spec.rb
422
- - spec/solaris/commands_spec.rb
423
420
  - spec/solaris/cron_spec.rb
424
421
  - spec/solaris/default_gateway_spec.rb
425
422
  - spec/solaris/file_spec.rb
@@ -438,7 +435,6 @@ test_files:
438
435
  - spec/solaris10/commands_spec.rb
439
436
  - spec/solaris10/php_config_spec.rb
440
437
  - spec/solaris11/command_spec.rb
441
- - spec/solaris11/commands_spec.rb
442
438
  - spec/solaris11/cron_spec.rb
443
439
  - spec/solaris11/default_gateway_spec.rb
444
440
  - spec/solaris11/file_spec.rb
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::Solaris
4
-
5
- describe 'check_zfs' do
6
- context 'check without properties' do
7
- subject { commands.check_zfs('rpool') }
8
- it { should eq "zfs list -H rpool" }
9
- end
10
-
11
- context 'check with a property' do
12
- subject { commands.check_zfs('rpool', { 'mountpoint' => '/rpool' }) }
13
- it { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
14
- end
15
-
16
- context 'check with multiple properties' do
17
- subject { commands.check_zfs('rpool', { 'mountpoint' => '/rpool', 'compression' => 'off' }) }
18
- it { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
19
- end
20
- end
21
-
22
- describe 'check_ip_filter_rule' do
23
- subject { commands.check_ipfilter_rule('pass in quick on lo0 all') }
24
- it { should eq "ipfstat -io 2> /dev/null | grep -- pass\\ in\\ quick\\ on\\ lo0\\ all" }
25
- end
26
-
27
- describe 'check_ipnat_rule' do
28
- subject { commands.check_ipnat_rule('map net1 192.168.0.0/24 -> 0.0.0.0/32') }
29
- it { should eq "ipnat -l 2> /dev/null | grep -- \\^map\\ net1\\ 192.168.0.0/24\\ -\\>\\ 0.0.0.0/32\\$" }
30
- end
31
-
32
- describe 'check_svcprop' do
33
- subject { commands.check_svcprop('svc:/network/http:apache22', 'httpd/enable_64bit','false') }
34
- it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$" }
35
- end
36
-
37
- describe 'check_svcprops' do
38
- subject {
39
- commands.check_svcprops('svc:/network/http:apache22', {
40
- 'httpd/enable_64bit' => 'false',
41
- 'httpd/server_type' => 'worker',
42
- })
43
- }
44
- it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep -- \\^worker\\$" }
45
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::Solaris11
4
-
5
- describe 'check_zfs' do
6
- context 'check without properties' do
7
- subject { commands.check_zfs('rpool') }
8
- it { should eq "zfs list -H rpool" }
9
- end
10
-
11
- context 'check with a property' do
12
- subject { commands.check_zfs('rpool', { 'mountpoint' => '/rpool' }) }
13
- it { should eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
14
- end
15
-
16
- context 'check with multiple properties' do
17
- subject { commands.check_zfs('rpool', { 'mountpoint' => '/rpool', 'compression' => 'off' }) }
18
- it { should eq "zfs list -H -o compression rpool | grep -- \\^off\\$ && zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
19
- end
20
- end
21
-
22
- describe 'check_ip_filter_rule' do
23
- subject { commands.check_ipfilter_rule('pass in quick on lo0 all') }
24
- it { should eq "ipfstat -io 2> /dev/null | grep -- pass\\ in\\ quick\\ on\\ lo0\\ all" }
25
- end
26
-
27
- describe 'check_ipnat_rule' do
28
- subject { commands.check_ipnat_rule('map net1 192.168.0.0/24 -> 0.0.0.0/32') }
29
- it { should eq "ipnat -l 2> /dev/null | grep -- \\^map\\ net1\\ 192.168.0.0/24\\ -\\>\\ 0.0.0.0/32\\$" }
30
- end
31
-
32
- describe 'check_svcprop' do
33
- subject { commands.check_svcprop('svc:/network/http:apache22', 'httpd/enable_64bit','false') }
34
- it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$" }
35
- end
36
-
37
- describe 'check_svcprops' do
38
- subject {
39
- commands.check_svcprops('svc:/network/http:apache22', {
40
- 'httpd/enable_64bit' => 'false',
41
- 'httpd/server_type' => 'worker',
42
- })
43
- }
44
- it { should eq "svcprop -p httpd/enable_64bit svc:/network/http:apache22 | grep -- \\^false\\$ && svcprop -p httpd/server_type svc:/network/http:apache22 | grep -- \\^worker\\$" }
45
- end