X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/eefd474c44ed606a9b9afd64c31cc1fc30c8594a..7006c209ece1e718f7eba4094e9670e1b1391fe7:/pymin/services/util.py diff --git a/pymin/services/util.py b/pymin/services/util.py index 91d28c3..2d73c77 100644 --- a/pymin/services/util.py +++ b/pymin/services/util.py @@ -171,10 +171,11 @@ class Device(Sequence): self.name = name self.mac = mac self.ppp = ppp + self.active = True self.addrs = dict() self.routes = list() def as_tuple(self): - return (self.name, self.mac, self.addrs) + return (self.name, self.mac, self.active, self.addrs) @@ -216,9 +217,8 @@ def get_network_devices(): d[name].addrs[from_addr] = Address(from_addr,24, peer=to_addr) except IndexError: pass - return d - + def get_peers(): p = subprocess.Popen(('ip', '-o', 'addr'), stdout=subprocess.PIPE, close_fds=True) @@ -643,10 +643,10 @@ class InitdHandler(ServiceHandler): p = subprocess.Popen(('pgrep', '-f', self._initd_name), stdout=subprocess.PIPE) pid = p.communicate()[0] - if p.wait() == 0 and len(pid) > 0: - c._service_running = True + if p.returncode == 0 and len(pid) > 0: + self._service_running = True else: - c._service_running = False + self._service_running = False class TransactionalHandler(Handler): r"""Handle command transactions providing a commit and rollback commands.