fix: panic is no mibs folder is found (#10301)

This commit is contained in:
Mya 2021-12-17 14:30:08 -07:00 committed by GitHub
parent b672de33a8
commit e00147ded3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -55,6 +55,9 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger) error {
appendPath(mibPath)
folders = append(folders, mibPath)
err := filepath.Walk(mibPath, func(path string, info os.FileInfo, err error) error {
if info == nil {
return fmt.Errorf("no mibs found")
}
// symlinks are files so we need to double check if any of them are folders
// Will check file vs directory later on
if info.Mode()&os.ModeSymlink != 0 {