doctor 0.5.0 → 0.6.0
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 +4 -4
- data/app/analyser/doctor/telnet_analyser.rb +5 -4
- data/app/controllers/doctor/health_check_controller.rb +7 -1
- data/app/use_case/doctor/health_check.rb +26 -7
- data/app/view/doctor/dto/database_result_dto.rb +1 -0
- data/app/view/doctor/dto/hd_result_dto.rb +1 -0
- data/app/view/doctor/dto/telnet_result_dto.rb +1 -0
- data/lib/doctor/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: 25a482297d4b6c6c5f12486f82d089a2d8a74cc8
|
4
|
+
data.tar.gz: d70df0dad716978a8bfbcfde8d6e0be5b20d9e68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd87daf8fcf1b5455526aa679e4fa3e3366991b7c747330877f4e98bbff160a6d31629032e3291d023e3e05732896a76783f2bdec2fb631eaddda64421999ac7
|
7
|
+
data.tar.gz: 84ce81d31354588361cc12d3af86974c092d1cdd1921933caa292bdc1b1d661b113fe9957c176e7c5efd80eb11818c5c8072b26371cc5df9b5cdf91b8753b7ad
|
@@ -17,6 +17,7 @@ module Doctor
|
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
|
+
|
20
21
|
def validate_telnet_connection(url)
|
21
22
|
result = build_result(url)
|
22
23
|
|
@@ -48,10 +49,10 @@ module Doctor
|
|
48
49
|
|
49
50
|
def execute_telnet(url)
|
50
51
|
Net::Telnet::new(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
'Host' => url[:host],
|
53
|
+
'Port' => url[:port] || DEFAULT_PORT,
|
54
|
+
'Timeout' => url[:timeout] || DEFAULT_TIMEOUT,
|
55
|
+
'Waittime' => url[:wait_time] || DEFAULT_WAIT_TIME
|
55
56
|
)
|
56
57
|
end
|
57
58
|
end
|
@@ -3,7 +3,13 @@ module Doctor
|
|
3
3
|
def index
|
4
4
|
check_result = HealthCheck.new.perform
|
5
5
|
|
6
|
-
|
6
|
+
if check_result.has_error?
|
7
|
+
errors = check_result.error_messages
|
8
|
+
Rails.logger.error(errors)
|
9
|
+
status = :internal_server_error
|
10
|
+
else
|
11
|
+
status = :ok
|
12
|
+
end
|
7
13
|
|
8
14
|
render json: check_result.result, status: status
|
9
15
|
end
|
@@ -7,16 +7,23 @@ module Doctor
|
|
7
7
|
result[:databases] = analyze_database
|
8
8
|
result[:hds] = analyse_hds
|
9
9
|
|
10
|
-
|
10
|
+
error_messages = list_all_error_messages(result)
|
11
|
+
|
12
|
+
OpenStruct.new(
|
13
|
+
result: result,
|
14
|
+
has_error?: has_error?(result),
|
15
|
+
error_messages: error_messages
|
16
|
+
)
|
11
17
|
end
|
12
18
|
|
13
19
|
private
|
20
|
+
|
14
21
|
def analyze_telnet
|
15
22
|
process(TelnetAnalyser, Dto::TelnetResultDto)
|
16
23
|
end
|
17
24
|
|
18
25
|
def analyze_database
|
19
|
-
|
26
|
+
process(DatabaseAnalyser, Dto::DatabaseResultDto)
|
20
27
|
end
|
21
28
|
|
22
29
|
def analyse_hds
|
@@ -35,16 +42,28 @@ module Doctor
|
|
35
42
|
dto_result
|
36
43
|
end
|
37
44
|
|
38
|
-
def has_error?(
|
39
|
-
|
45
|
+
def has_error?(result) # rubocop:disable Style/PredicateName
|
46
|
+
result.values.each do |result_analyze|
|
40
47
|
result_analyze.each do |result|
|
41
|
-
|
42
|
-
return true
|
43
|
-
end
|
48
|
+
return true unless result.status.eql?('ok')
|
44
49
|
end
|
45
50
|
end
|
46
51
|
|
47
52
|
false
|
48
53
|
end
|
54
|
+
|
55
|
+
def list_all_error_messages(result)
|
56
|
+
errors = []
|
57
|
+
|
58
|
+
result.values.each do |result_analyze|
|
59
|
+
result_analyze.each do |result|
|
60
|
+
next if result.status.eql?('ok')
|
61
|
+
|
62
|
+
errors << result.error_message
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
errors
|
67
|
+
end
|
49
68
|
end
|
50
69
|
end
|
data/lib/doctor/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doctor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uaiHebert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|