Skip to content

Commit 8860b5a

Browse files
committed
[deckhouse-cli] handle custom tmp directory
Signed-off-by: kerimov <[email protected]>
1 parent c7ae07a commit 8860b5a

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

internal/mirror/cmd/pull/pull.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func buildPullParams(logger params.Logger) *params.PullParams {
172172
BundleDir: ImagesBundlePath,
173173
WorkingDir: filepath.Join(
174174
TempDir,
175+
"mirror",
175176
"pull",
176177
fmt.Sprintf("%x", md5.Sum([]byte(SourceRegistryRepo))),
177178
),

internal/mirror/cmd/pull/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func validateChunkSizeFlag() error {
137137

138138
func validateTmpPath(args []string) error {
139139
if TempDir == "" {
140-
TempDir = filepath.Join(ImagesBundlePath, ".tmp", "mirror")
140+
TempDir = filepath.Join(ImagesBundlePath, ".tmp")
141141
}
142142
if err := os.MkdirAll(TempDir, 0755); err != nil {
143143
return fmt.Errorf("Error creating temp directory at %s: %w", TempDir, err)

internal/mirror/cmd/push/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func buildPushParams(logger params.Logger) *params.PushParams {
205205
RegistryPath: RegistryPath,
206206
ModulesPathSuffix: ModulesPathSuffix,
207207
BundleDir: ImagesBundlePath,
208-
WorkingDir: filepath.Join(TempDir, "push"),
208+
WorkingDir: filepath.Join(TempDir, "mirror", "push"),
209209
},
210210

211211
Parallelism: params.ParallelismConfig{

internal/mirror/cmd/push/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ func validateImagesBundlePathArg(args []string) error {
6969
}
7070

7171
if TempDir == "" {
72-
TempDir = filepath.Join(ImagesBundlePath, ".tmp", "mirror")
72+
TempDir = filepath.Join(ImagesBundlePath, ".tmp")
7373
}
7474

7575
return nil
7676
}
7777

7878
if bundleExtension := filepath.Ext(ImagesBundlePath); bundleExtension == ".tar" || bundleExtension == ".chunk" {
7979
if TempDir == "" {
80-
TempDir = filepath.Join(filepath.Dir(ImagesBundlePath), ".tmp", "mirror")
80+
TempDir = filepath.Join(filepath.Dir(ImagesBundlePath), ".tmp")
8181
}
8282
return nil
8383
}

0 commit comments

Comments
 (0)