From e841fa05456ae8cfa35222fc6b787d9aadababe6 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 26 Jan 2022 14:39:16 +0100 Subject: [PATCH] Return non-zero exit code on failures Launcher.wait() does not raise, it returns an integer code. Propagate it to sys.exit() so that failures are correctly recognized. Change-Id: I38bf39e4e4845415640b3468e9fb3029f70dcded --- ironic/cmd/api.py | 2 +- ironic/cmd/conductor.py | 2 +- ironic/cmd/singleprocess.py | 2 +- releasenotes/notes/service-exit-77bcf3a538fab4bc.yaml | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/service-exit-77bcf3a538fab4bc.yaml diff --git a/ironic/cmd/api.py b/ironic/cmd/api.py index 2323c4b09c..f75aa9ee7d 100644 --- a/ironic/cmd/api.py +++ b/ironic/cmd/api.py @@ -39,7 +39,7 @@ def main(): launcher = ironic_service.process_launcher() server = wsgi_service.WSGIService('ironic_api', CONF.api.enable_ssl_api) launcher.launch_service(server, workers=server.workers) - launcher.wait() + sys.exit(launcher.wait()) if __name__ == '__main__': diff --git a/ironic/cmd/conductor.py b/ironic/cmd/conductor.py index 8431858906..5fa4c84899 100644 --- a/ironic/cmd/conductor.py +++ b/ironic/cmd/conductor.py @@ -67,7 +67,7 @@ def main(): issue_startup_warnings(CONF) launcher = service.launch(CONF, mgr, restart_method='mutate') - launcher.wait() + sys.exit(launcher.wait()) if __name__ == '__main__': diff --git a/ironic/cmd/singleprocess.py b/ironic/cmd/singleprocess.py index ea2e01365c..20a348ae5c 100644 --- a/ironic/cmd/singleprocess.py +++ b/ironic/cmd/singleprocess.py @@ -49,4 +49,4 @@ def main(): wsgi = wsgi_service.WSGIService('ironic_api', CONF.api.enable_ssl_api) launcher.launch_service(wsgi) - launcher.wait() + sys.exit(launcher.wait()) diff --git a/releasenotes/notes/service-exit-77bcf3a538fab4bc.yaml b/releasenotes/notes/service-exit-77bcf3a538fab4bc.yaml new file mode 100644 index 0000000000..3d0aeee193 --- /dev/null +++ b/releasenotes/notes/service-exit-77bcf3a538fab4bc.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Services (``ironic``, ``ironic-api``, ``ironic-conductor``) now correctly + return a non-zero exit code on start-up failures.