Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure folders do not get loaded more than once #10551

Merged
merged 16 commits into from
Feb 16, 2022
Merged
Prev Previous commit
Next Next commit
chore: add comments
  • Loading branch information
MyaLongmire committed Feb 10, 2022
commit 6b07dfb801fcc25bd32c733ab5b1271b7622078f
2 changes: 2 additions & 0 deletions internal/snmp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func ClearCache() {
cache = make(map[string]bool)
}

//will give all found folders to gosmi and load in all modules found in the folders
func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) error {
folders, err := walkPaths(paths, log)
if err != nil {
Expand Down Expand Up @@ -83,6 +84,7 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) err
return nil
}

//should walk the paths given and find all folders
func walkPaths(paths []string, log telegraf.Logger) ([]string, error) {
once.Do(gosmi.Init)
folders := []string{}
Expand Down