Page MenuHomeVyOS Platform

commit-archive: Ctrl+C should not eror out with stack trace, signal should be cought
Closed, ResolvedPublicBUG

Description

To reproduce:

[email protected]# run show configuration commands | grep commit
set system config-management commit-archive location 'scp://test123:[email protected]:/config/tftpboot'
set system config-management commit-revisions '200'

172.18.254.201 is another VyOS machine of mine

[email protected]# delete interfaces ethernet eth1 disable
[edit]
[email protected]# commit
Archiving config...
  scp://172.18.254.201:/config/tftpboot Host '172.18.254.201' not found in known hosts.
Fingerprint: 824eea64935f70034386a06143f82aa4
Do you wish to continue? [y/N]

Now abort the commit-archive process using Ctrl+C and the stacktrace will pop up:

^CTraceback (most recent call last):
  File "<string>", line 1, in <module>
[edit]
[email protected]#   File "/usr/lib/python3/dist-packages/vyos/remote.py", line 312, in upload
    urlc(urlstring, *args, **kwargs).upload(local_path)
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 205, in upload
    with self._establish() as ssh, ssh.open_sftp() as sftp:
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 190, in _establish
    ssh.connect(self.hostname, self.port, self.username, self.password, sock=sock)
  File "/usr/lib/python3/dist-packages/paramiko/client.py", line 407, in connect
    self, server_hostkey_name, server_key
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 60, in missing_host_key
    if sys.stdout.isatty() and ask_yes_no('Do you wish to continue?'):
  File "/usr/lib/python3/dist-packages/vyos/util.py", line 630, in ask_yes_no
    c = input().lower()
KeyboardInterrupt

The Ctrl+Csignal should be intercepted by the commit-archive python script

Details

Difficulty level
Unknown (require assessment)
Version
1.3.3 1.4-rolling and 1.5-rolling
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Cosmetic issue (typos etc.)

Event Timeline

KeyboardInterrupt is caught with an appropriate error message now.