From 4802c52854a9ad0487eb4ff1541d8e1f854a4df4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 1 Nov 2022 10:05:24 -0400 Subject: [PATCH] If attempt to auto-restart service, reduce severity of result Provide feedback as a warning rather than aborting the command entirely --- confluent_server/bin/osdeploy | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index d7657f29..c614d323 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -282,11 +282,17 @@ def initialize(cmdset): init_confluent_myname() certutil.create_certificate() if os.path.exists('/usr/lib/systemd/system/httpd.service'): - subprocess.check_call(['systemctl', 'try-restart', 'httpd']) - print('HTTP server has been restarted if it was running') + try: + subprocess.check_call(['systemctl', 'try-restart', 'httpd']) + print('HTTP server has been restarted if it was running') + except subprocess.CalledProcessError: + emprint('New HTTPS certificates generated, restart the web server manually') elif os.path.exists('/usr/lib/systemd/system/apache2.service'): - subprocess.check_call(['systemctl', 'try-restart', 'apache2']) - print('HTTP server has been restarted if it was running') + try: + subprocess.check_call(['systemctl', 'try-restart', 'apache2']) + print('HTTP server has been restarted if it was running') + except subprocess.CalledProcessError: + emprint('New HTTPS certificates generated, restart the web server manually') else: emprint('New HTTPS certificates generated, restart the web server manually') if cmdset.s: