Class: Philae::EtcdProbe
- Inherits:
-
Object
- Object
- Philae::EtcdProbe
- Defined in:
- lib/philae/etcd_probe.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(name, host, port, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil) ⇒ EtcdProbe
constructor
A new instance of EtcdProbe.
Constructor Details
#initialize(name, host, port, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil) ⇒ EtcdProbe
Returns a new instance of EtcdProbe.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/philae/etcd_probe.rb', line 16 def initialize(name, host, port, read_timeout: 1, cacert: nil, ssl_cert: nil, ssl_key: nil) if !cacert.nil? raise InvalidSSLConfig, 'cacert' if !File.exist?(cacert) raise InvalidSSLConfig, 'ssl_cert' if ssl_cert.nil? || !File.exist?(ssl_cert) raise InvalidSSLConfig, 'ssl_key' if ssl_key.nil? || !File.exist?(ssl_key) end @name = name @host = host @port = port @read_timeout = read_timeout @cacert = cacert @ssl_cert = ssl_cert @ssl_key = ssl_key end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/philae/etcd_probe.rb', line 13 def name @name end |
Instance Method Details
#check ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/philae/etcd_probe.rb', line 32 def check begin etcd_client.get '/' rescue StandardError => e return { healthy: false, comment: "Unable to contact etcd (#{e.})" } end return { healthy: true, comment: '' } end |