specinfra 2.0.0.beta5 → 2.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -0
- data/lib/specinfra/backend/ssh.rb +1 -1
- data/lib/specinfra/command/base.rb +8 -7
- data/lib/specinfra/command/solaris.rb +1 -1
- data/lib/specinfra/version.rb +1 -1
- data/spec/backend/exec/build_command_spec.rb +3 -3
- data/spec/command/base.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c59de503cd2a6e1e99e571d21abe145d4901c62e
|
4
|
+
data.tar.gz: 4c84a1001c9c5df401c3195fd9c957b33c43b8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4367b260c7854879384d8f9292fdd9ae4eda45693445d951e675c91140e0c068ff76e52df1b8f7b878b77063410f84680f7b51713b499219e0c543536fe02c4b
|
7
|
+
data.tar.gz: c69205dad07e42abab0fab31fdfdd8873a3964cd50395ec4c9f9b2223154803d42da040407600b8d2511828b852575f9a25793ac6f9fdb6113893467641cf2d6
|
data/Rakefile
CHANGED
@@ -77,7 +77,7 @@ module Specinfra
|
|
77
77
|
|
78
78
|
channel.on_extended_data do |ch, type, data|
|
79
79
|
if data.match /you must have a tty to run sudo/
|
80
|
-
abort 'Please set "
|
80
|
+
abort 'Please set "SpecInfra.configuration.request_pty = true" or "c.request_pty = true" in your spec_helper.rb or other appropriate file.'
|
81
81
|
end
|
82
82
|
|
83
83
|
if data.match /^sudo: no tty present and no askpass program specified/
|
@@ -80,7 +80,7 @@ module Specinfra
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def check_group(group)
|
83
|
-
"getent group
|
83
|
+
"getent group #{escape(group)}"
|
84
84
|
end
|
85
85
|
|
86
86
|
def check_installed(package, version=nil)
|
@@ -95,14 +95,15 @@ module Specinfra
|
|
95
95
|
raise NotImplementedError.new
|
96
96
|
end
|
97
97
|
|
98
|
-
def check_listening(port)
|
99
|
-
|
100
|
-
|
98
|
+
def check_listening(port, options = {})
|
99
|
+
pattern = ":#{port}"
|
100
|
+
pattern = " #{options[:local_address]}#{pattern}" if options[:local_address]
|
101
|
+
pattern = "^#{options[:protocol]} .*#{pattern}" if options[:protocol]
|
102
|
+
"netstat -tunl | grep -- #{escape(pattern)}"
|
101
103
|
end
|
102
104
|
|
103
105
|
def check_listening_with_protocol(port, protocol)
|
104
|
-
|
105
|
-
"netstat -tunl | grep -- #{escape(regexp)}"
|
106
|
+
check_listening port, {:protocol => protocol}
|
106
107
|
end
|
107
108
|
|
108
109
|
def check_running(service)
|
@@ -200,7 +201,7 @@ module Specinfra
|
|
200
201
|
end
|
201
202
|
|
202
203
|
def check_cron_entry(user, entry)
|
203
|
-
entry_escaped = entry.gsub(/\*/, '\\*')
|
204
|
+
entry_escaped = entry.gsub(/\*/, '\\*').gsub(/\[/, '\\[').gsub(/\]/, '\\]')
|
204
205
|
if user.nil?
|
205
206
|
"crontab -l | grep -v \"#\" -- | grep -- #{escape(entry_escaped)}"
|
206
207
|
else
|
@@ -28,7 +28,7 @@ module Specinfra
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def check_cron_entry(user, entry)
|
31
|
-
entry_escaped = entry.gsub(/\*/, '\\*')
|
31
|
+
entry_escaped = entry.gsub(/\*/, '\\*').gsub(/\[/, '\\[').gsub(/\]/, '\\]')
|
32
32
|
if user.nil?
|
33
33
|
"crontab -l | grep -- #{escape(entry_escaped)}"
|
34
34
|
else
|
data/lib/specinfra/version.rb
CHANGED
@@ -78,7 +78,7 @@ describe 'check_os' do
|
|
78
78
|
context 'test ubuntu with lsb_release command' do
|
79
79
|
subject { backend.check_os }
|
80
80
|
it do
|
81
|
-
backend.
|
81
|
+
expect(backend).to receive(:run_command).at_least(1).times do |args|
|
82
82
|
if ['ls /etc/debian_version', 'lsb_release -ir'].include? args
|
83
83
|
double(
|
84
84
|
:run_command_response,
|
@@ -98,7 +98,7 @@ describe 'check_os' do
|
|
98
98
|
context 'test ubuntu with /etc/lsb-release' do
|
99
99
|
subject { backend.check_os }
|
100
100
|
it do
|
101
|
-
backend.
|
101
|
+
expect(backend).to receive(:run_command).at_least(1).times do |args|
|
102
102
|
if ['ls /etc/debian_version', 'cat /etc/lsb-release'].include? args
|
103
103
|
double(
|
104
104
|
:run_command_response,
|
@@ -123,7 +123,7 @@ EOF
|
|
123
123
|
context 'test debian (no lsb_release or lsb-release)' do
|
124
124
|
subject { backend.check_os }
|
125
125
|
it do
|
126
|
-
backend.
|
126
|
+
expect(backend).to receive(:run_command).at_least(1).times do |args|
|
127
127
|
if args == 'ls /etc/debian_version'
|
128
128
|
double :run_command_response, :success? => true
|
129
129
|
elsif args == 'uname -m'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Base do
|
4
|
+
describe '#check_listening' do
|
5
|
+
let(:port) { 80 }
|
6
|
+
let(:options) { {} }
|
7
|
+
subject { described_class.new.check_listening(port, options) }
|
8
|
+
|
9
|
+
it { should_not be_empty }
|
10
|
+
it { should start_with('netstat') }
|
11
|
+
it { should include(':80') }
|
12
|
+
it { should be_a_kind_of(String) }
|
13
|
+
|
14
|
+
context 'with protocol' do
|
15
|
+
let(:protocol) { 'tcp' }
|
16
|
+
let(:options) { {:protocol => protocol} }
|
17
|
+
|
18
|
+
it { should include(protocol) }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'with local_address' do
|
22
|
+
let(:local_address) { '127.0.0.1' }
|
23
|
+
let(:options) { {:local_address => local_address} }
|
24
|
+
|
25
|
+
it { should include(local_address) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/specinfra/version.rb
|
147
147
|
- spec/backend/exec/build_command_spec.rb
|
148
148
|
- spec/backend/ssh/build_command_spec.rb
|
149
|
+
- spec/command/base.rb
|
149
150
|
- spec/configuration_spec.rb
|
150
151
|
- spec/helper/backend_spec.rb
|
151
152
|
- spec/helper/properties_spec.rb
|
@@ -180,6 +181,7 @@ summary: Common layer for serverspec and configspec
|
|
180
181
|
test_files:
|
181
182
|
- spec/backend/exec/build_command_spec.rb
|
182
183
|
- spec/backend/ssh/build_command_spec.rb
|
184
|
+
- spec/command/base.rb
|
183
185
|
- spec/configuration_spec.rb
|
184
186
|
- spec/helper/backend_spec.rb
|
185
187
|
- spec/helper/properties_spec.rb
|