consul-ruby-client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjkwMjNjYTIwMzU3M2I4N2U0MDJjZjI3MmFiODg0ZmQwY2RkOWUzMQ==
4
+ MGM1NWRiMjY3OWUyNGM1MDZjMGUwOGFjYTFiY2Y0NjhmYzYwOTk1OQ==
5
5
  data.tar.gz: !binary |-
6
- NjEyMWQ3NzdjZmNjMTViYjUyODFiYzQxOTY1MjE2MmNmZDBkNjk2MA==
6
+ YzM0YWVjMDRjN2M4YTk5MDAzYzJlNGVkMTYwZWQ5OThhMjM3ZGIzNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjViNTUzNmNmYzJlZTI0NDlmYzFiMjQwYjM2YjA5ZTJlNDZkMDI3ZWFjY2Ez
10
- ZDAyYTBiOThmYThiNTFkZmQwOTYwOTIwOTM3MmU2NjdmOTBmM2EyZTFmYjQw
11
- OTJjNzUwZGUwMzJjM2RmYWI3ZDhlZDE0ODZjZjU0ZDdhOGQyOTg=
9
+ MDk2YTEzMmI3MmNlMjFjMzUwOGRmYmRkYTYwYjdlNGI3ODJiODQyMTg4NWEy
10
+ Y2VjYTkzYjhjOTdlMjU4OGM2MmMxMTgyMDc5NjE2MGQ0MGQyYmZiMDIxNzM3
11
+ ZTg5MWJmMTc5NDg5ODJkMWJkZjM3YTI1ZjM3ZDY5YmM2M2Q4MTI=
12
12
  data.tar.gz: !binary |-
13
- YzIxNzQ2Njc4ZTA0YzM0MzBjMjlkMmQ0ZjdjMGU3NmUxMmUzNzlkNDJlY2Y1
14
- ZjQwOTJlOTRkNTA5NzIwY2QwMzJkOTBhYmRjMjc1MjE4NGU4NmJjOTc3M2Q5
15
- MWRjMzk2ZDAyN2EwZGE5ZDg5YjFmZGQ3MThmNTY5Njc5NDEwODM=
13
+ YmM1YjYwMDI4ZTU2OTcwNzcwOWUzMjMzZTU4YjViMDA5ZDRiMDQ4YThlYTY1
14
+ NGQ1MTU3MjYxZmUyNGZiZWU0Nzc0YzFlMmMzNjE1MmJiZDU4MzlkNjZmMDg5
15
+ OWFiMzY2N2UxM2RhYjgyZjhmYmJjYTM4OGI5ZTFhNDU3ZDM2MmI=
@@ -114,9 +114,9 @@ module Consul
114
114
  success = register_with_backoff(build_service_url('register'), entity, 0, 3)
115
115
  if success
116
116
  logger.info("Successfully registered service #{entity.name}.")
117
- unless entity.check.nil?
117
+ c = check("service:#{entity.name}") unless entity.check.nil?
118
+ unless c.nil?
118
119
  # Pass the first health check
119
- c = check("service:#{entity.name}")
120
120
  logger.info("Updating status for health check #{c.check_id} to \"pass\".")
121
121
  _get build_check_status_url(c.check_id, 'pass')
122
122
  end
@@ -0,0 +1,23 @@
1
+ require_relative 'base'
2
+
3
+ module Consul
4
+ module Client
5
+
6
+ # Represents Consul Health Check
7
+ #
8
+ # http://www.consul.io/docs/agent/http/health.html
9
+ #
10
+ class HealthCheck < Base
11
+
12
+ # Public return the health checks that correspond to
13
+ def node(node, opts = {})
14
+
15
+ end
16
+
17
+ def checks(service, opts = {})
18
+
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require_relative 'base'
2
3
 
3
4
  module Consul
@@ -11,7 +12,10 @@ module Consul
11
12
  #
12
13
  # Returns: Address, host:port.
13
14
  def leader
14
- RestClient.get leader_url
15
+ resp = RestClient.get leader_url
16
+ return resp.body.slice(1, resp.body.length-2) if resp.code == 200
17
+ logger.warn("Unable to get leader. Resp code: #{resp.code} Resp message: #{resp.body}")
18
+ nil
15
19
  end
16
20
 
17
21
  # Public: This endpoint retrieves the Raft peers for the
@@ -21,7 +25,10 @@ module Consul
21
25
  #
22
26
  # Returns: List of addresses.
23
27
  def peers
24
- RestClient.get peers_url
28
+ resp = RestClient.get peers_url
29
+ return JSON.parse(resp.body) if resp.code == 200
30
+ logger.warn("Unable to get peers. Resp code: #{resp.code} Resp message: #{resp.body}")
31
+ nil
25
32
  end
26
33
 
27
34
  def build_url(suffix)
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Client
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.9'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hotan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -157,6 +157,7 @@ files:
157
157
  - lib/consul/client/agent.rb
158
158
  - lib/consul/client/base.rb
159
159
  - lib/consul/client/catalog.rb
160
+ - lib/consul/client/health_check.rb
160
161
  - lib/consul/client/key_value.rb
161
162
  - lib/consul/client/session.rb
162
163
  - lib/consul/client/status.rb