install

installer
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/install

commit 912fd3709c2d9000780babfdd4853fd8891f630c
parent da6aeac52ff291c34f7c69d6454de47d2661af78
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Sun, 27 Nov 2016 23:22:01 +0100

Merge branch 'master' of https://github.com/morphux/installer

Diffstat:
Mscreens/conf_install/conf_install.py | 29++++++++++++++++-------------
Mscreens/load_conf/load_conf.py | 22++++++++++++----------
2 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/screens/conf_install/conf_install.py b/screens/conf_install/conf_install.py @@ -109,19 +109,22 @@ class Conf_Install: if code == "ok": # Load the json into an object with open("morphux_install.conf") as fd: - self.conf_lst = json.load(fd) - # TODO catch exception on json.load - # Check the configuration integrity - if self.check_conf(): - # Save this in order not to ask the configuration - # saving in the installation process - self.conf_lst["load_conf"] = True - Main.conf_lst = self.conf_lst - return 6 - # If the configuration is wrong, we return the user - # to the step_by_step menu - else: - return self.step_by_step() + try: + self.conf_lst = json.load(fd) + + # Check the configuration integrity + if self.check_conf(): + # Save this in order not to ask the configuration + # saving in the installation process + self.conf_lst["load_conf"] = True + Main.conf_lst = self.conf_lst + return 6 + # If the configuration is wrong, we return the user + # to the step_by_step menu + else: + return self.step_by_step() + except ValueError: + self.dlg.msgbox("The format of the file is wrong !") # Since hostname is the first configuration to do, if the user diff --git a/screens/load_conf/load_conf.py b/screens/load_conf/load_conf.py @@ -67,14 +67,16 @@ class Load_Conf: with fd: # All good, we can read the file - self.conf_lst = json.load(fd) + try: + self.conf_lst = json.load(fd) - # TODO catch exception on json.load - - # Ugly method in order to check conf integrity - Main.screens[1][0].conf_lst = self.conf_lst - if Main.screens[1][0].check_conf(): - self.conf_lst["load_conf"] = True - Main.conf_lst = self.conf_lst - return 6 - return Main.screens[1][0].step_by_step() + # Ugly method in order to check conf integrity + Main.screens[1][0].conf_lst = self.conf_lst + if Main.screens[1][0].check_conf(): + self.conf_lst["load_conf"] = True + Main.conf_lst = self.conf_lst + return 6 + return Main.screens[1][0].step_by_step() + except ValueError: + self.dlg.msgbox("The format of the file is wrong !") + return 0