Page MenuHomeVyOS Platform

Backtrace for config-archive when netwofrk is not configured
Open, LowPublicBUG

Description

We have to add additional check to commit-archive command to prevent backtrace when network is not configured.

vyos@vyos# run show interfaces 
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             -                                 u/u  
eth1             -                                 u/u  
eth2             -                                 u/u  
eth3             -                                 u/u  
lo               127.0.0.1/8                       u/u  
                 ::1/128                                
[edit]
vyos@vyos# set system config-management commit-archive location scp://vyos@[email protected]:/tmp/
[edit]
vyos@vyos# commit
Use of uninitialized value $source_address in concatenation (.) or string at /etc/commit/post-hooks.d/02vyatta-commit-push.pl line 78.
Archiving config...
  scp://192.168.255.11:/tmp/ Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 294, in upload
    urlc(urlstring, *args, **kwargs).upload(local_path)
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 187, in upload
    with self._establish() as ssh, ssh.open_sftp() as sftp:
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 174, in _establish
    sock = socket.create_connection((self.hostname, self.port), socket.getdefaulttimeout(), self.source)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

Details

Difficulty level
Normal (likely a few hours)
Version
1.3.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Unknown Object (User) created this task.Jul 13 2022, 9:42 AM
Unknown Object (User) added a comment.Jul 13 2022, 9:50 AM

The similar issue and for the 1.3.1-S1

vyos@vyos# run show version 

Version:          VyOS 1.3.1-S1
Release train:    equuleus
...

vyos@vyos#  set system config-management commit-archive location scp://[email protected]:/tmp/
[edit]
vyos@vyos# commit
Archiving config...
  scp://192.168.255.11:/tmp/ Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 293, in upload
    urlc(urlstring, *args, **kwargs).upload(local_path)
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 186, in upload
    with self._establish() as ssh, ssh.open_sftp() as sftp:
  File "/usr/lib/python3/dist-packages/vyos/remote.py", line 173, in _establish
    sock = socket.create_connection((self.hostname, self.port), socket.getdefaulttimeout(), self.source)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable