Comment 0 for bug 1768823

Revision history for this message
Eric Desrochers (slashd) wrote : netplan ip leases <interface>

"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