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 +4 -4
- data/lib/bricolage/mysqldatasource.rb +32 -11
- data/lib/bricolage/version.rb +1 -1
- data/libexec/mys3dump.jar +0 -0
- data/libexec/sqldump.Darwin +0 -0
- data/libexec/sqldump.Linux +0 -0
- data/test/home/Gemfile.lock +1 -1
- data/test/home/subsys/my-import.job +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54eb8ff011e173d9091a2945ef189097c5fc055e
|
4
|
+
data.tar.gz: c68f93bf30468fdcb221c09d0c81e43d8f9a58be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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, "
|
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
|
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, "
|
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 = {
|
249
|
-
|
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
|
|
data/lib/bricolage/version.rb
CHANGED
data/libexec/mys3dump.jar
CHANGED
Binary file
|
data/libexec/sqldump.Darwin
CHANGED
Binary file
|
data/libexec/sqldump.Linux
CHANGED
Binary file
|
data/test/home/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ src-ds: mysql
|
|
3
3
|
src-tables:
|
4
4
|
users: main.users
|
5
5
|
s3-ds: s3
|
6
|
-
s3-prefix:
|
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
|