diff --git a/pkg/analyze/collected_contents.go b/pkg/analyze/collected_contents.go index 753a6a65c..8d5e8a228 100644 --- a/pkg/analyze/collected_contents.go +++ b/pkg/analyze/collected_contents.go @@ -6,6 +6,7 @@ import ( "github.com/pkg/errors" "github.com/replicatedhq/troubleshoot/pkg/constants" + "github.com/replicatedhq/troubleshoot/pkg/types" ) type collectedContent struct { @@ -33,6 +34,9 @@ func retrieveCollectedContents( // Local data not available, move to remote collection nodeListContents, err := getCollectedFileContents(constants.NODE_LIST_FILE) if err != nil { + if _, ok := err.(*types.NotFoundError); ok { + return collectedContents, nil + } return nil, errors.Wrap(err, "failed to get node list") } diff --git a/pkg/analyze/collected_contents_test.go b/pkg/analyze/collected_contents_test.go index c7200b4db..92d09d701 100644 --- a/pkg/analyze/collected_contents_test.go +++ b/pkg/analyze/collected_contents_test.go @@ -78,7 +78,7 @@ func TestRetrieveCollectedContents(t *testing.T) { remoteNodeBaseDir: "remoteBaseDir", remoteFileName: "remoteFileName", expectedResult: nil, - expectedError: "failed to get node list", + expectedError: "", }, { name: "fail to retrieve content for one of the nodes", diff --git a/pkg/supportbundle/parse.go b/pkg/supportbundle/parse.go index e88433510..c755b55c4 100644 --- a/pkg/supportbundle/parse.go +++ b/pkg/supportbundle/parse.go @@ -103,7 +103,7 @@ func getPodDetailsFromFiles(files map[string][]byte, podNamespace string, podNam // GetFilesContents will return the file contents for filenames matching the filenames parameter. func GetFilesContents(bundleArchive string, filenames []string) (map[string][]byte, error) { - bundleDir, err := ioutil.TempDir("", "troubleshoot") + bundleDir, err := os.MkdirTemp("", "troubleshoot") if err != nil { return nil, errors.Wrap(err, "failed to create tmp dir") }