diff options
author | Daniil Baturin <daniil@baturin.org> | 2019-08-14 13:25:10 -0400 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-08-14 13:25:10 -0400 |
commit | 589952faadcf7700702b24390c1d654706f3a857 (patch) | |
tree | b3d486d0b0bc9e08d706d16d852bcae60b504dc0 /src/op_mode/snmp_ifmib.py | |
parent | 4e781d4dec184308ac844a4c2ff7dcfc7832cc77 (diff) | |
parent | 8d1e768a6f3285ed717f588f356db9340871b043 (diff) | |
download | vyos-1x-589952faadcf7700702b24390c1d654706f3a857.tar.gz vyos-1x-589952faadcf7700702b24390c1d654706f3a857.zip |
Merge branch 'current' into equuleus
Diffstat (limited to 'src/op_mode/snmp_ifmib.py')
-rwxr-xr-x | src/op_mode/snmp_ifmib.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/op_mode/snmp_ifmib.py b/src/op_mode/snmp_ifmib.py index 9d56a950b..180892694 100755 --- a/src/op_mode/snmp_ifmib.py +++ b/src/op_mode/snmp_ifmib.py @@ -77,10 +77,16 @@ def show_ifdescr(i): proc = subprocess.Popen(['/usr/bin/lspci', '-mm', '-d', device], stdout=subprocess.PIPE) (out, err) = proc.communicate() + vendor = "" + device = "" + # convert output to string string = out.decode("utf-8").split('"') - vendor = string[3] - device = string[5] + if len(string) >= 3: + vendor = string[3] + + if len(string) >= 5: + device = string[5] ret = 'ifDescr = {0} {1}'.format(vendor, device) return ret.replace('\n', '') |