Skip to content

Commit

Permalink
fix dot-prefixed pod files
Browse files Browse the repository at this point in the history
  • Loading branch information
bverschueren committed Nov 29, 2024
1 parent 2861e60 commit 992fa33
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,17 @@ func getNamespacedResources(resourceNamePlural string, resourceGroup string, res
if resourceNamePlural == "pods" {
// tranverse the pods directory and fill in UnstructuredItems.Items
podsDir := fmt.Sprintf("%s/namespaces/%s/pods", vars.MustGatherRootPath, namespace)
pods, _ := ioutil.ReadDir(podsDir)
pods, _ := os.ReadDir(podsDir)
for _, pod := range pods {
// skip dot-prefixed files (e.g. "AppleDouble encoded Macintosh file")
if pod.Name()[0] == '.' {
continue
}
podName := pod.Name()
podPath := fmt.Sprintf("%s/%s/%s.yaml", podsDir, podName, podName)
_file, err := ioutil.ReadFile(podPath)
if err != nil {
fmt.Fprintln(os.Stderr, "error: namespace "+namespace+" not found.")
fmt.Fprintln(os.Stderr, "error reading %s: %s", podPath, err)

Check failure on line 246 in cmd/get/get.go

View workflow job for this annotation

GitHub Actions / build

fmt.Fprintln call has possible Printf formatting directive %s
os.Exit(1)
}
var podItem unstructured.Unstructured
Expand Down Expand Up @@ -269,7 +273,6 @@ func getNamespacedResources(resourceNamePlural string, resourceGroup string, res
}
}


func getNamespacesResources(resourceNamePlural string, resourceGroup string, resources map[string]struct{}) {
if len(resources) > 0 {
for namespace := range resources {
Expand Down

0 comments on commit 992fa33

Please sign in to comment.