Skip to content

Commit 8eb4b1c

Browse files
add fix for GetEntry getting module
1 parent c0773c6 commit 8eb4b1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/schema/object.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ func (sc *Schema) GetEntry(pe []string) (*yang.Entry, error) {
9090
}
9191
log.Debugf("looking up path %s in module %s caused: %v. continuing to search in %v", strings.Join(pe, "/"), mod.Name, err, remainingMods)
9292
}
93+
94+
// if we are here we have not found a path, maybe we have a module name
95+
// if we have one module and one path element, likely a module return this
96+
if len(mods) == 1 && len(pe) == 1 && mods[0].Name == pe[0] {
97+
return mods[0], nil
98+
}
9399
return nil, fmt.Errorf("schema entry %q not found", strings.Join(pe, "/"))
94100
}
95101

0 commit comments

Comments
 (0)