diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-10-09 19:33:17 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-10-09 19:33:17 +0200 |
commit | 289d752a306b77bdc0cfb77efc3588860a35d74e (patch) | |
tree | a49581dc5dadd3df7d8e7e86660d77a0b136df5d /src/op_mode | |
parent | 5d5945842d6d767ab03860d3bd1d613f62e923f3 (diff) | |
download | vyos-1x-289d752a306b77bdc0cfb77efc3588860a35d74e.tar.gz vyos-1x-289d752a306b77bdc0cfb77efc3588860a35d74e.zip |
T883: handle keyboard interrupts in the wireguard keypair command.
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/wireguard.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/op_mode/wireguard.py b/src/op_mode/wireguard.py index 14ee66aaf..73da72aa7 100755 --- a/src/op_mode/wireguard.py +++ b/src/op_mode/wireguard.py @@ -49,9 +49,12 @@ def genkey(): """ helper function to check, regenerate the keypair """ old_umask = os.umask(0o077) if os.path.exists(pk) and os.path.exists(pub): - choice = input("You already have a wireguard key-pair already, do you want to re-generate? [y/n] ") - if choice == 'y' or choice == 'Y': - generate_keypair() + try: + choice = input("You already have a wireguard key-pair already, do you want to re-generate? [y/n] ") + if choice == 'y' or choice == 'Y': + generate_keypair() + except KeyboardInterrupt: + sys.exit(0) else: if not os.path.exists(dir): os.mkdir(dir) |