Skip to content

Commit 33a80d6

Browse files
chore(generator): fail early for bad walk OID (#1411)
In `generator.yml` and in a `walk:` section. If an OID starts with a period, for example `.1.3.6.1.4.1.20916`, this will fail to be found, as it should be: `1.3.6.1.4.1.20916`. But the error message lacks detail when this happens. Fail early if an OID starts with a "." and explain why. Signed-off-by: John L. Villalovos <[email protected]>
1 parent ba32da0 commit 33a80d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

generator/tree.go

+3
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ func generateConfigModule(cfg *ModuleConfig, node *Node, nameToNode map[string]*
302302
// Remove redundant OIDs to be walked.
303303
toWalk := []string{}
304304
for _, oid := range cfg.Walk {
305+
if strings.HasPrefix(oid, ".") {
306+
return nil, fmt.Errorf("invalid OID %s, prefix of '.' should be removed", oid)
307+
}
305308
// Resolve name to OID if possible.
306309
n, ok := nameToNode[oid]
307310
if ok {

0 commit comments

Comments
 (0)