Skip to content

Commit

Permalink
Protected loading manager settings from malformed config files
Browse files Browse the repository at this point in the history
Malformed config files will no longer prevent Qube Manager from
starting.
  • Loading branch information
marmarta committed May 3, 2019
1 parent 0bb9231 commit f5586e7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions qubesmanager/qube_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,17 @@ def __init__(self, qt_app, qubes_app, dispatcher, parent=None):
self.connect(self.action_toolbar, QtCore.SIGNAL("toggled(bool)"),
self.showhide_toolbar)

self.load_manager_settings()
try:
self.load_manager_settings()
except Exception as ex: # pylint: disable=broad-except
QtGui.QMessageBox.warning(
None,
self.tr("Manager settings unreadable"),
self.tr("Qube Manager settings cannot be parsed. Previously "
"saved display settings may not be restored "
"correctly.\nError: {}".format(str(ex))))

self.settings_loaded = True

self.fill_table()

Expand Down Expand Up @@ -642,8 +652,6 @@ def load_manager_settings(self):
self.resize(self.manager_settings.value("window_size",
QtCore.QSize(1100, 600)))

self.settings_loaded = True

def get_vms_list(self):
return [vm for vm in self.qubes_app.domains]

Expand Down Expand Up @@ -1329,7 +1337,7 @@ def main():
asyncio.ensure_future(dispatcher.listen_for_events()))
except asyncio.CancelledError:
pass
except Exception: # pylint: disable=broad-except
except Exception: # pylint: disable=broad-except
loop_shutdown()
exc_type, exc_value, exc_traceback = sys.exc_info()[:3]
handle_exception(exc_type, exc_value, exc_traceback)
Expand Down

0 comments on commit f5586e7

Please sign in to comment.