philae 0.2.12 → 0.3.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/lib/philae/etcd_probe.rb +20 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4058dbbd9d47df1d46c0bb68315c17dfd38981a3d8d884be768df8aca9fa68d0
|
4
|
+
data.tar.gz: f745431b27b4371084f53ae649c94b362164ce68ab88353a7c8cee6213ccd014
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a8c85060058e306066489391a38abf0cd81dbc03f505b7bd033f75eb282dc9f9a1cc77f285755c32a92cf8739f5aba77c1d01018dbf27b29dad73c997cd1fa
|
7
|
+
data.tar.gz: 96aab47fb98d8d03b6260046a4b3aa8bd6933ebf0c25126b25487bb8dead8d08db6d4ebdb00abb89b29cc8d0d67212f9ba68ca68b923f46b28cd9490aa284035
|
data/lib/philae/etcd_probe.rb
CHANGED
@@ -14,15 +14,12 @@ module Philae
|
|
14
14
|
|
15
15
|
# @param [Integer] read_timeout Timeout in second for the HTTP request
|
16
16
|
def initialize(name, host, port, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil)
|
17
|
-
if
|
18
|
-
if !File.
|
19
|
-
|
20
|
-
|
21
|
-
raise InvalidSSLConfig, "ssl_cert"
|
22
|
-
elsif ssl_key.nil? or !File.exists? ssl_key
|
23
|
-
raise InvalidSSLConfig, "ssl_key"
|
24
|
-
end
|
17
|
+
if !cacert.nil?
|
18
|
+
raise InvalidSSLConfig, 'cacert' if !File.exist?(cacert)
|
19
|
+
raise InvalidSSLConfig, 'ssl_cert' if ssl_cert.nil? || !File.exist?(ssl_cert)
|
20
|
+
raise InvalidSSLConfig, 'ssl_key' if ssl_key.nil? || !File.exist?(ssl_key)
|
25
21
|
end
|
22
|
+
|
26
23
|
@name = name
|
27
24
|
@host = host
|
28
25
|
@port = port
|
@@ -34,22 +31,25 @@ module Philae
|
|
34
31
|
|
35
32
|
def check
|
36
33
|
begin
|
37
|
-
|
38
|
-
|
39
|
-
c.use_ssl = true
|
40
|
-
c.ca_file = @cacert
|
41
|
-
c.ssl_cert = OpenSSL::X509::Certificate.new(File.read(@ssl_cert))
|
42
|
-
c.ssl_key = OpenSSL::PKey::RSA.new(File.read(@ssl_key))
|
43
|
-
end
|
44
|
-
else
|
45
|
-
client = Etcd.client host: @host, port: @port, read_timeout: @read_timeout
|
46
|
-
end
|
47
|
-
client.get '/'
|
48
|
-
rescue Exception => e
|
34
|
+
etcd_client.get '/'
|
35
|
+
rescue StandardError => e
|
49
36
|
return { healthy: false, comment: "Unable to contact etcd (#{e.message})" }
|
50
37
|
end
|
51
38
|
|
52
39
|
return { healthy: true, comment: '' }
|
53
40
|
end
|
41
|
+
|
42
|
+
protected
|
43
|
+
|
44
|
+
def etcd_client
|
45
|
+
return Etcd.client host: @host, port: @port, read_timeout: @read_timeout do |c|
|
46
|
+
next if @cacert.nil?
|
47
|
+
|
48
|
+
c.use_ssl = true
|
49
|
+
c.ca_file = @cacert
|
50
|
+
c.ssl_cert = OpenSSL::X509::Certificate.new(File.read(@ssl_cert))
|
51
|
+
c.ssl_key = OpenSSL::PKey::RSA.new(File.read(@ssl_key))
|
52
|
+
end
|
53
|
+
end
|
54
54
|
end
|
55
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: philae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leo@scalingo.com
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: docker-api
|