serverspec 0.13.3 → 0.13.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: 95d8da0ffbf3b43d3b0d0a487a1139274a7ace7b
4
- data.tar.gz: 9033f985981bca13abcb52ccd0c3b176f31a6073
3
+ metadata.gz: 8cfe0b0f03cef8a61058d7b48a53da4cbf55a3f7
4
+ data.tar.gz: 8d9d8657762f5fb4a92cdd50b74a1941adeb7c0f
5
5
  SHA512:
6
- metadata.gz: 457d3354e927adccffd7ee9fc75a78921c203e8ccdabf38c58e58ba24fc48f87d9ac37a7cd940ab413c50fc17aa7c8ffa57a9d6910ec555f5fcdc7359159d567
7
- data.tar.gz: f8e11dff56aa715e7934187b2b0e31ff6a739d5ce538d7a6dc69909b53c08f91f699503d5686c9ff4565313d982f0c4581784d0c9961e1c1958c160f5a346a59
6
+ metadata.gz: 54d90b1c111146d960149565d1db9e193a14b7fdc20393e28e608f023480d5a889006fbf63c437864a13e8a335367c46e0d267ccf3d8beb02c7ac27db85d8280
7
+ data.tar.gz: 46ac7b5a8ea0b1d9c53883b6f5841b786073588d2ee576093612afd81875be43052ce80e8874178ffe08a9e9882cfd4c98cd51b9d56da357c1dfba9343164568
@@ -14,6 +14,15 @@ module Serverspec
14
14
  backend.send(check_method, @name, version)
15
15
  end
16
16
  end
17
+
18
+ def version
19
+ ret = backend.run_command(commands.get_package_version(@name))[:stdout].strip
20
+ if ret.empty?
21
+ nil
22
+ else
23
+ ret
24
+ end
25
+ end
17
26
  end
18
27
  end
19
28
  end
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.13.3"
2
+ VERSION = "0.13.4"
3
3
  end
data/serverspec.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_runtime_dependency "net-ssh"
22
22
  spec.add_runtime_dependency "rspec", ">= 2.13.0"
23
23
  spec.add_runtime_dependency "highline"
24
- spec.add_runtime_dependency "specinfra", ">= 0.0.6"
24
+ spec.add_runtime_dependency "specinfra", ">= 0.0.14"
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  end
@@ -4,7 +4,7 @@ include SpecInfra::Helper::Debian
4
4
 
5
5
  describe package('apache2') do
6
6
  it { should be_installed }
7
- its(:command) { should eq "dpkg -s apache2 && ! dpkg -s apache2 | grep -E '^Status: .+ not-installed$'" }
7
+ its(:command) { should eq "dpkg-query -f '${Status}' -W apache2 | grep '^install ok installed$'" }
8
8
  end
9
9
 
10
10
  describe package('invalid-package') do
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  describe package('apache2') do
15
15
  it { should be_installed.with_version('1.1.1') }
16
- its(:command) { should eq "dpkg -s apache2 && ! dpkg -s apache2 | grep -E '^Status: .+ not-installed$' && dpkg -s apache2 | grep -E '^Version: 1.1.1$'" }
16
+ its(:command) { should eq "dpkg-query -f '${Status} ${Version}' -W apache2 | grep -E '^install ok installed 1.1.1$'" }
17
17
  end
18
18
 
19
19
  describe package('invalid-package') do
@@ -4,7 +4,7 @@ include SpecInfra::Helper::Debian
4
4
 
5
5
  describe service('sshd') do
6
6
  it { should be_enabled }
7
- its(:command) { should eq "ls /etc/rc3.d/ | grep -- sshd || grep 'start on' /etc/init/sshd.conf" }
7
+ its(:command) { should eq "ls /etc/rc3.d/ | grep -- '^S..sshd' || grep 'start on' /etc/init/sshd.conf" }
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 "ls /etc/rc4.d/ | grep -- sshd || grep 'start on' /etc/init/sshd.conf" }
16
+ its(:command) { should eq "ls /etc/rc4.d/ | grep -- '^S..sshd' || grep 'start on' /etc/init/sshd.conf" }
17
17
  end
18
18
 
19
19
  describe service('invalid-service') do
@@ -107,3 +107,9 @@ describe package('App::Ack') do
107
107
  it { should be_installed.by('cpan').with_version('2.04') }
108
108
  its(:command) { should eq "cpan -l | grep -w -- \\^App::Ack | grep -w -- 2.04" }
109
109
  end
110
+
111
+ describe package('httpd') do
112
+ let(:stdout) { "2.2.15\n" }
113
+ its(:version) { should eq '2.2.15' }
114
+ its(:command) { should eq "rpm -qi httpd | grep Version | awk '{print $3}'" }
115
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.6
61
+ version: 0.0.14
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.6
68
+ version: 0.0.14
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,6 @@ files:
184
184
  - spec/backend/exec/build_command_spec.rb
185
185
  - spec/backend/exec/configuration_spec.rb
186
186
  - spec/backend/powershell/script_helper_spec.rb
187
- - spec/backend/ssh/build_command_spec.rb
188
187
  - spec/backend/ssh/configuration_spec.rb
189
188
  - spec/backend/winrm/configuration_spec.rb
190
189
  - spec/darwin/command_spec.rb
@@ -389,7 +388,6 @@ test_files:
389
388
  - spec/backend/exec/build_command_spec.rb
390
389
  - spec/backend/exec/configuration_spec.rb
391
390
  - spec/backend/powershell/script_helper_spec.rb
392
- - spec/backend/ssh/build_command_spec.rb
393
391
  - spec/backend/ssh/configuration_spec.rb
394
392
  - spec/backend/winrm/configuration_spec.rb
395
393
  - spec/darwin/command_spec.rb
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
-
3
- include SpecInfra::Helper::Ssh
4
-
5
- ssh = double
6
-
7
-
8
- describe 'build command with sudo' do
9
- before :each do
10
- RSpec.configure do |c|
11
- ssh.stub(:options) { { :user => 'foo' } }
12
- c.ssh = ssh
13
- c.sudo_path = nil
14
- end
15
- end
16
-
17
- context 'command pattern 1' do
18
- subject { backend.build_command('test -f /etc/passwd') }
19
- it { should eq 'sudo test -f /etc/passwd' }
20
- end
21
-
22
- context 'command pattern 2' do
23
- subject { backend.build_command('test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)') }
24
- it { should eq 'sudo test ! -f /etc/selinux/config || (sudo getenforce | grep -i -- disabled && sudo grep -i -- ^SELINUX=disabled$ /etc/selinux/config)' }
25
- end
26
-
27
- context 'command pattern 3' do
28
- subject { backend.build_command("dpkg -s apache2 && ! dpkg -s apache2 | grep -E '^Status: .+ not-installed$'") }
29
- it { should eq "sudo dpkg -s apache2 && ! sudo dpkg -s apache2 | grep -E '^Status: .+ not-installed$'" }
30
- end
31
- end
32
-
33
- # Alternate path for sudo command:
34
- sudo_path = '/usr/local/bin'
35
-
36
- describe 'build command with sudo on alternate path' do
37
- before :each do
38
- RSpec.configure do |c|
39
- ssh.stub(:options) { { :user => 'foo' } }
40
- c.ssh = ssh
41
- c.sudo_path = "#{sudo_path}"
42
- end
43
- end
44
-
45
-
46
- context 'command pattern 1a' do
47
- subject { backend.build_command('test -f /etc/passwd') }
48
- it { should eq "#{sudo_path}/sudo test -f /etc/passwd" }
49
- end
50
-
51
- context 'command pattern 2a' do
52
- subject { backend.build_command('test ! -f /etc/selinux/config || (getenforce | grep -i -- disabled && grep -i -- ^SELINUX=disabled$ /etc/selinux/config)') }
53
- it { should eq "#{sudo_path}/sudo test ! -f /etc/selinux/config || (#{sudo_path}/sudo getenforce | grep -i -- disabled && #{sudo_path}/sudo grep -i -- ^SELINUX=disabled$ /etc/selinux/config)" }
54
- end
55
-
56
- context 'command pattern 3a' do
57
- subject { backend.build_command("dpkg -s apache2 && ! dpkg -s apache2 | grep -E '^Status: .+ not-installed$'") }
58
- it { should eq "#{sudo_path}/sudo dpkg -s apache2 && ! #{sudo_path}/sudo dpkg -s apache2 | grep -E '^Status: .+ not-installed$'" }
59
- end
60
-
61
- after :each do
62
- RSpec.configure do |c|
63
- c.sudo_path = nil
64
- end
65
- end
66
-
67
- end