bricolage 5.20.4 → 5.20.5

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: 26539773f2494fbfad668fc6865ea15d8e6e42be
4
- data.tar.gz: bad48dfdce6017bde0e1a493b9075812e3155d66
3
+ metadata.gz: 54eb8ff011e173d9091a2945ef189097c5fc055e
4
+ data.tar.gz: c68f93bf30468fdcb221c09d0c81e43d8f9a58be
5
5
  SHA512:
6
- metadata.gz: 839058660738526f1dc04b9da384ab84207885da21da8c388fb9397e36122fac517b07da8aad3b183525aaa353fb787c00c505f68e312cef6a13de02473949c0
7
- data.tar.gz: 0b81d23d4dad5bb8b51e0f7200bb980e8b6de2647c81bed70886bb87d77351a885c241819a5cf81ed4da6bf084794a92163feadb7454a0dbc5041e1695e81cb4
6
+ metadata.gz: aa8293db93a8df5d17dc69827d6ad4f18638e6dfb0e79af33a40f26cebced6d4b682f83078df8105f512909d58f10513f292f2e1197940b25244dcbee975691a
7
+ data.tar.gz: 3f2ddade13d2cb6662624c91fde4fb1223eeeeba084256c5008084867577e4ef7c04f5e628c66a98200c92c907ddb0565207a9b0f3224bf55338a55012d00b54
@@ -100,7 +100,7 @@ module Bricolage
100
100
  end
101
101
 
102
102
  def export_by_sqldump
103
- cmds = [[sqldump_path.to_s, "--#{@format}", ds.host, ds.port.to_s, ds.username, ds.password, ds.database, @statement.stripped_source]]
103
+ cmds = [[{"SQLDUMP_PASSWORD" => ds.password}, sqldump_path.to_s, "--#{@format}", ds.host, ds.port.to_s, ds.username, ds.database, @statement.stripped_source]]
104
104
  cmds.push [GZIP_COMMAND] if @gzip
105
105
  cmds.last.push({out: @path.to_s})
106
106
  ds.logger.info '[CMD] ' + format_pipeline(cmds)
@@ -108,14 +108,13 @@ module Bricolage
108
108
  statuses.each_with_index do |st, idx|
109
109
  unless st.success?
110
110
  cmd = cmds[idx].first
111
- raise JobFailure, "#{cmd} failed (status #{st.to_i})"
111
+ raise JobFailure, "sqldump failed (status #{st.to_i})"
112
112
  end
113
113
  end
114
114
  end
115
115
 
116
116
  def format_pipeline(cmds)
117
- cmds = cmds.map {|args| args.dup }
118
- cmds.first[5] = '****'
117
+ cmds = cmds.map {|args| args[0].kind_of?(Hash) ? args[1..-1] : args.dup } # do not show env
119
118
  cmds.map {|args| %Q("#{args.join('" "')}") }.join(' | ')
120
119
  end
121
120
 
@@ -231,22 +230,44 @@ module Bricolage
231
230
  end
232
231
 
233
232
  def s3export
234
- cmd = build_cmd(command_parameters)
235
- ds.logger.info '[CMD] ' + cmd.join(' ')
233
+ cmd = build_cmd(environment_variables, command_parameters)
234
+ ds.logger.info "[CMD] #{format_cmd(cmd)}"
236
235
  Open3.popen2e(*cmd) do |input, output, thread|
237
236
  input.close
238
237
  output.each do |line|
239
238
  puts line
240
239
  end
241
240
  unless thread.value.success?
242
- raise JobFailure, "#{cmd.join(' ')} failed (status #{thread.value.to_i})"
241
+ raise JobFailure, "mys3dump failed (status #{thread.value.to_i})"
243
242
  end
244
243
  end
245
244
  end
246
245
 
246
+ def format_cmd(cmd)
247
+ cmd[1..-1].join(' ') # do not show env
248
+ end
249
+
250
+ def environment_variables
251
+ {
252
+ 'AWS_ACCESS_KEY_ID' => @s3ds.access_key,
253
+ 'AWS_SECRET_ACCESS_KEY' => @s3ds.secret_key,
254
+ 'MYS3DUMP_PASSWORD' => ds.password
255
+ }
256
+ end
257
+
247
258
  def command_parameters
248
- params = {jar: mys3dump_path.to_s, h: ds.host, P: ds.port.to_s, D: ds.database, u: ds.username, p: ds.password, o: connection_property, t: @table,
249
- 'Daws.accessKeyId' => @s3ds.access_key, 'Daws.secretKey' => @s3ds.secret_key, b: @s3ds.bucket.name, x: @prefix}
259
+ params = {
260
+ jar: mys3dump_path.to_s,
261
+ h: ds.host,
262
+ P: ds.port.to_s,
263
+ D: ds.database,
264
+ u: ds.username,
265
+ #p: ds.password,
266
+ o: connection_property,
267
+ t: @table,
268
+ b: @s3ds.bucket.name,
269
+ x: @prefix
270
+ }
250
271
  params[:q] = @statement.stripped_source.chomp(';') if @statement
251
272
  params[:f] = @format if @format
252
273
  params[:C] = nil if @gzip
@@ -285,8 +306,8 @@ module Bricolage
285
306
  Pathname(__dir__).parent.parent + "libexec/mys3dump.jar"
286
307
  end
287
308
 
288
- def build_cmd(options)
289
- ['java'] + options.flat_map {|k, v| v ? ["-#{k}", v.to_s] : ["-#{k}"] }
309
+ def build_cmd(environ, options)
310
+ [environ, 'java'] + options.flat_map {|k, v| v ? ["-#{k}", v.to_s] : ["-#{k}"] }
290
311
  end
291
312
  end
292
313
 
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.20.4'
3
+ VERSION = '5.20.5'
4
4
  end
data/libexec/mys3dump.jar CHANGED
Binary file
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- bricolage (5.20.3)
4
+ bricolage (5.20.5)
5
5
  aws-sdk (~> 2)
6
6
  mysql2
7
7
  pg (~> 0.18.0)
@@ -3,7 +3,7 @@ src-ds: mysql
3
3
  src-tables:
4
4
  users: main.users
5
5
  s3-ds: s3
6
- s3-prefix: shimpeko/test-abc-
6
+ s3-prefix: $test_schema/test-abc-
7
7
  gzip: true
8
8
  dump-options:
9
9
  src_zone_offset: "+00:00"
@@ -24,7 +24,7 @@ options:
24
24
  #acceptanydate: true
25
25
  #dateformat: "auto"
26
26
  #timeformat: "auto"
27
- vacuum-sort: true
27
+ #vacuum-sort: true
28
28
  analyze: true
29
29
  grant:
30
30
  privilege: select
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricolage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.20.4
4
+ version: 5.20.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki