[node-patches] Change in ovirt-node[master]: kdump Show transaction error in UI dialog

fabiand at fedoraproject.org fabiand at fedoraproject.org
Mon Jul 15 15:40:51 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: kdump Show transaction error in UI dialog
......................................................................

kdump Show transaction error in UI dialog

Previously the UI quit in the case of a problem within the kdump page.
Now the exception is shown on the screen instead of quitting the whole
application.

Change-Id: I7e326e1f49552b696fc77f33ffbd1588aa833f6f
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/app.py
M src/ovirt/node/setup/core/kdump_page.py
M src/ovirt/node/ui/__init__.py
3 files changed, 16 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/81/16881/1

diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index ed6a16b..9e061c7 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -202,11 +202,8 @@
 
         def display_exception_as_notice(e):
             self.logger.debug(e, exc_info=True)
-            children = [ui.Label("dialog.notice.exception", "%s" % e)]
-            notice = ui.Dialog("dialog.notice", "An exception occurred",
-                               children)
-            notice.buttons = [ui.CloseButton("dialog.notice.action.close",
-                                             "Close")]
+            notice = ui.InfoDialog("dialog.notice", "An exception occurred",
+                                   "%s" % e)
             self.show(notice)
 
         # All known handlers
diff --git a/src/ovirt/node/setup/core/kdump_page.py b/src/ovirt/node/setup/core/kdump_page.py
index 577fd79..8ccd03b 100644
--- a/src/ovirt/node/setup/core/kdump_page.py
+++ b/src/ovirt/node/setup/core/kdump_page.py
@@ -21,6 +21,7 @@
 from ovirt.node import utils, plugins, ui, valid
 from ovirt.node.config import defaults
 from ovirt.node.plugins import Changeset
+from ovirt.node.ui import InfoDialog
 from ovirt.node.utils import console
 from ovirt.node.utils.network import NodeNetwork
 """
@@ -158,10 +159,14 @@
                 model.update(None, None, None)
             txs += model.transaction()
 
-        with self.application.ui.suspended():
-            console.reset()
-            is_dry = self.application.args.dry
-            progress_dialog = console.TransactionProgress(txs, is_dry)
-            progress_dialog.run()
-            console.writeln("\nPlease press any key to continue")
-            console.wait_for_keypress()
+        try:
+            with self.application.ui.suspended():
+                console.reset()
+                is_dry = self.application.args.dry
+                progress_dialog = console.TransactionProgress(txs, is_dry)
+                progress_dialog.run()
+                console.writeln("\nPlease press any key to continue")
+                console.wait_for_keypress()
+        except Exception as e:
+            self.logger.exception("Exception while configuring kdump")
+            return InfoDialog("dialog.info", "An error occurred", e.message)
diff --git a/src/ovirt/node/ui/__init__.py b/src/ovirt/node/ui/__init__.py
index 5fc93d6..b607b56 100644
--- a/src/ovirt/node/ui/__init__.py
+++ b/src/ovirt/node/ui/__init__.py
@@ -813,8 +813,8 @@
     """
     def __init__(self, path, title, text, buttons=None):
         super(InfoDialog, self).__init__(path, title, [])
-        self.children = [Label("label[0]", text)]
-        self.buttons = buttons or [CloseButton("dialog.close")]
+        self.children = [Label(path + ".label", text)]
+        self.buttons = buttons or [CloseButton(path + ".close")]
 
 
 class TextViewDialog(Dialog):


-- 
To view, visit http://gerrit.ovirt.org/16881
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e326e1f49552b696fc77f33ffbd1588aa833f6f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list