serverspec 0.9.3 → 0.9.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d7cceefe09064845e7a6da397251424940101ba
4
- data.tar.gz: a6e7cf0a8df6575ea55afeb06d1ff3ff634e1282
3
+ metadata.gz: 7db443421700dfdacefd2e30f55e0d7fa0351361
4
+ data.tar.gz: a2853fb2095bb792edee67cd39bf82c920406182
5
5
  SHA512:
6
- metadata.gz: fce59959e6ff6e867ba1dc68d9ac9fed31ebc3a13fa9bdd1e7e7e2bdc35eeca3b8257af8ec26301f095fbeedad66e5cac932594788bb3d1d6bfd224ff59af31c
7
- data.tar.gz: 3ee39b8c1308dc4f16072e976cb2dd4b8242dc62464ca205a877f24b179f18b077f9f5c2c53880672513108807d5864afc878fd39cf6480871f71ca30fc0b813
6
+ metadata.gz: 7a577e8153713fee9665b849583edf38eb74bad7759947ac73d1f4e0886a1028b7e0fb2d16cd36602f25f95de83220971be524e1d6a97e78cf441185b254e6d7
7
+ data.tar.gz: eae422a0ad172a6f68bb2974f219a688b03c28714b27fe451ecc104163cd350ee817e07420bba86c3c3922fe797d1297cc9228ca272e3e53d3fcf077f8cc8e64
@@ -167,7 +167,7 @@ module Serverspec
167
167
  elsif run_command('ls /etc/gentoo-release')[:exit_status] == 0
168
168
  'Gentoo'
169
169
  elsif run_command('uname -s')[:stdout] =~ /AIX/i
170
- 'Aix'
170
+ 'AIX'
171
171
  elsif (os = run_command('uname -sr')[:stdout]) && os =~ /SunOS/i
172
172
  if os =~ /5.10/
173
173
  'Solaris10'
@@ -2,7 +2,7 @@ require 'shellwords'
2
2
 
3
3
  module Serverspec
4
4
  module Commands
5
- class Aix < Base
5
+ class AIX < Base
6
6
  class NotImplementedError < Exception; end
7
7
 
8
8
  def check_access_by_user(file, user, access)
@@ -1,8 +1,8 @@
1
1
  module Serverspec
2
2
  module Helper
3
- module Aix
3
+ module AIX
4
4
  def commands
5
- Serverspec::Commands::Aix.new
5
+ Serverspec::Commands::AIX.new
6
6
  end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
data/lib/serverspec.rb CHANGED
@@ -37,7 +37,7 @@ RSpec.configure do |c|
37
37
  c.include(Serverspec::Helper::RedHat, :os => :redhat)
38
38
  c.include(Serverspec::Helper::Debian, :os => :debian)
39
39
  c.include(Serverspec::Helper::Gentoo, :os => :gentoo)
40
- c.include(Serverspec::Helper::Aix, :os => :aix)
40
+ c.include(Serverspec::Helper::AIX, :os => :aix)
41
41
  c.include(Serverspec::Helper::Solaris, :os => :solaris)
42
42
  c.include(Serverspec::Helper::Solaris10, :os => :solaris10)
43
43
  c.include(Serverspec::Helper::Solaris11, :os => :solaris11)
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe command('cat /etc/resolv.conf') do
6
6
  let(:stdout) { "nameserver 127.0.0.1\r\n" }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe cron do
6
6
  it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe default_gateway do
6
6
  let(:stdout) { "default via 192.168.1.1 dev eth1 \r\n" }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe file('/etc/ssh/sshd_config') do
6
6
  it { should be_file }
@@ -72,16 +72,11 @@ end
72
72
 
73
73
  describe file('/etc/passwd') do
74
74
  it { should be_mode 644 }
75
- its(:command) { should eq "stat -c %a /etc/passwd | grep -- \\^644\\$" }
76
- end
77
-
78
- describe file('/etc/passwd') do
79
- it { should_not be_mode 'invalid' }
80
75
  end
81
76
 
82
77
  describe file('/etc/passwd') do
83
78
  it { should be_owned_by 'root' }
84
- its(:command) { should eq "stat -c %U /etc/passwd | grep -- \\^root\\$" }
79
+ its(:command) { should eq "ls -al /etc/passwd | awk '{print $3}' | grep -- \\^root\\$" }
85
80
  end
86
81
 
87
82
  describe file('/etc/passwd') do
@@ -90,7 +85,7 @@ end
90
85
 
91
86
  describe file('/etc/passwd') do
92
87
  it { should be_grouped_into 'root' }
93
- its(:command) { should eq "stat -c %G /etc/passwd | grep -- \\^root\\$" }
88
+ its(:command) { should eq "ls -al /etc/passwd | awk '{print $4}' | grep -- \\^root\\$" }
94
89
  end
95
90
 
96
91
  describe file('/etc/passwd') do
@@ -149,7 +144,7 @@ end
149
144
 
150
145
  describe file('/tmp') do
151
146
  it { should be_readable.by_user('mail') }
152
- its(:command) { should eq "runuser -s /bin/sh -c \"test -r /tmp\" mail" }
147
+ its(:command) { should eq "su -s sh -c \"test -r /tmp\" mail" }
153
148
  end
154
149
 
155
150
  describe file('/tmp') do
@@ -199,7 +194,7 @@ end
199
194
 
200
195
  describe file('/tmp') do
201
196
  it { should be_writable.by_user('mail') }
202
- its(:command) { should eq "runuser -s /bin/sh -c \"test -w /tmp\" mail" }
197
+ its(:command) { should eq "su -s sh -c \"test -w /tmp\" mail" }
203
198
  end
204
199
 
205
200
  describe file('/tmp') do
@@ -249,7 +244,7 @@ end
249
244
 
250
245
  describe file('/tmp') do
251
246
  it { should be_executable.by_user('mail') }
252
- its(:command) { should eq "runuser -s /bin/sh -c \"test -x /tmp\" mail" }
247
+ its(:command) { should eq "su -s sh -c \"test -x /tmp\" mail" }
253
248
  end
254
249
 
255
250
  describe file('/tmp') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe group('root') do
6
6
  it { should exist }
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  describe group('root') do
15
15
  it { should have_gid 0 }
16
- its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
16
+ its(:command) { should eq "cat etc/group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
17
17
  end
18
18
 
19
19
  describe group('root') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe host('127.0.0.1') do
6
6
  it { should be_resolvable }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe linux_kernel_parameter('net.ipv4.tcp_syncookies') do
6
6
  let(:stdout) { "1\n" }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe package('httpd') do
6
6
  it { should be_installed }
7
- its(:command) { should eq "rpm -q httpd" }
7
+ its(:command) { should eq "lslpp -L httpd" }
8
8
  end
9
9
 
10
10
  describe package('invalid-package') do
@@ -17,12 +17,7 @@ end
17
17
 
18
18
  describe package('httpd') do
19
19
  it { should be_installed.with_version('2.2.15-28.el6') }
20
- its(:command) { should eq "rpm -q httpd | grep -w -- 2.2.15-28.el6" }
21
- end
22
-
23
- describe package('httpd') do
24
- it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
25
- its(:command) { should eq "rpm -q httpd | grep -w -- 2.2.15-28.el6" }
20
+ its(:command) { should eq "lslpp -L httpd | awk '{print $2}' | grep -w -- 2.2.15-28.el6" }
26
21
  end
27
22
 
28
23
  describe package('httpd') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe php_config('default_mimetype') do
6
6
  let(:stdout) { 'text/html' }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe port(80) do
6
6
  it { should be_listening }
7
- its(:command) { should eq 'netstat -tunl | grep -- :80\\ ' }
7
+ its(:command) { should eq "netstat -an -f inet | awk '{print $4}' | grep -- *.80 " }
8
8
  end
9
9
 
10
10
  describe port('invalid') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe routing_table do
6
6
  let(:stdout) { "192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.10 \r\ndefault via 192.168.100.1 dev eth0 \r\n" }
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
3
+ include Serverspec::Helper::AIX
4
4
 
5
5
  describe service('sshd') do
6
6
  it { should be_enabled }
7
- its(:command) { should eq "chkconfig --list sshd | grep 3:on" }
7
+ its(:command) { should eq "lssrc -s sshd | grep active" }
8
8
  end
9
9
 
10
10
  describe service('invalid-service') do
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  describe service('sshd') do
15
15
  it { should be_enabled.with_level(4) }
16
- its(:command) { should eq "chkconfig --list sshd | grep 4:on" }
16
+ its(:command) { should eq "lssrc -s sshd | grep active" }
17
17
  end
18
18
 
19
19
  describe service('invalid-service') do
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  describe service('sshd') do
24
24
  it { should be_running }
25
- its(:command) { should eq "service sshd status" }
25
+ its(:command) { should eq "ps -ef | grep -v grep | grep sshd" }
26
26
  end
27
27
 
28
28
  describe service('invalid-daemon') do
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Serverspec::Helper::RedHat
4
-
3
+ include Serverspec::Helper::AIX
5
4
 
6
5
  describe user('root') do
7
6
  it { should exist }
@@ -14,7 +13,7 @@ end
14
13
 
15
14
  describe user('root') do
16
15
  it { should belong_to_group 'root' }
17
- its(:command) { should eq "id root | awk '{print $3}' | grep -- root" }
16
+ its(:command) { should eq "lsuser -a groups root | awk -F'=' '{print $2}'| sed -e 's/,/ /g' |grep -w -- root" }
18
17
  end
19
18
 
20
19
  describe user('root') do
@@ -32,7 +31,7 @@ end
32
31
 
33
32
  describe user('root') do
34
33
  it { should have_login_shell '/bin/bash' }
35
- its(:command) { should eq "getent passwd root | cut -f 7 -d ':' | grep -w -- /bin/bash" }
34
+ its(:command) { should eq "lsuser -a shell root |awk -F'=' '{print $2}' | grep -w -- /bin/bash" }
36
35
  end
37
36
 
38
37
  describe user('root') do
@@ -41,7 +40,7 @@ end
41
40
 
42
41
  describe user('root') do
43
42
  it { should have_home_directory '/root' }
44
- its(:command) { should eq "getent passwd root | cut -f 6 -d ':' | grep -w -- /root" }
43
+ its(:command) { should eq "lsuser -a home root | awk -F'=' '{print $2}' | grep -w -- /root" }
45
44
  end
46
45
 
47
46
  describe user('root') 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.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
@@ -228,25 +228,18 @@ files:
228
228
  - lib/serverspec/version.rb
229
229
  - serverspec.gemspec
230
230
  - spec/aix/command_spec.rb
231
- - spec/aix/commands_spec.rb
232
231
  - spec/aix/cron_spec.rb
233
232
  - spec/aix/default_gateway_spec.rb
234
233
  - spec/aix/file_spec.rb
235
234
  - spec/aix/group_spec.rb
236
235
  - spec/aix/host_spec.rb
237
- - spec/aix/interface_spec.rb
238
- - spec/aix/iptables_spec.rb
239
- - spec/aix/kernel_module_spec.rb
240
236
  - spec/aix/linux_kernel_parameter_spec.rb
241
237
  - spec/aix/package_spec.rb
242
238
  - spec/aix/php_config_spec.rb
243
239
  - spec/aix/port_spec.rb
244
240
  - spec/aix/routing_table_spec.rb
245
- - spec/aix/selinux_spec.rb
246
241
  - spec/aix/service_spec.rb
247
242
  - spec/aix/user_spec.rb
248
- - spec/aix/yumrepo_spec.rb
249
- - spec/aix/zfs_spec.rb
250
243
  - spec/backend/cmd/configuration_spec.rb
251
244
  - spec/backend/exec/build_command_spec.rb
252
245
  - spec/backend/exec/configuration_spec.rb
@@ -410,25 +403,18 @@ specification_version: 4
410
403
  summary: RSpec tests for your servers configured by Puppet, Chef or anything else
411
404
  test_files:
412
405
  - spec/aix/command_spec.rb
413
- - spec/aix/commands_spec.rb
414
406
  - spec/aix/cron_spec.rb
415
407
  - spec/aix/default_gateway_spec.rb
416
408
  - spec/aix/file_spec.rb
417
409
  - spec/aix/group_spec.rb
418
410
  - spec/aix/host_spec.rb
419
- - spec/aix/interface_spec.rb
420
- - spec/aix/iptables_spec.rb
421
- - spec/aix/kernel_module_spec.rb
422
411
  - spec/aix/linux_kernel_parameter_spec.rb
423
412
  - spec/aix/package_spec.rb
424
413
  - spec/aix/php_config_spec.rb
425
414
  - spec/aix/port_spec.rb
426
415
  - spec/aix/routing_table_spec.rb
427
- - spec/aix/selinux_spec.rb
428
416
  - spec/aix/service_spec.rb
429
417
  - spec/aix/user_spec.rb
430
- - spec/aix/yumrepo_spec.rb
431
- - spec/aix/zfs_spec.rb
432
418
  - spec/backend/cmd/configuration_spec.rb
433
419
  - spec/backend/exec/build_command_spec.rb
434
420
  - spec/backend/exec/configuration_spec.rb
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe 'check_yumrepo' do
6
- subject { commands.check_yumrepo('epel') }
7
- it { should eq 'yum repolist all -C | grep ^epel' }
8
- end
9
-
10
- describe 'check_yumrepo_enabled' do
11
- subject { commands.check_yumrepo_enabled('epel') }
12
- it { should eq 'yum repolist all -C | grep ^epel | grep enabled' }
13
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe interface('eth0') do
6
- let(:stdout) { '1000' }
7
- its(:speed) { should eq 1000 }
8
- its(:command) { should eq "ethtool eth0 | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\/s/,\"\\\\1\",\"\")}'" }
9
- end
10
-
11
- describe interface('eth0') do
12
- it { should have_ipv4_address("192.168.10.10") }
13
- its(:command) { should eq "ip addr show eth0 | grep 'inet 192\\.168\\.10\\.10/'" }
14
- end
15
-
16
- describe interface('eth0') do
17
- it { should have_ipv4_address("192.168.10.10/24") }
18
- its(:command) { should eq "ip addr show eth0 | grep 'inet 192\\.168\\.10\\.10/24 '" }
19
- end
20
-
21
- describe interface('invalid-interface') do
22
- let(:stdout) { '1000' }
23
- its(:speed) { should_not eq 100 }
24
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe iptables do
6
- it { should have_rule '-P INPUT ACCEPT' }
7
- its(:command) { should eq "iptables -S | grep -- -P\\ INPUT\\ ACCEPT" }
8
- end
9
-
10
- describe iptables do
11
- it { should_not have_rule 'invalid-rule' }
12
- end
13
-
14
- describe iptables do
15
- it { should have_rule('-P INPUT ACCEPT').with_table('mangle').with_chain('INPUT') }
16
- its(:command) { should eq "iptables -t mangle -S INPUT | grep -- -P\\ INPUT\\ ACCEPT" }
17
- end
18
-
19
- describe iptables do
20
- it { should_not have_rule('invalid-rule').with_table('mangle').with_chain('INPUT') }
21
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe kernel_module('lp') do
6
- it { should be_loaded }
7
- its(:command) { should eq "lsmod | grep ^lp" }
8
- end
9
-
10
- describe kernel_module('invalid-module') do
11
- it { should_not be_loaded }
12
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe selinux do
6
- it { should be_enforcing }
7
- its(:command) { should eq "getenforce | grep -i -- enforcing && grep -i -- ^SELINUX=enforcing$ /etc/selinux/config" }
8
- end
9
-
10
- describe selinux do
11
- it { should be_permissive }
12
- its(:command) { should eq "getenforce | grep -i -- permissive && grep -i -- ^SELINUX=permissive$ /etc/selinux/config" }
13
- end
14
-
15
- describe selinux do
16
- it { should be_disabled }
17
- its(:command) { should eq "test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
18
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe 'Serverspec yumrepo matchers of Red Hat family' do
6
- describe 'exist' do
7
- describe yumrepo('epel') do
8
- it { should exist }
9
- end
10
-
11
- describe yumrepo('invalid-repository') do
12
- it { should_not exist }
13
- end
14
- end
15
-
16
- describe 'be_enabled' do
17
- describe yumrepo('epel') do
18
- it { should be_enabled }
19
- end
20
-
21
- describe yumrepo('invalid-repository') do
22
- it { should_not be_enabled }
23
- end
24
- end
25
- end
data/spec/aix/zfs_spec.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include Serverspec::Helper::RedHat
4
-
5
- describe zfs('rpool') do
6
- it { should exist }
7
- its(:command) { should eq "zfs list -H rpool" }
8
- end
9
-
10
- describe zfs('rpool') do
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
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\\$" }
18
- end