td 0.16.7 → 0.16.8

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
  SHA1:
3
- metadata.gz: 0e8a82e003b9c2d6667499b111602cdca509d2c7
4
- data.tar.gz: db9933625ee612d1916878a0d8af9e6b7b533136
3
+ metadata.gz: dc8c50e05e0ed05da8a93a7b7e39f5c7577e2115
4
+ data.tar.gz: a5d08d636a3d28cf2c2a35047e3e7fe415e268d8
5
5
  SHA512:
6
- metadata.gz: e565c67246ce1ae52d3ce2c7417e6c656a09166c00878cedb9bb9b5d54025566c222944907bf8503e4589aac29a06062d222c26375995bcdab1bfd2a889b99ad
7
- data.tar.gz: caf6024add00f26ccce68cd37665bbb5b24783cc1b47d430f9ee06e4ec65fec3a57a64ce9f96bb39179eb6e4242101024e45ff83250174b436096c37f7dbd68c
6
+ metadata.gz: 7536bf0689d4f7fd05bbb1d3c7a42d8e712cfeed53dda3d3f896f3803f2aff7cc036f41c7c6cf20e9f1203e538dbad0b81791d12f346f9f0b5c7ce478066131f
7
+ data.tar.gz: 2b5872b1402f8f5302f8814e9100e8e129b65637fc66d330fc439071cc458a5e956d065307107deafe55cd168e921a663d2824789bf708f46daa43b2abe70c47
@@ -1,8 +1,5 @@
1
1
  language: ruby
2
2
 
3
- jdk:
4
- - openjdk8
5
-
6
3
  rvm:
7
4
  - 2.1.10
8
5
  - 2.2.10
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 2020-01-16 version 0.16.8
2
+
3
+ * Update default maven repository #230
4
+
1
5
  == 2019-12-16 version 0.16.7
2
6
 
3
7
  * Disable direct download in Private Connect #225
@@ -69,7 +69,7 @@ to process and Bulk load data in the Treasure Data Cloud.
69
69
 
70
70
  The Bulk Import CLI is downloaded automatically at the first call to any of the command that require it; the use will
71
71
  need internet connectivity in order to fetch the Bulk Import CLI JAR file from the
72
- {Central Maven repository}[http://central.maven.org/maven2/com/treasuredata/td-import/]
72
+ {Central Maven repository}[https://repo1.maven.org/maven2/com/treasuredata/td-import/]
73
73
  and take advantage of these advanced features. If you need to setup a proxy, please consult this
74
74
  {documentation}[https://support.treasuredata.com/hc/en-us/articles/360001502527-Legacy-Bulk-Import-Tips-and-Tricks#How%20to%20use%20a%20proxy%20server] page.
75
75
 
@@ -144,9 +144,9 @@ These are the available hooks:
144
144
 
145
145
  $ TD_TOOLBELT_UPDATE_ROOT="http://toolbelt.treasuredata.com"
146
146
 
147
- * Specify an alternative endpoint to use updating the JAR file (default: http://central.maven.org):
147
+ * Specify an alternative endpoint to use updating the JAR file (default: https://repo1.maven.org):
148
148
 
149
- $ TD_TOOLBELT_JARUPDATE_ROOT="http://central.maven.org"
149
+ $ TD_TOOLBELT_JARUPDATE_ROOT="https://repo1.maven.org"
150
150
 
151
151
 
152
152
  = Copyright
@@ -47,7 +47,7 @@ module Command
47
47
 
48
48
  # optional, if not provided a default is used from the ruby client library
49
49
  begin
50
- if Config.endpoint
50
+ if !opts[:endpoint] && Config.endpoint
51
51
  opts[:endpoint] = Config.endpoint
52
52
  end
53
53
  rescue ConfigNotFoundError => e
@@ -67,6 +67,17 @@ module Command
67
67
  Client.new(apikey, opts)
68
68
  end
69
69
 
70
+ DEFAULT_IMPORT_ENDPOINT = "https://" + TreasureData::API::DEFAULT_IMPORT_ENDPOINT
71
+
72
+ def get_import_client
73
+ import_endpoint = begin
74
+ Config.import_endpoint || DEFAULT_IMPORT_ENDPOINT
75
+ rescue TreasureData::ConfigNotFoundError
76
+ DEFAULT_IMPORT_ENDPOINT
77
+ end
78
+ get_client(endpoint: import_endpoint)
79
+ end
80
+
70
81
  def get_ssl_client(opts={})
71
82
  opts[:ssl] = true
72
83
  get_client(opts)
@@ -6,11 +6,12 @@ class Runner
6
6
  @config_path = nil
7
7
  @apikey = nil
8
8
  @endpoint = nil
9
+ @import_endpoint = nil
9
10
  @prog_name = nil
10
11
  @insecure = false
11
12
  end
12
13
 
13
- attr_accessor :apikey, :endpoint, :config_path, :prog_name, :insecure
14
+ attr_accessor :apikey, :endpoint, :import_endpoint, :config_path, :prog_name, :insecure
14
15
 
15
16
  def run(argv=ARGV)
16
17
  require 'td/version'
@@ -73,6 +74,7 @@ EOF
73
74
  config_path = @config_path
74
75
  apikey = @apikey
75
76
  endpoint = @endpoint
77
+ import_endpoint = @import_endpoint || @endpoint
76
78
  insecure = nil
77
79
  $verbose = false
78
80
  #$debug = false
@@ -94,6 +96,12 @@ EOF
94
96
  endpoint = e
95
97
  }
96
98
 
99
+ op.on('--import-endpoint API_IMPORT_SERVER', "specify the URL for API Import server to use (default: https://api-import.treasuredata.com).") { |e|
100
+ require 'td/command/common'
101
+ Command.validate_api_endpoint(e)
102
+ import_endpoint = e
103
+ }
104
+
97
105
  op.on('--insecure', "Insecure access: disable SSL (enabled by default)") {|b|
98
106
  insecure = true
99
107
  }
@@ -140,6 +148,10 @@ EOF
140
148
  Config.endpoint = endpoint
141
149
  Config.cl_endpoint = true
142
150
  end
151
+ if import_endpoint
152
+ Config.import_endpoint = import_endpoint
153
+ Config.cl_import_endpoint = true
154
+ end
143
155
  if insecure
144
156
  Config.secure = false
145
157
  end
@@ -1,5 +1,6 @@
1
1
  require 'td/helpers'
2
2
  require 'td/command/job'
3
+ require 'td/client/api'
3
4
 
4
5
  module TreasureData
5
6
  module Command
@@ -453,17 +454,18 @@ module Command
453
454
  import_params[:table_name] = table_name
454
455
  import_params[:paths] = paths
455
456
 
456
- client = get_client
457
+ api_client = get_client
458
+ import_client = get_import_client
457
459
 
458
460
  if auto_create
459
- create_database_and_table_if_not_exist(client, db_name, table_name)
461
+ create_database_and_table_if_not_exist(api_client, db_name, table_name)
460
462
  end
461
463
 
462
- do_table_import(client, import_params)
464
+ do_table_import(api_client, import_client, import_params)
463
465
  end
464
466
 
465
467
  private
466
- def do_table_import(client, import_params)
468
+ def do_table_import(api_client, import_client, import_params)
467
469
  case import_params[:format]
468
470
  when 'json', 'msgpack'
469
471
  #unless time_key
@@ -488,7 +490,7 @@ module Command
488
490
  end
489
491
 
490
492
  begin
491
- db = client.database(import_params[:db_name])
493
+ db = api_client.database(import_params[:db_name])
492
494
  rescue ForbiddenError => e
493
495
  $stdout.puts "Warning: database and table validation skipped - #{e.message}"
494
496
  else
@@ -521,7 +523,7 @@ module Command
521
523
  #require 'thread'
522
524
 
523
525
  files.zip(import_params[:paths]).each {|file, path|
524
- import_log_file(file, path, client, import_params[:db_name], import_params[:table_name], parser)
526
+ import_log_file(file, path, import_client, import_params[:db_name], import_params[:table_name], parser)
525
527
  }
526
528
 
527
529
  $stdout.puts "done."
@@ -246,14 +246,20 @@ EOF
246
246
  return false
247
247
  end
248
248
  if output =~ /openjdk version/ or output =~ /java version/
249
- m = output.match(/version "(\d+)\.(\d+)\.(\d+)(?:_(\d+))"/)
249
+ m = output.match(/version "(\d+)\.(\d+)\.(\d+)(?:_(\d+))?"/)
250
250
  if not m or m.size < 4
251
251
  return false
252
252
  end
253
- # Check for at least Java 8. Let digdag itself verify revision.
254
253
  major = m[1].to_i
255
254
  minor = m[2].to_i
256
- if major < 1 or minor < 8
255
+ # Check for at least Java 8. Let digdag itself verify revision.
256
+ if major < 1
257
+ return false
258
+ elsif major == 1 # suppose the version style: 1.8.10_52 (JDK8 and before)
259
+ if minor < 8
260
+ return false
261
+ end
262
+ elsif major < 9 # suppose the version style: 11.0.2
257
263
  return false
258
264
  end
259
265
  end
@@ -21,6 +21,9 @@ class Config
21
21
  @@endpoint = ENV['TREASURE_DATA_API_SERVER'] || ENV['TD_API_SERVER']
22
22
  @@endpoint = nil if @@endpoint == ""
23
23
  @@cl_endpoint = false # flag to indicate whether an endpoint has been provided through the command-line
24
+ @@import_endpoint = ENV['TREASURE_DATA_API_IMPORT_SERVER'] || ENV['TD_API_IMPORT_SERVER']
25
+ @@import_endpoint = nil if @@endpoint == ""
26
+ @@cl_import_endpoint = false # flag to indicate whether an endpoint has been provided through the command-line option
24
27
  @@secure = true
25
28
  @@retry_post_requests = false
26
29
 
@@ -164,6 +167,22 @@ class Config
164
167
  @@cl_endpoint = flag
165
168
  end
166
169
 
170
+ def self.import_endpoint
171
+ @@import_endpoint || Config.read['account.import_endpoint']
172
+ end
173
+
174
+ def self.import_endpoint=(endpoint)
175
+ @@import_endpoint = endpoint
176
+ end
177
+
178
+ def self.cl_import_endpoint
179
+ @@cl_import_endpoint
180
+ end
181
+
182
+ def self.cl_import_endpoint=(flag)
183
+ @@cl_import_endpoint = flag
184
+ end
185
+
167
186
  def self.workflow_endpoint
168
187
  case self.endpoint_domain
169
188
  when /\Aapi(-(?:staging|development))?(-[a-z0-9]+)?\.(connect\.)?(eu01\.)?treasuredata\.(com|co\.jp)\z/i
@@ -176,10 +195,9 @@ class Config
176
195
  # renders the apikey and endpoint options as a string for the helper commands
177
196
  def self.cl_options_string
178
197
  string = ""
179
- string += "-k #{@@apikey}" if @@cl_apikey
180
- string += " " unless string.empty?
181
- string += "-e #{@@endpoint}" if @@cl_endpoint
182
- string += " " unless string.empty?
198
+ string += "-k #{@@apikey} " if @@cl_apikey
199
+ string += "-e #{@@endpoint} " if @@cl_endpoint
200
+ string += "--import-endpoint #{@@import_endpoint} " if @@cl_import_endpoint
183
201
  string
184
202
  end
185
203
 
@@ -270,7 +270,7 @@ end # module ModuleDefinition
270
270
  extend ModuleDefinition
271
271
 
272
272
  def maven_repo_root
273
- ENV['TD_TOOLBELT_JARUPDATE_ROOT'] || "http://central.maven.org"
273
+ ENV['TD_TOOLBELT_JARUPDATE_ROOT'] || "https://repo1.maven.org"
274
274
  end
275
275
 
276
276
  private
@@ -1,3 +1,3 @@
1
1
  module TreasureData
2
- TOOLBELT_VERSION = '0.16.7'
2
+ TOOLBELT_VERSION = '0.16.8'
3
3
  end
@@ -302,6 +302,7 @@ module TreasureData::Command
302
302
  let(:db_name) { 'database' }
303
303
  let(:table_name) { 'table' }
304
304
  let(:client) { double('client') }
305
+ let(:import_client) { double('import-client') }
305
306
  let(:command) { Class.new { include TreasureData::Command }.new }
306
307
 
307
308
  describe 'auto create table' do
@@ -336,6 +337,7 @@ module TreasureData::Command
336
337
  describe 'time key' do
337
338
  before do
338
339
  allow(command).to receive(:get_client) { client }
340
+ allow(command).to receive(:get_import_client) { import_client }
339
341
  allow(command).to receive(:do_table_import)
340
342
  end
341
343
  let(:input_params) {{
@@ -355,7 +357,7 @@ module TreasureData::Command
355
357
  end
356
358
 
357
359
  it "with '#{tk_option}' option" do
358
- expect(command).to receive(:do_table_import).with(client, input_params)
360
+ expect(command).to receive(:do_table_import).with(client, import_client, input_params)
359
361
  command.table_import(option)
360
362
  end
361
363
  end
@@ -371,7 +373,7 @@ module TreasureData::Command
371
373
  end
372
374
 
373
375
  it 'without \'-t / --time-key\' option' do
374
- expect(command).to receive(:do_table_import).with(client, input_params)
376
+ expect(command).to receive(:do_table_import).with(client, import_client, input_params)
375
377
  command.table_import(option)
376
378
  end
377
379
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.7
4
+ version: 0.16.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Treasure Data, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack