"netplan ip leases <interface>" command is failing with a Traceback[1] when specifying an interface non-existing on the system.
Of course, the cmdline works as expected when the interface exist[2]
IMHO, if someone pick a non-existing interface, netplan should just output a generic error saying that the interface cannot be found or else, instead of printing a stack traceback.
[1] - Traceback
$ netplan ip leases eth0
Traceback (most recent call last):
File "/usr/sbin/netplan", line 23, in <module>
netplan.main()
File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/ip.py", line 56, in run
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/ip.py", line 75, in run
self.run_command()
File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
self.func()
File "/usr/share/netplan/netplan/cli/commands/ip.py", line 142, in command_ip_leases
out = subprocess.check_output(argv, universal_newlines=True)
File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/lib/netplan/generate', '--mapping', 'eth1']' returned non-zero exit status 1.
[2] - $ netplan ip leases eth0
# This is private data. Do not parse.
ADDRESS=10.104.180.111
NETMASK=255.255.255.0
ROUTER=10.104.180.1
SERVER_ADDRESS=10.104.180.1
NEXT_SERVER=10.104.180.1
BROADCAST=10.104.180.255
T1=1673
T2=3023
LIFETIME=3600
DNS=10.104.180.1
DOMAINNAME=lxd
HOSTNAME=nplan
CLIENTID=ffefc0b3c900020000ab118611d41fefa41121
"netplan ip leases <interface>" command is failing with a Traceback[1] when specifying an interface non-existing on the system.
Of course, the cmdline works as expected when the interface exist[2]
IMHO, if someone pick a non-existing interface, netplan should just output a generic error saying that the interface cannot be found or else, instead of printing a stack traceback.
[1] - Traceback netplan" , line 23, in <module> netplan/ netplan/ cli/core. py", line 50, in main run_command( ) netplan/ netplan/ cli/utils. py", line 130, in run_command netplan/ netplan/ cli/commands/ ip.py", line 56, in run run_command( ) netplan/ netplan/ cli/utils. py", line 130, in run_command netplan/ netplan/ cli/commands/ ip.py", line 75, in run run_command( ) netplan/ netplan/ cli/utils. py", line 130, in run_command netplan/ netplan/ cli/commands/ ip.py", line 142, in command_ip_leases check_output( argv, universal_ newlines= True) python3. 6/subprocess. py", line 336, in check_output .stdout python3. 6/subprocess. py", line 418, in run CalledProcessEr ror: Command '['/lib/ netplan/ generate' , '--mapping', 'eth1']' returned non-zero exit status 1.
$ netplan ip leases eth0
Traceback (most recent call last):
File "/usr/sbin/
netplan.main()
File "/usr/share/
self.
File "/usr/share/
self.func()
File "/usr/share/
self.
File "/usr/share/
self.func()
File "/usr/share/
self.
File "/usr/share/
self.func()
File "/usr/share/
out = subprocess.
File "/usr/lib/
**kwargs)
File "/usr/lib/
output=stdout, stderr=stderr)
subprocess.
[2] - $ netplan ip leases eth0 10.104. 180.111 255.255. 255.0 ADDRESS= 10.104. 180.1 10.104. 180.1 10.104. 180.255 ffefc0b3c900020 000ab118611d41f efa41121
# This is private data. Do not parse.
ADDRESS=
NETMASK=
ROUTER=10.104.180.1
SERVER_
NEXT_SERVER=
BROADCAST=
T1=1673
T2=3023
LIFETIME=3600
DNS=10.104.180.1
DOMAINNAME=lxd
HOSTNAME=nplan
CLIENTID=