From a28b67e9aafb7924908d5829a3879087073ded56 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 26 Mar 2015 13:46:45 -0400 Subject: [PATCH] Have confluent log sessions out at exit While the native perl threading object will do join() on exit, eventlet's variant does not. Fix this by manually hooking join() in via atexit. Since this is an eventlet specific thing, it makes sense to work the issue in code that patches in eventlet rather than in pyghmi itself. --- .../confluent/plugins/hardwaremanagement/ipmi.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 379e0cfb..71aaf821 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import atexit import confluent.exceptions as exc import confluent.interface.console as conapi import confluent.messages as msg @@ -30,6 +31,12 @@ import socket console.session.select = eventlet.green.select console.session.threading = eventlet.green.threading + +def exithandler(): + console.session.iothread.join() + +atexit.register(exithandler) + _ipmiworkers = greenpool.GreenPool() _ipmithread = None