rsolr-cloud-lw 1.1.0 → 1.1.1
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/rsolr/cloud/connection.rb +15 -3
- data/lib/rsolr/cloud/version.rb +1 -1
- data/spec/rsolr/cloud/connection_spec.rb +10 -0
- 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: 338ad609dcb7e15e561b387d16a77e1399bc3458d81366643e3a045e6c841253
|
4
|
+
data.tar.gz: 1c019ca48edb2f7745d079b08ff5ee3f8a4ebaf26e8aaf9d2fa031c87cf278e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac748b9607791d83566af7c1f8403daa62576ce858fee1a5804748ff5b9032d693b06a6d7564fce984d24fc07d14d8eaed1fb004473d1a2abf9e868fefdf4699
|
7
|
+
data.tar.gz: 6d0142a79f555b4e294de0502bee029ddf613deb56bf05fb96bc08cac31317d9af5ede1acad67c33853b5516a8dd7ded47f5d35242f748e86f6c2c2a9fc025e8
|
@@ -7,9 +7,10 @@ module RSolr
|
|
7
7
|
ZNODE_LIVE_NODES = '/live_nodes'.freeze
|
8
8
|
ZNODE_CLUSTER_PROPS = '/clusterprops.json'.freeze
|
9
9
|
|
10
|
-
def initialize(zk)
|
10
|
+
def initialize(zk, options = {})
|
11
11
|
super()
|
12
12
|
@zk = zk
|
13
|
+
@options = options
|
13
14
|
init_url_scheme
|
14
15
|
init_live_node_watcher
|
15
16
|
end
|
@@ -52,11 +53,22 @@ module RSolr
|
|
52
53
|
synchronize do
|
53
54
|
@live_nodes = []
|
54
55
|
@zk.children(ZNODE_LIVE_NODES, watch: true).each do |node|
|
55
|
-
|
56
|
-
@live_nodes << @url_scheme + '://' + node.tr('_', '/')
|
56
|
+
@live_nodes << node_url(node)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
def node_url(node)
|
62
|
+
# "/" between host_and_port part of url and context is replaced with "_" in ZK
|
63
|
+
u = node.tr('_', '/')
|
64
|
+
# add basic auth credentials in the form of "http://user:pass@host"
|
65
|
+
if @options[:user] && @options[:password]
|
66
|
+
u = @options[:user] + ':' + @options[:password] + '@' + u
|
67
|
+
end
|
68
|
+
# add url scheme
|
69
|
+
u = @url_scheme + '://' + u
|
70
|
+
u
|
71
|
+
end
|
60
72
|
end
|
61
73
|
end
|
62
74
|
end
|
data/lib/rsolr/cloud/version.rb
CHANGED
@@ -4,6 +4,7 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
4
4
|
before do
|
5
5
|
@zk_in_solr = ZK.new
|
6
6
|
delete_with_children(@zk_in_solr, '/live_nodes')
|
7
|
+
delete_with_children(@zk_in_solr, '/clusterprops.json')
|
7
8
|
wait_until(10) do
|
8
9
|
!@zk_in_solr.exists?('/live_nodes')
|
9
10
|
end
|
@@ -67,6 +68,15 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
67
68
|
'http://192.168.1.24:8983/solr'].sort)
|
68
69
|
end
|
69
70
|
|
71
|
+
it 'should use basic auth.' do
|
72
|
+
@subject = RSolr::Cloud::Connection.new @zk, :user => 'user1', :password => 'pass1'
|
73
|
+
expect(@subject.instance_variable_get(:@live_nodes).sort).to eq(
|
74
|
+
['http://user1:pass1@192.168.1.21:8983/solr',
|
75
|
+
'http://user1:pass1@192.168.1.22:8983/solr',
|
76
|
+
'http://user1:pass1@192.168.1.23:8983/solr',
|
77
|
+
'http://user1:pass1@192.168.1.24:8983/solr'].sort)
|
78
|
+
end
|
79
|
+
|
70
80
|
it 'should obey url scheme.' do
|
71
81
|
@zk_in_solr.create('/clusterprops.json', '{"urlScheme": "https"}')
|
72
82
|
@subject = RSolr::Cloud::Connection.new @zk
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsolr-cloud-lw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kimura
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|