lgirdk / boardfarm

Automated testing with python
BSD 3-Clause Clear License
21 stars 33 forks source link

SnmpHelper.py make code more robust #348

Open mgualco-contractor opened 5 years ago

mgualco-contractor commented 5 years ago

Concern raised by @mbanders One other slight way to be safer is to change if 'mib' in name or 'mibs' in name to something like if name.endswith('mib') or name.endswith('mibs') just in case someone has someone has some directories that happen to have 'mib' inside the name

mgualco-contractor commented 5 years ago

committed a fix

mbanders commented 5 years ago

I recommend use of the standard glob library. You can get a list of filenames with:

import glob

glob.glob('resources/mibs/*.mib')
# Returns a list: ['resources/mibs/ENTITY-MIB.mib', 'resources/mibs/IF-MIB.mib', 'resources/mibs/RFC1271-MIB.mib', 'resources/mibs/TCP-MIB.mib', ...]

And maybe there's some nice way to recurse and find other mib files.

mgualco-contractor commented 5 years ago

very good idea will implement ASAP

mattsm commented 5 years ago

@mgualco-contractor Be sure to close this once it's done ;-)

mgualco-contractor commented 5 years ago

In progress