mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
Bug fix IsKustomizeDirectory returning parent dir
Signed-off-by: Mehdi Moussaif <m.moussaif42@gmail.com>
This commit is contained in:
@@ -25,9 +25,7 @@ func IsKustomizeDirectory(path string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if lastChar := path[len(path)-1:]; lastChar != "/" {
|
||||
path += "/"
|
||||
}
|
||||
path = cleanPathDir(path)
|
||||
|
||||
matches := 0
|
||||
for _, kustomizationFileMatcher := range kustomizationFileMatchers {
|
||||
@@ -71,9 +69,20 @@ func GetKustomizeDirectoryName(path string) string {
|
||||
if isKustomizeDirectory := IsKustomizeDirectory(path); !isKustomizeDirectory {
|
||||
return ""
|
||||
}
|
||||
|
||||
path = cleanPathDir(path)
|
||||
|
||||
return filepath.Dir(path)
|
||||
}
|
||||
|
||||
func cleanPathDir(path string) string {
|
||||
if lastChar := path[len(path)-1:]; lastChar != "/" {
|
||||
path += "/"
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
// Get Workloads, creates the yaml files(K8s resources) using Kustomize and
|
||||
// renders the workloads from the yaml files (k8s resources)
|
||||
func (kd *KustomizeDirectory) GetWorkloads(kustomizeDirectoryPath string) (map[string][]workloadinterface.IMetadata, []error) {
|
||||
|
||||
Reference in New Issue
Block a user