elasticsearch-drain 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f520f538372b3a7bf2dab781e394f342a0bfed3814eacbe3ee70ab710f4f658
4
- data.tar.gz: 3af22273742c66034f65e8e005fe8d4263beb3e7f42cfa45e12afcd6e1b31635
3
+ metadata.gz: 07fe00683cd1b132351470483926384323c2a206814ef8591502f05f31db2e10
4
+ data.tar.gz: 8f0f7ed089a8303fea9709e2e225f10da07c85ff58239944164c6a803e1ad6c9
5
5
  SHA512:
6
- metadata.gz: ba6b1b470387b9f8b3f8a11341c82acec413c0bd25addfd839cb1370169c60061908c97b7e532e1e454688f51ccc86c07190389fd67211a4ef2a48bb398ba5da
7
- data.tar.gz: 167f02eac7bc90c974f7dd42753e79e219f05c5e56c4308fb3fbf9531f9ab27976e536594d9a3b1e1f6ca7b3703ddedf88f36386af8a4a9964f3b4981f875fe3
6
+ metadata.gz: ec6d977ad2e3a34f6400e5171a6990fc624524e2bbdfa7899e9b2575b3a74b3a71b7bd9a37ffc0671bd6b1e2eabef0b06eb19d20d2f5da73a64a8e7cf9fdfd77
7
+ data.tar.gz: 9fd685d825244110c1227d4af363cb6752d175be7a407fa7cab2eaa51d02976b0c30b21eb815778757578d1923eff49453ff35004e994172839a74ddeeb16328
@@ -50,13 +50,20 @@ module Elasticsearch
50
50
  end
51
51
 
52
52
  # The Elasticsearch node ipaddress
53
+ #
54
+ # For ES v1.x, we must extract and modify the IP
55
+ # address from the http_address key. For all later
56
+ # versions, we can use the host key directly.
57
+ # That's why we check with the if/else statement.
53
58
  #
54
59
  # @return [String] Elasticsearch node ipaddress
55
60
  def ipaddress
56
- if info[1]['transport_address'] != ""
57
- address(info[1]['transport_address']).split(':')[0]
61
+ block = /\d{,2}|1\d{2}|2[0-4]\d|25[0-5]/
62
+ re = /\A#{block}\.#{block}\.#{block}\.#{block}\z/
63
+ if info[1]['host'] && re =~ info[1]['host']
64
+ info[1]['host']
58
65
  else
59
- address(info[1]['http_address']).split(':')[0]
66
+ address(info[1]['http_address']).split(':')[0]
60
67
  end
61
68
  end
62
69
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Thompson