svcdeps_tasks 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/probe.rb +16 -6
- data/lib/specfile.rb +2 -1
- data/lib/svcdeps_tasks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189a17aee33cca4ac7d2a52861f80587818d1620
|
4
|
+
data.tar.gz: cb3474712b034c272dd5f335cd9f84eeefdaa0b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986c58d3346e894254b56b08392ea2684b714b718f5cdfa87db36127ff55ce85a7092f28d9ef905d09b86766bdd8930849c18940b39aba5a7781122af6a5a473
|
7
|
+
data.tar.gz: b3911923d3ae6c5e67eaac0a2ae5cb7673da1f2ba3ccc56a50236d4a3b24957ad26a61f2c01886cfdce11250e756bca0cede3cdc1989feb827658b04f820aa57
|
data/Gemfile.lock
CHANGED
data/lib/probe.rb
CHANGED
@@ -40,8 +40,8 @@ class Probe
|
|
40
40
|
run_as = nil unless Process.uid.zero?
|
41
41
|
end
|
42
42
|
|
43
|
-
Timeout::timeout(@timeout) do
|
44
|
-
user = Etc.getpwnam(run_as)
|
43
|
+
Timeout::timeout(@timeout) do
|
44
|
+
user = Etc.getpwnam(run_as) if run_as
|
45
45
|
pid = Process.fork do
|
46
46
|
STDOUT.reopen('/dev/null')
|
47
47
|
STDERR.reopen('/dev/null')
|
@@ -100,16 +100,26 @@ class Probe
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def error_wrapper(&block)
|
104
|
+
begin
|
105
|
+
instance_eval(&block) if block_given?
|
106
|
+
raise 'block should be passed to error_wrapper' unless block_given?
|
107
|
+
rescue => e
|
108
|
+
return "#{e.class} => #{e.message}"
|
109
|
+
end
|
110
|
+
"SUCCESS"
|
111
|
+
end
|
112
|
+
|
103
113
|
def run
|
104
114
|
case @type
|
105
115
|
when 'tcp'
|
106
|
-
tcp_probe
|
116
|
+
error_wrapper { tcp_probe }
|
107
117
|
when 'udp'
|
108
|
-
udp_probe
|
118
|
+
error_wrapper { udp_probe }
|
109
119
|
when 'command'
|
110
|
-
command_probe
|
120
|
+
error_wrapper { command_probe }
|
111
121
|
when 'http'
|
112
|
-
http_probe
|
122
|
+
error_wrapper { http_probe }
|
113
123
|
else
|
114
124
|
raise "Type '#{@type}' not supported"
|
115
125
|
end
|
data/lib/specfile.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rspec'
|
2
|
+
|
2
3
|
set :backend, :exec
|
3
4
|
|
4
5
|
dir = File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
|
@@ -30,7 +31,7 @@ describe 'Service Dependencies' do
|
|
30
31
|
dep = symbolize_keys(dep)
|
31
32
|
it "#{dep[:desc]}" do
|
32
33
|
p = Probe.new( dep )
|
33
|
-
expect
|
34
|
+
expect(p.run) == 'SUCCESS'
|
34
35
|
end
|
35
36
|
end if deps['deps']
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svcdeps_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Lopo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|