8000 force call of checkIsEmptyDir only if is dir · kubernetes/kompose@ffbe054 · GitHub
[go: up one dir, main page]

Skip to content

Commit ffbe054

Browse files
committed
force call of checkIsEmptyDir only if is dir
1 parent 6dcc6df commit ffbe054

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/transformer/kubernetes/k8sutils.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -1240,17 +1240,17 @@ func isConfigFile(filePath string) (useConfigMap bool, readonly bool, skip bool)
12401240

12411241
fi, err := os.Stat(filePath)
12421242
if err != nil {
1243-
log.Errorf("File don't exist or failed to check if the directory is empty: %v", err)
1243+
log.Warnf("File don't exist or failed to check if the directory is empty: %v", err)
12441244
// dir/file not exist
12451245
// here not assigned skip to true,
12461246
// maybe dont want to skip
12471247
return
12481248
}
12491249

1250-
if !fi.Mode().IsRegular() { // is dir
1250+
if fi.Mode().IsDir() { // is dir
12511251
isDirEmpty, err := checkIsEmptyDir(filePath)
12521252
if err != nil {
1253-
log.Debugf("Failed to check if the directory is empty: %v", err)
1253+
log.Warnf("Failed to check if the directory is empty: %v", err)
12541254
skip = true
12551255
return
12561256
}
@@ -1266,7 +1266,6 @@ func isConfigFile(filePath string) (useConfigMap bool, readonly bool, skip bool)
12661266
func checkIsEmptyDir(filePath string) (bool, error) {
12671267
files, err := os.ReadDir(filePath)
12681268
if err != nil {
1269-
log.Errorf("ReadDir of %s failed !", filePath)
12701269
return false, err
12711270
}
12721271
if len(files) == 0 {

0 commit comments

Comments
 (0)
0