summaryrefslogtreecommitdiff
path: root/netplan
diff options
context:
space:
mode:
authorMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2018-05-25 15:32:01 -0400
committerMathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>2018-05-25 15:32:07 -0400
commitf73bf3d453da3c82d36b5cc4930e54e9e4147533 (patch)
tree5272a6dfec794e6cfa92eb9cecf838c7f52bf365 /netplan
parent808b8cdf260b2d540150d10a17cf6aec52164a0c (diff)
Fix incorrect terminal reset in 'netplan try' on Ctrl-C. (LP: #1768798)
Signed-off-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Diffstat (limited to 'netplan')
-rw-r--r--netplan/cli/commands/try_command.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/netplan/cli/commands/try_command.py b/netplan/cli/commands/try_command.py
index 6002076..805b332 100644
--- a/netplan/cli/commands/try_command.py
+++ b/netplan/cli/commands/try_command.py
@@ -44,6 +44,7 @@ class NetplanTry(utils.NetplanCommand):
self.configuration_changed = False
self.new_interfaces = None
self._config_manager = None
+ self.t_settings = None
@property
def config_manager(self): # pragma: nocover (called by later commands)
@@ -69,7 +70,8 @@ class NetplanTry(utils.NetplanCommand):
try:
fd = sys.stdin.fileno()
- t = netplan.terminal.Terminal(fd)
+ self.t = netplan.terminal.Terminal(fd)
+ self.t.save(self.t_settings)
# we really don't want to be interrupted while doing backup/revert operations
signal.signal(signal.SIGINT, self._signal_handler)
@@ -79,7 +81,7 @@ class NetplanTry(utils.NetplanCommand):
NetplanApply.command_apply(run_generate=True, sync=True, exit_on_error=False)
- t.get_confirmation_input(timeout=self.timeout)
+ self.t.get_confirmation_input(timeout=self.timeout)
except netplan.terminal.InputRejected:
print("\nReverting.")
self.revert()
@@ -90,6 +92,7 @@ class NetplanTry(utils.NetplanCommand):
print("\nReverting.")
self.revert()
finally:
+ self.t.reset(self.t_settings)
self.cleanup()
def backup(self): # pragma: nocover (requires user input)