jobsite/manager: create export directory
Be a bit more friendly and actually create the export directory instead of assuming it exists.
This commit is contained in:
parent
1150f0f27e
commit
b9584099ab
1 changed files with 11 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ import (
|
|||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
|
|
@ -366,6 +367,16 @@ func StepExport() error {
|
|||
return
|
||||
}
|
||||
|
||||
dstPath := path.Join(argOutputPath, export)
|
||||
dstDir := filepath.Dir(dstPath)
|
||||
|
||||
if _, err := os.Stat(dstDir); os.IsNotExist(err) {
|
||||
logrus.Infof("StepExport: Destination directory does not exist. Creating %s", dstDir)
|
||||
if err := os.MkdirAll(dstDir, 0700); err != nil {
|
||||
errs <- fmt.Errorf("StepExport: Failed to create destination directory: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
dst, err := os.OpenFile(
|
||||
path.Join(argOutputPath, export),
|
||||
os.O_WRONLY|os.O_CREATE|os.O_EXCL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue