[node-patches] Change in ovirt-node[node-3.0]: *REALLY* catch ctrl+c during kdump configuration

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed Feb 19 14:15:42 UTC 2014


Hello Ryan Barry,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/24766

to review the following change.

Change subject: *REALLY* catch ctrl+c during kdump configuration
......................................................................

*REALLY* catch ctrl+c during kdump configuration

Catch every SIGINT until the configuration is reset so users
hammering on CTRL+C don't kill the application.

Change-Id: I07f643087ac8237b11f759617ef3481520a0ec5d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1053415
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/core/kdump_page.py
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/66/24766/1

diff --git a/src/ovirt/node/setup/core/kdump_page.py b/src/ovirt/node/setup/core/kdump_page.py
index 737760f..cbc766e 100644
--- a/src/ovirt/node/setup/core/kdump_page.py
+++ b/src/ovirt/node/setup/core/kdump_page.py
@@ -24,6 +24,7 @@
 from ovirt.node.ui import InfoDialog
 from ovirt.node.utils import console
 from ovirt.node.utils.network import NodeNetwork
+import signal
 """
 Configure KDump
 """
@@ -173,7 +174,11 @@
                 console.writeln("\nPlease press any key to continue")
                 console.wait_for_keypress()
         except KeyboardInterrupt:
+            def _handler(signum, frame):
+                console.writeln("\nWait for configuration to be reset\n")
             with self.application.ui.suspended():
+                _original_sigint = signal.getsignal(signal.SIGINT)
+                signal.signal(signal.SIGINT, _handler)
                 model.disable_kdump()
                 txs = model.transaction()
                 txs()
@@ -182,6 +187,7 @@
                                 "configuration")
                 console.writeln("\nPlease press any key to continue")
                 console.wait_for_keypress()
+                signal.signal(signal.SIGINT, _original_sigint)
         except Exception as e:
             # Restore the configuration
             if saved_model["kdump.type"] == "nfs":


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07f643087ac8237b11f759617ef3481520a0ec5d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: node-3.0
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list