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

rbarry at redhat.com rbarry at redhat.com
Wed Jan 15 17:32:12 UTC 2014


Ryan Barry has uploaded a new change for review.

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/90/23290/1

diff --git a/src/ovirt/node/setup/core/kdump_page.py b/src/ovirt/node/setup/core/kdump_page.py
index 58a4038..8a66f19 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
 """
@@ -182,7 +183,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.update(None, None, None)
                 txs = model.transaction()
                 txs()
@@ -191,6 +196,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/23290
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07f643087ac8237b11f759617ef3481520a0ec5d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list