[modules/nic] Fix status display

First, cache lookups were bugged... Second, the output needs to call
data() first, everything else later.

This is a bit nasty, and I'll consider re-visiting this, but right now,
I don't see any other way, given that modules can now be iterated.
This commit is contained in:
Tobias Witek 2016-10-31 13:09:52 +01:00
parent 0f6b418385
commit f29ddae47a
2 changed files with 5 additions and 3 deletions

View file

@ -44,12 +44,13 @@ class Module(bumblebee.module.Module):
try:
iw.get_interface_by_ifindex(idx)
self._cache["wlan{}".format(intf)] = True
except exception as e:
except Exception as e:
self._cache["wlan{}".format(intf)] = False
return self._cache
return self._cache["wlan{}".format(intf)]
def state(self):
t = "wireless" if self._iswlan(self._intf) else "wired"
return "{}-{}".format(t, self._state)
def warning(self):