Skip to content

Commit 08067ca

Browse files
hossainemruztamalsaha
authored andcommitted
Fix arguments passing (#17)
1 parent 0c1db21 commit 08067ca

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pkg/backup.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pkg
22

33
import (
44
"path/filepath"
5+
"strings"
56

67
"github.com/appscode/go/flags"
78
"github.com/spf13/cobra"
@@ -145,8 +146,8 @@ func (opt *postgresOptions) backupPostgreSQL() (*restic.BackupOutput, error) {
145146
"-h", appBinding.Spec.ClientConfig.Service.Name,
146147
},
147148
}
148-
if opt.pgArgs != "" {
149-
opt.backupOptions.StdinPipeCommand.Args = append(opt.backupOptions.StdinPipeCommand.Args, opt.pgArgs)
149+
for _, arg := range strings.Fields(opt.pgArgs) {
150+
opt.backupOptions.StdinPipeCommand.Args = append(opt.backupOptions.StdinPipeCommand.Args, arg)
150151
}
151152

152153
// wait for DB ready

pkg/restore.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pkg
22

33
import (
44
"path/filepath"
5+
"strings"
56

67
"github.com/appscode/go/flags"
78
"github.com/spf13/cobra"
@@ -137,8 +138,8 @@ func (opt *postgresOptions) restorePostgreSQL() (*restic.RestoreOutput, error) {
137138
"-h", appBinding.Spec.ClientConfig.Service.Name,
138139
},
139140
}
140-
if opt.pgArgs != "" {
141-
opt.dumpOptions.StdoutPipeCommand.Args = append(opt.dumpOptions.StdoutPipeCommand.Args, opt.pgArgs)
141+
for _, arg := range strings.Fields(opt.pgArgs) {
142+
opt.dumpOptions.StdoutPipeCommand.Args = append(opt.dumpOptions.StdoutPipeCommand.Args, arg)
142143
}
143144

144145
// wait for DB ready

0 commit comments

Comments
 (0)