From 2ed0ef770ed6dd0dbc14a21462004e34fc52b050 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 27 Jul 2015 11:40:01 -0600 Subject: [PATCH] Catch ProcessLookupError when updating iouyap config. Fixes #255. --- gns3server/modules/iou/iou_vm.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index eb940aa1..a54c4037 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -928,7 +928,10 @@ class IOUVM(BaseVM): port_number=port_number)) if self.is_iouyap_running(): self._update_iouyap_config() - os.kill(self._iouyap_process.pid, signal.SIGHUP) + try: + os.kill(self._iouyap_process.pid, signal.SIGHUP) + except ProcessLookupError: + log.error("Could not update iouyap configuration: process (PID={}) not found".format(self._iouyap_process.pid)) def adapter_remove_nio_binding(self, adapter_number, port_number): """ @@ -960,8 +963,10 @@ class IOUVM(BaseVM): port_number=port_number)) if self.is_iouyap_running(): self._update_iouyap_config() - os.kill(self._iouyap_process.pid, signal.SIGHUP) - + try: + os.kill(self._iouyap_process.pid, signal.SIGHUP) + except ProcessLookupError: + log.error("Could not update iouyap configuration: process (PID={}) not found".format(self._iouyap_process.pid)) return nio @property @@ -1244,7 +1249,10 @@ class IOUVM(BaseVM): if self.is_iouyap_running(): self._update_iouyap_config() - os.kill(self._iouyap_process.pid, signal.SIGHUP) + try: + os.kill(self._iouyap_process.pid, signal.SIGHUP) + except ProcessLookupError: + log.error("Could not update iouyap configuration: process (PID={}) not found".format(self._iouyap_process.pid)) @asyncio.coroutine def stop_capture(self, adapter_number, port_number): @@ -1277,4 +1285,7 @@ class IOUVM(BaseVM): port_number=port_number)) if self.is_iouyap_running(): self._update_iouyap_config() - os.kill(self._iouyap_process.pid, signal.SIGHUP) + try: + os.kill(self._iouyap_process.pid, signal.SIGHUP) + except ProcessLookupError: + log.error("Could not update iouyap configuration: process (PID={}) not found".format(self._iouyap_process.pid))