serverspec 0.6.27 → 0.6.28
Sign up to get free protection for your applications and to get access to all the features.
@@ -14,13 +14,13 @@ module Serverspec
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def check_listening(port)
|
17
|
-
regexp = "
|
18
|
-
"netstat -an 2> /dev/null |
|
17
|
+
regexp = "\\.#{port} "
|
18
|
+
"netstat -an 2> /dev/null | grep -- LISTEN | grep -- #{escape(regexp)}"
|
19
19
|
end
|
20
20
|
|
21
21
|
def check_listening_with_protocol(port, protocol)
|
22
|
-
regexp = "
|
23
|
-
"netstat -an -P #{escape(protocol)} 2> /dev/null |
|
22
|
+
regexp = ".*\\.#{port} "
|
23
|
+
"netstat -an -P #{escape(protocol)} 2> /dev/null | grep -- LISTEN | grep -- #{escape(regexp)}"
|
24
24
|
end
|
25
25
|
|
26
26
|
def check_running(service)
|
data/lib/serverspec/version.rb
CHANGED
data/spec/solaris/port_spec.rb
CHANGED
@@ -4,7 +4,7 @@ include Serverspec::Helper::Solaris
|
|
4
4
|
|
5
5
|
describe port(80) do
|
6
6
|
it { should be_listening }
|
7
|
-
its(:command) { should eq %q!netstat -an 2> /dev/null |
|
7
|
+
its(:command) { should eq %q!netstat -an 2> /dev/null | grep -- LISTEN | grep -- \\\\.80\\ ! }
|
8
8
|
end
|
9
9
|
|
10
10
|
describe port('invalid') do
|
@@ -13,12 +13,12 @@ end
|
|
13
13
|
|
14
14
|
describe port(80) do
|
15
15
|
it { should be_listening.with("tcp") }
|
16
|
-
its(:command) { should eq %q!netstat -an -P tcp 2> /dev/null |
|
16
|
+
its(:command) { should eq %q!netstat -an -P tcp 2> /dev/null | grep -- LISTEN | grep -- .\\*\\\\.80\\ ! }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe port(123) do
|
20
20
|
it { should be_listening.with("udp") }
|
21
|
-
its(:command) { should eq %q!netstat -an -P udp 2> /dev/null |
|
21
|
+
its(:command) { should eq %q!netstat -an -P udp 2> /dev/null | grep -- LISTEN | grep -- .\\*\\\\.123\\ ! }
|
22
22
|
end
|
23
23
|
|
24
24
|
describe port(80) do
|
data/spec/solaris11/port_spec.rb
CHANGED
@@ -4,7 +4,7 @@ include Serverspec::Helper::Solaris11
|
|
4
4
|
|
5
5
|
describe port(80) do
|
6
6
|
it { should be_listening }
|
7
|
-
its(:command) { should eq %q!netstat -an 2> /dev/null |
|
7
|
+
its(:command) { should eq %q!netstat -an 2> /dev/null | grep -- LISTEN | grep -- \\\\.80\\ ! }
|
8
8
|
end
|
9
9
|
|
10
10
|
describe port('invalid') do
|