kamal-backup 0.3.0.beta10 → 0.3.0.beta12
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/kamal_backup/cli.rb +4 -0
- data/lib/kamal_backup/restic.rb +18 -2
- data/lib/kamal_backup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42ee96d9a7a664d18460f7143c466ebe6d6d75a70031c0c75a070fae2e3fa64b
|
|
4
|
+
data.tar.gz: 02bc406f76d5010cd9c382c5b6ea4d17bb8dce0dab50d2742d86bec9e7bb93cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45d35e27cb88d61a8996ed5b2158fc59e3f9ef51b615e88919efd83d6174b044d60984d8be5ac15d937229c5b2a9ded61f90053afb5a6569ddb2f8c824b88bad
|
|
7
|
+
data.tar.gz: 5d0c18b5faf002497831421773ede6b4d50805fdb8d70490c6746b0229f06cf44b59a1c2683913439f4de186aeb2388c69acd97f965d52e266b8921ed4fb2a86
|
data/lib/kamal_backup/cli.rb
CHANGED
|
@@ -429,6 +429,10 @@ module KamalBackup
|
|
|
429
429
|
output ||= CommandOutput.new(io: $stderr, env: env)
|
|
430
430
|
output.error("(#{e.class}): #{e.message}", redactor: Redactor.new(env: env))
|
|
431
431
|
exit(1)
|
|
432
|
+
rescue StandardError => e
|
|
433
|
+
output ||= CommandOutput.new(io: $stderr, env: env)
|
|
434
|
+
output.error("(#{e.class}): #{e.message}", redactor: Redactor.new(env: env))
|
|
435
|
+
exit(1)
|
|
432
436
|
rescue Interrupt
|
|
433
437
|
output ||= CommandOutput.new(io: $stderr, env: env)
|
|
434
438
|
output.error("(Interrupt): interrupted", redactor: Redactor.new(env: env))
|
data/lib/kamal_backup/restic.rb
CHANGED
|
@@ -48,13 +48,20 @@ module KamalBackup
|
|
|
48
48
|
Open3.popen3(command.env, *command.argv) do |stdin, stdout, stderr, wait_thread|
|
|
49
49
|
stdout_reader = Thread.new { Command.collect_stream(stdout, command_output: output, context: context, stream: :stdout, redactor: redactor) }
|
|
50
50
|
stderr_reader = Thread.new { Command.collect_stream(stderr, command_output: output, context: context, stream: :stderr, redactor: redactor) }
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
copy_error = nil
|
|
52
|
+
begin
|
|
53
|
+
IO.copy_stream(file, stdin)
|
|
54
|
+
rescue Errno::EPIPE => e
|
|
55
|
+
copy_error = e
|
|
56
|
+
ensure
|
|
57
|
+
stdin.close unless stdin.closed?
|
|
58
|
+
end
|
|
53
59
|
out = stdout_reader.value
|
|
54
60
|
err = stderr_reader.value
|
|
55
61
|
status = wait_thread.value
|
|
56
62
|
output&.command_exit(context, status.exitstatus)
|
|
57
63
|
raise_command_error(command, status, out, err) unless status.success?
|
|
64
|
+
raise_stream_error(command, copy_error, out, err) if copy_error
|
|
58
65
|
|
|
59
66
|
CommandResult.new(stdout: out, stderr: err, status: status.exitstatus)
|
|
60
67
|
end
|
|
@@ -309,6 +316,15 @@ module KamalBackup
|
|
|
309
316
|
)
|
|
310
317
|
end
|
|
311
318
|
|
|
319
|
+
def raise_stream_error(command, error, stdout, stderr)
|
|
320
|
+
raise CommandError.new(
|
|
321
|
+
"failed to stream file to #{command.display(redactor)}: #{error.message}\n#{redactor.redact_string(stderr)}",
|
|
322
|
+
command: command,
|
|
323
|
+
stdout: redactor.redact_string(stdout),
|
|
324
|
+
stderr: redactor.redact_string(stderr)
|
|
325
|
+
)
|
|
326
|
+
end
|
|
327
|
+
|
|
312
328
|
def write_last_check(payload)
|
|
313
329
|
FileUtils.mkdir_p(config.state_dir)
|
|
314
330
|
File.write(config.last_check_path, JSON.pretty_generate(payload.transform_values { |value| value.respond_to?(:iso8601) ? value.iso8601 : redactor.redact_string(value.to_s) }))
|
data/lib/kamal_backup/version.rb
CHANGED