Skip to content

Commit a29b843

Browse files
committed
move command debug logging to the actual backup routine
1 parent 7bb3ba7 commit a29b843

3 files changed

Lines changed: 21 additions & 35 deletions

File tree

cmd/ubackup/backup.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@ func runBackup(ctx context.Context, logger *log.Logger) error {
116116
return nil
117117
}
118118

119+
func backupOneContainer(
120+
ctx context.Context,
121+
target ubtypes.BackupTarget,
122+
conf ubconfig.Config,
123+
logger *log.Logger,
124+
) error {
125+
return ubbackup.BackupAndStore(ctx, ubtypes.BackupForTarget(target), conf, func(backupSink io.Writer) error {
126+
dockerExecCmd := append([]string{
127+
"docker",
128+
"exec",
129+
target.TaskId,
130+
}, target.BackupCommand...)
131+
132+
return copyCommandStdout(
133+
exec.Command(dockerExecCmd[0], dockerExecCmd[1:]...),
134+
backupSink)
135+
}, logger)
136+
}
137+
119138
func copyCommandStdout(cmd *exec.Cmd, backupSink io.Writer) error {
120139
cmd.Stderr = os.Stderr
121140
stdout, err := cmd.StdoutPipe()

cmd/ubackup/dockercontainerbackup.go

Lines changed: 0 additions & 35 deletions
This file was deleted.

pkg/ubbackup/backup.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ func BackupAndStore(
2828

2929
logl.Info.Printf("starting (%s)", backup.Target.TaskId)
3030

31+
logl.Debug.Printf("command: %v", backup.Target.BackupCommand)
32+
3133
// we've to create a temp file because some storages (I'm looking at you, S3) need a seekable reader
3234
tempFile, err := ioutil.TempFile("", "ubackup")
3335
if err != nil {

0 commit comments

Comments
 (0)