aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2023-03-23 15:04:26 +0100
committerGitHub <noreply@github.com>2023-03-23 15:04:26 +0100
commit275fee0246a0ae6f143638ba88dc4cd4eaa20cc8 (patch)
treea69412dee6b4d8c8793cd368e8d89e0eb89778c5 /client
parente8e799389edff3f2ef86bd4e4b0639a8f1b8969d (diff)
parentcfce61a71c88cea805f375c526d9efd9c324cf0f (diff)
Merge pull request #26548 from vespa-engine/hmusum/use-tmp-for-persisting-data-with-vespa-deploy-take-2
Create dir to persist vespa-deploy data in temp dir
Diffstat (limited to 'client')
-rw-r--r--client/go/internal/admin/deploy/persist.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/client/go/internal/admin/deploy/persist.go b/client/go/internal/admin/deploy/persist.go
index e52642693fb..b109b6489f0 100644
--- a/client/go/internal/admin/deploy/persist.go
+++ b/client/go/internal/admin/deploy/persist.go
@@ -6,6 +6,7 @@ package deploy
import (
"os"
+ "os/user"
"path/filepath"
"github.com/vespa-engine/vespa/client/go/internal/admin/trace"
@@ -13,37 +14,38 @@ import (
)
const (
- cloudconfigDir = ".cloudconfig"
+ vespaDeployDir = "vespa-deploy"
configsourceUrlUsedFileName = "deploy-configsource-url-used"
sessionIdFileName = "deploy-session-id"
)
-func createCloudconfigDir() (string, error) {
- userHome, err := os.UserHomeDir()
+func createVespaDeployDir() (string, error) {
+ tempDir := os.TempDir()
+ currentUser, err := user.Current()
if err != nil {
return "", err
}
- home := filepath.Join(userHome, cloudconfigDir)
- if err := os.MkdirAll(home, 0700); err != nil {
+ vespaDeployTempDir := filepath.Join(tempDir, currentUser.Username, vespaDeployDir)
+ if err := os.MkdirAll(vespaDeployTempDir, 0700); err != nil {
return "", err
}
- return home, nil
+ return vespaDeployTempDir, nil
}
func configsourceUrlUsedFile() string {
- home, err := createCloudconfigDir()
+ vespaDeployTempDir, err := createVespaDeployDir()
if err != nil {
- home = "/tmp"
+ vespaDeployTempDir = "/tmp"
}
- return filepath.Join(home, configsourceUrlUsedFileName)
+ return filepath.Join(vespaDeployTempDir, configsourceUrlUsedFileName)
}
func createTenantDir(tenant string) string {
- home, err := createCloudconfigDir()
+ vespaDeployTempDir, err := createVespaDeployDir()
if err != nil {
util.JustExitWith(err)
}
- tdir := filepath.Join(home, tenant)
+ tdir := filepath.Join(vespaDeployTempDir, tenant)
if err := os.MkdirAll(tdir, 0700); err != nil {
util.JustExitWith(err)
}