Skip to content
Snippets Groups Projects
Commit 4e858f63 authored by Florent Thiery's avatar Florent Thiery
Browse files

use restart instead of reload refs #27883, fix running commands if netcapture is not installed

parent 2009f2be
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,9 @@ CONTENT = [
def setup(interactive=True):
cmds = list()
if os.path.exists('/etc/nginx/sites-enabled/mediaserver-msuser.conf'):
# deploy certificate into nginx
cmds = list()
# deploy nginx SSL certificates
domains = []
conf_name_items = ["MS_SERVER_NAME", "MONITOR_SERVER_NAME", "CM_SERVER_NAME", "CACHE_SERVER_NAME"]
for name in conf_name_items:
......@@ -27,7 +27,7 @@ def setup(interactive=True):
"ssl_certificate /etc/ssl/envsetup/cert.pem;",
"ssl_certificate_key /etc/ssl/envsetup/key.pem;"
])
subprocess.check_call(["systemctl", "reload", "nginx"])
cmds.append("systemctl restart nginx")
options = {
"ms_url": utils.get_conf('MS_SERVER_NAME'),
......@@ -38,8 +38,10 @@ def setup(interactive=True):
for c in CONTENT:
cmd = cmd_template % c
cmds.append(cmd)
utils.run_commands(cmds)
if os.path.exists('/etc/miris/netcapture.json'):
cmds = list()
with open('/etc/miris/netcapture.json', 'r') as f:
c = json.load(f)
c['campusmanager_check_ssl'] = False
......@@ -55,10 +57,10 @@ def setup(interactive=True):
cmds.append('netcapturectl add')
utils.run_commands(cmds)
cmds = list()
# try to enable hw accel if available
subprocess.getstatusoutput("apt install -y vainfo")
if subprocess.getstatusoutput("vainfo")[0] == 0:
cmds = list()
# hw acceleration requires boot-time module options so a reboot will be needed
c['enable_hw_acceleration'] = True
if subprocess.getstatusoutput('dmesg | grep "GuC: Loaded"')[0] != 0:
......@@ -67,4 +69,4 @@ def setup(interactive=True):
print('A reboot is required')
with open('/etc/miris/netcapture.json', 'w') as f:
json.dump(c, f)
utils.run_commands(cmds)
utils.run_commands(cmds)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment