From 4dabb12b14b7cc15d677d2482ae6bf53eef0a650 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Fri, 19 May 2017 16:56:57 +0200
Subject: [PATCH] Abort install if repo not configured #21550

---
 1.Base/4.configuration_webinterface/0_setup.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/1.Base/4.configuration_webinterface/0_setup.py b/1.Base/4.configuration_webinterface/0_setup.py
index 75294f2d..5f4fe8b4 100644
--- a/1.Base/4.configuration_webinterface/0_setup.py
+++ b/1.Base/4.configuration_webinterface/0_setup.py
@@ -1,14 +1,14 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 import utils
+import os
 
 
 def setup(interactive=True):
     # Create / update admin account
-    utils.log('Checking admin account')
+    utils.log('Installing webconf')
     cmds = list()
     cmds.append('apt-get install python3-ubicast-webconf')
-    # Set password if any
     settings = {
         "password": utils.get_conf('WEBCONF_PWD', 'changeme'),
         "port": utils.get_conf('WEBCONF_PORT', '9999'),
@@ -17,3 +17,8 @@ def setup(interactive=True):
         d = f.read()
     with open('/etc/webconf.json', 'w') as f:
         f.write(d.format(**settings))
+    utils.log('/etc/webconf.json written')
+    if not os.path.exists('/etc/apt/sources.list.d/skyreach.list'):
+        raise Exception('skyreach repository not available, cannot install package python3-ubicast-webconf')
+    else:
+        utils.run_commands(cmds)
-- 
GitLab