handle ethtool not installed and add known limitations to README

This commit is contained in:
Solvik Blum 2019-08-04 23:24:51 +02:00
parent 15faf59182
commit 0c5ca003a6
No known key found for this signature in database
GPG key ID: CC12B3DC262B6C47
3 changed files with 10 additions and 0 deletions

View file

@ -1,5 +1,6 @@
import re
import subprocess
from shutil import which
# Originally from https://github.com/opencoff/useful-scripts/blob/master/linktest.py
@ -64,6 +65,8 @@ class Ethtool():
return {'form_factor': r.groups()[0]}
def parse(self):
if which('ethtool') is None:
return None
return {
**self._parse_ethtool_output(),
**self._parse_ethtool_module_output(),