From a72a3f4c956338b05db2c6fa958112cf5df8dcad Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Sun, 2 Mar 2014 15:05:59 +0200 Subject: [PATCH] Sync latest Guru Meditation Reports from Oslo Nova fails to start on Windows due to non portable signal handling (SIGUSR1) employed in this patch. This patch enables the reporting feature only if signal is available on the current platform. Oslo commit: d3a285e33fa936cec5d14dfefa20dc03cc90ac18 Closes-Bug: #1286528 Change-Id: I070ab57b18b2bc43df5ec84c51ccb86be1ff0d2a --- nova/openstack/common/report/guru_meditation_report.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nova/openstack/common/report/guru_meditation_report.py b/nova/openstack/common/report/guru_meditation_report.py index 1328f34d86..f256010fb2 100644 --- a/nova/openstack/common/report/guru_meditation_report.py +++ b/nova/openstack/common/report/guru_meditation_report.py @@ -97,7 +97,7 @@ class GuruMeditation(object): cls.persistent_sections = [[section_title, generator]] @classmethod - def setup_autorun(cls, version, signum=signal.SIGUSR1): + def setup_autorun(cls, version, signum=None): """Set Up Auto-Run This method sets up the Guru Meditation Report to automatically @@ -107,7 +107,13 @@ class GuruMeditation(object): :param signum: the signal to associate with running the report """ - signal.signal(signum, lambda *args: cls.handle_signal(version, *args)) + if not signum and hasattr(signal, 'SIGUSR1'): + # SIGUSR1 is not supported on all platforms + signum = signal.SIGUSR1 + + if signum: + signal.signal(signum, + lambda *args: cls.handle_signal(version, *args)) @classmethod def handle_signal(cls, version, *args):