Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit b23efad

Browse files
committed
Remove functionality to create directories
1 parent 53adebd commit b23efad

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

cmd/internal/kube/secret.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,17 @@ func createSecretFile(path string) (*os.File, error) {
114114
return nil, errors.Wrapf(err, "failed to resolve the absolute path of the output directory")
115115
}
116116

117+
// Check that the output directory exists
118+
if _, statErr := os.Stat(absOutputDir); os.IsNotExist(statErr) {
119+
return nil, errors.Errorf("output directory %s does not exist", absOutputDir)
120+
}
121+
117122
// Check if the output file already exists
118123
outputFilePath := filepath.Join(absOutputDir, outputName)
119124
if _, statErr := os.Stat(outputFilePath); statErr == nil {
120125
return nil, errors.Errorf("output file %s already exists", outputFilePath)
121126
}
122127

123-
// Create the output directory if it doesn't exist
124-
err = os.MkdirAll(absOutputDir, 0755)
125-
if err != nil {
126-
return nil, errors.Wrapf(err, "failed to create the output directory")
127-
}
128-
129128
// Create the output file in the output directory
130129
outputFile, err := os.Create(outputFilePath)
131130
if err != nil {

cmd/internal/kube/secret_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Test_secretGeneration(t *testing.T) {
2020
)
2121

2222
dir := t.TempDir()
23-
actualOutput := filepath.Join(dir, "configurations", "akita-secret.yml")
23+
actualOutput := filepath.Join(dir, "akita-secret.yml")
2424

2525
// WHEN
2626
actualContent, err := handleSecretGeneration(namespace, key, secret, actualOutput)

0 commit comments

Comments
 (0)