[Bug 1768823] Re: netplan ip leases <interface> traceback when interface not managed by netplan or set to DHCP

Steve Langasek steve.langasek at canonical.com
Thu Nov 8 17:05:56 UTC 2018


** Changed in: netplan.io (Ubuntu Bionic)
       Status: Fix Released => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netplan.io in Ubuntu.
Matching subscriptions: foundations-bugs
https://bugs.launchpad.net/bugs/1768823

Title:
  netplan ip leases <interface> traceback when interface not managed by
  netplan or set to DHCP

Status in netplan:
  Fix Released
Status in netplan.io package in Ubuntu:
  Fix Released
Status in netplan.io source package in Bionic:
  Fix Committed

Bug description:
  [Impact]
  "netplan ip leases <interface>" command is failing with a Traceback[1] when specifying an interface non-existing on the system. non-dhcp configured or non configured with netplan.

  [1] $ netplan ip leases eth1

  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.

  [Test Case]

  * Performed the command "netplan ip leases <INTERFACE>" on a
  Bionic/18.04 LTS system with netplan installed. If interface is non-
  existent, not configured in netplan or not set to DHCP, it will
  generate a Traceback[1] instead of displaying an error message with
  some explanation as of why it fails.

  Otherwise it will succeed as follow :

  $ 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

  [Regression Potential]
  'netplan ip leases' is used as informational only, so failures with it should be considered a low priority issue. Nevertheless, failures to properly parse the data from the networking backends, experienced as tracebacks (like the one this is supposed to fix) or as invalid data / incomplete data being shown on screen should be investigated as potential regressions.

  
  [Other Info]

   * Netplan PR:
     - https://github.com/CanonicalLtd/netplan/pull/25

  The above PR will output "Interface <INTERFACE> is not managed by
  netplan or not configured for DHCP"

  Example:

  $ ip a
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
         valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
         valid_lft forever preferred_lft forever
  45: eth0 at if46: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
      link/ether 00:16:3e:91:0d:24 brd ff:ff:ff:ff:ff:ff link-netnsid 0
      inet 10.104.180.139/24 brd 10.104.180.255 scope global dynamic eth0
         valid_lft 3422sec preferred_lft 3422sec
      inet6 fd42:ad0:706e:4129:216:3eff:fe91:d24/64 scope global dynamic mngtmpaddr noprefixroute
         valid_lft 3497sec preferred_lft 3497sec
      inet6 fe80::216:3eff:fe91:d24/64 scope link
         valid_lft forever preferred_lft forever

  $ netplan ip leases eth1
  Interface eth1 is not managed by netplan or not configured for DHCP

  $ netplan ip leases eth2
  Interface eth2 is not managed by netplan or not configured for DHCP

  $ netplan ip leases eth0
  # This is private data. Do not parse.
  ADDRESS=10.104.180.139
  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=1800
  T2=3150
  LIFETIME=3600
  DNS=10.104.180.1
  DOMAINNAME=lxd
  HOSTNAME=nplan8bionic
  CLIENTID=ffb1e17c0e00020000ab11ab1476591f0e77eb

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1768823/+subscriptions



More information about the foundations-bugs mailing list