2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Try to auto-restart httpd on initialize

During setup process, restart
the service on behalf of user
if appropriate service file is found.
This commit is contained in:
Jarrod Johnson 2020-06-26 12:49:28 -04:00
parent 1896b51f82
commit 05fb763200

View File

@ -106,7 +106,14 @@ def initialize(cmdset):
if cmdset.t:
didsomething = True
certutil.create_certificate()
emprint('New HTTPS certificates generated, restart the web server')
if os.path.exists('/usr/lib/systemd/system/httpd.service'):
subprocess.cheeck_call(['systemctl', 'try-restart', 'httpd'])
print('HTTP server has been restarted if it was running')
elif os.path.exists('/usr/lib/systemd/system/apache2.service'):
subprocess.cheeck_call(['systemctl', 'try-restart', 'apache2'])
print('HTTP server has been restarted if it was running')
else:
emprint('New HTTPS certificates generated, restart the web server manually')
if cmdset.s:
didsomething = True
sshutil.initialize_ca()