elasticsearch-transport 7.10.0.pre → 7.10.0

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: 64ed0d4e52c93d1bfaabaef470e71308ac9961da744584f770283f605131e3ac
4
- data.tar.gz: 40b0baa58407ef49ac9fac314fbd9f84df3c8408d7312132ebe8f19cb1f5e35c
3
+ metadata.gz: cec988f9a2a79c9458bc3974d3d52a541cba9b230de23b96df5f74a913de6524
4
+ data.tar.gz: 2eb97ff41d033724456132546b642663074dc5859fe2f8a9aa9973dbbf85342d
5
5
  SHA512:
6
- metadata.gz: 24eefe245bb7fc61431b6798d0898bbadc4c0fafbefa6303b61336e4673df8e37f6ae71e0dc107ea0c446821a0d8138ebad16380a13b8dcb2ce5ee3c762acd8f
7
- data.tar.gz: 8b790e93528ae4c3db68a7f63272f2cf0eefc3e9a8b66d2e2d1b8b8bd6dea67cdb180789e2df824cdc50eb90c8ef669fb7968f370c13d34d27dc2f3329ca5e53
6
+ metadata.gz: df0608bf2a72da4d41ce9f7884d63f1279deccd317e1a8379846cee95d556d8f8c91af31049c6d1206b8a28087f4706f655c9a0429beda386d33b82a683dce09
7
+ data.tar.gz: 8c37e0c4e02c890241981f42be1a9823d91e9c0c9d010e7193d3a46069448965752495a2e447db15a0f6318d35152c31162a997f3093958cd8e02f623e812cf9
File without changes
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
40
40
  s.require_paths = ['lib']
41
41
 
42
- s.extra_rdoc_files = [ 'README.md', 'LICENSE.txt' ]
42
+ s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
43
43
  s.rdoc_options = [ '--charset=UTF-8' ]
44
44
 
45
45
  s.required_ruby_version = '>= 2.4'
@@ -190,17 +190,25 @@ module Elasticsearch
190
190
  end
191
191
 
192
192
  def extract_cloud_creds(arguments)
193
- return unless arguments[:cloud_id]
193
+ return unless arguments[:cloud_id] && !arguments[:cloud_id].empty?
194
194
 
195
195
  name = arguments[:cloud_id].split(':')[0]
196
196
  cloud_url, elasticsearch_instance = Base64.decode64(arguments[:cloud_id].gsub("#{name}:", '')).split('$')
197
+
198
+ if cloud_url.include?(':')
199
+ url, port = cloud_url.split(':')
200
+ host = "#{elasticsearch_instance}.#{url}"
201
+ else
202
+ host = "#{elasticsearch_instance}.#{cloud_url}"
203
+ port = arguments[:port] || DEFAULT_CLOUD_PORT
204
+ end
197
205
  [
198
206
  {
199
207
  scheme: 'https',
200
208
  user: arguments[:user],
201
209
  password: arguments[:password],
202
- host: "#{elasticsearch_instance}.#{cloud_url}",
203
- port: arguments[:port] || DEFAULT_CLOUD_PORT
210
+ host: host,
211
+ port: port.to_i
204
212
  }
205
213
  ]
206
214
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module Transport
20
- VERSION = "7.10.0.pre"
20
+ VERSION = "7.10.0"
21
21
  end
22
22
  end
@@ -433,6 +433,51 @@ describe Elasticsearch::Transport::Client do
433
433
  ).to eq('https://elasticfantastic:changeme@abcd.localhost:9243')
434
434
  end
435
435
  end
436
+
437
+ context 'when the cloud host provides a port' do
438
+ let(:client) do
439
+ described_class.new(
440
+ cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk',
441
+ user: 'elastic',
442
+ password: 'changeme'
443
+ )
444
+ end
445
+
446
+ let(:hosts) do
447
+ client.transport.hosts
448
+ end
449
+
450
+ it 'creates the correct full url' do
451
+ expect(hosts[0][:host]).to eq('elastic_id.elastic_server')
452
+ expect(hosts[0][:protocol]).to eq('https')
453
+ expect(hosts[0][:user]).to eq('elastic')
454
+ expect(hosts[0][:password]).to eq('changeme')
455
+ expect(hosts[0][:port]).to eq(9243)
456
+ end
457
+ end
458
+
459
+ context 'when the cloud host provides a port and the port is also specified' do
460
+ let(:client) do
461
+ described_class.new(
462
+ cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk',
463
+ user: 'elastic',
464
+ password: 'changeme',
465
+ port: 9200
466
+ )
467
+ end
468
+
469
+ let(:hosts) do
470
+ client.transport.hosts
471
+ end
472
+
473
+ it 'creates the correct full url' do
474
+ expect(hosts[0][:host]).to eq('elastic_id.elastic_server')
475
+ expect(hosts[0][:protocol]).to eq('https')
476
+ expect(hosts[0][:user]).to eq('elastic')
477
+ expect(hosts[0][:password]).to eq('changeme')
478
+ expect(hosts[0][:port]).to eq(9243)
479
+ end
480
+ end
436
481
  end
437
482
 
438
483
  shared_examples_for 'a client that extracts hosts' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.10.0.pre
4
+ version: 7.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -362,11 +362,11 @@ executables: []
362
362
  extensions: []
363
363
  extra_rdoc_files:
364
364
  - README.md
365
- - LICENSE.txt
365
+ - LICENSE
366
366
  files:
367
367
  - ".gitignore"
368
368
  - Gemfile
369
- - LICENSE.txt
369
+ - LICENSE
370
370
  - README.md
371
371
  - Rakefile
372
372
  - elasticsearch-transport.gemspec
@@ -423,9 +423,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
423
423
  version: '2.4'
424
424
  required_rubygems_version: !ruby/object:Gem::Requirement
425
425
  requirements:
426
- - - ">"
426
+ - - ">="
427
427
  - !ruby/object:Gem::Version
428
- version: 1.3.1
428
+ version: '0'
429
429
  requirements: []
430
430
  rubygems_version: 3.1.2
431
431
  signing_key: