netplan backported on bionic (0.40~18.04.1) crash when there is an empty YAML configuration file

Bug #1795343 reported by EOLE team
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Netplan
Confirmed
Undecided
Unassigned
netplan.io (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned

Bug Description

[Impact]
Any Netplan user leaving empty files in /etc/netplan.

[Test case]

1) put a valid configuration under /etc/netplan/
2) create an empty YAML file /etc/netplan/99-empty.yaml
3) execute netplan apply

Validate that 'netplan apply' does not crash, and correctly applies the configuration.

[Regression potential]
Watch out for issues in merging netplan configuration or evaluating the parts of configuration that can't be reverted safely, for the use of 'netplan try'.

---

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/apply.py", line 43, 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/apply.py", line 83, in command_apply
    config_manager.parse()
  File "/usr/share/netplan/netplan/configmanager.py", line 111, in parse
    self._merge_yaml_config(yaml_file)
  File "/usr/share/netplan/netplan/configmanager.py", line 197, in _merge_yaml_config
    network = yaml_data.get('network')
AttributeError: 'NoneType' object has no attribute 'get'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
    os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_netplan_netplan.script.0.crash'

Original exception was:
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/apply.py", line 43, 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/apply.py", line 83, in command_apply
    config_manager.parse()
  File "/usr/share/netplan/netplan/configmanager.py", line 111, in parse
    self._merge_yaml_config(yaml_file)
  File "/usr/share/netplan/netplan/configmanager.py", line 197, in _merge_yaml_config
    network = yaml_data.get('network')
AttributeError: 'NoneType' object has no attribute 'get'

This is a regression with the previous version.

apt policy netplan.io
netplan.io:
  Installé : 0.40~18.04.1
  Candidat : 0.40~18.04.1
 Table de version :
 *** 0.40~18.04.1 500
        500 http://fr.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     0.36.3 500
        500 http://fr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
     0.36.1 500
        500 http://fr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

EOLE team (eole-team)
description: updated
description: updated
Revision history for this message
Ryan Harper (raharper) wrote :

I can reproduce the failure as well after upgrading to netplan.io in proposed and touching /etc/netplan/99-empty.yaml

It does not fail prior to the upgrade.

Changed in netplan:
status: New → Confirmed
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello EOLE, or anyone else affected,

Accepted netplan.io into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.40.1~18.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

tags: added: verification-needed verification-needed-bionic
Changed in netplan.io (Ubuntu):
status: New → Fix Committed
Changed in netplan.io (Ubuntu Bionic):
status: New → Fix Committed
description: updated
Revision history for this message
Ryan Harper (raharper) wrote :

Tested 0.40.1 from -proposed; things look good here.

root@b1:~# ls -al /etc/netplan/
total 9
drwxr-xr-x 2 root root 4 Oct 4 20:29 .
drwxr-xr-x 87 root root 175 Oct 2 06:36 ..
-rw-r--r-- 1 root root 381 Oct 1 14:53 50-cloud-init.yaml
-rw-r--r-- 1 root root 0 Oct 1 15:16 99-empty.yaml
root@b1:~# apt-cache policy netplan.io
netplan.io:
  Installed: 0.40~18.04.1
  Candidate: 0.40.1~18.04.1
  Version table:
     0.40.1~18.04.1 500
        500 http://archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
 *** 0.40~18.04.1 100
        100 /var/lib/dpkg/status
     0.36.3 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
     0.36.1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
root@b1:~# netplan apply
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/apply.py", line 43, 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/apply.py", line 83, in command_apply
    config_manager.parse()
  File "/usr/share/netplan/netplan/configmanager.py", line 111, in parse
    self._merge_yaml_config(yaml_file)
  File "/usr/share/netplan/netplan/configmanager.py", line 197, in _merge_yaml_config
    network = yaml_data.get('network')
AttributeError: 'NoneType' object has no attribute 'get'
root@b1:~# mv /etc/netplan/99-empty.yaml .
root@b1:~# apt install netplan.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
Suggested packages:
  network-manager | wpasupplicant
The following packages will be upgraded:
  netplan.io
1 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
Need to get 63.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-proposed/main amd64 netplan.io amd64 0.40.1~18.04.1 [63.8 kB]
Fetched 63.8 kB in 1s (108 kB/s)
(Reading database ... 28509 files and directories currently installed.)
Preparing to unpack .../netplan.io_0.40.1~18.04.1_amd64.deb ...
Unpacking netplan.io (0.40.1~18.04.1) over (0.40~18.04.1) ...
Setting up netplan.io (0.40.1~18.04.1) ...
Processing triggers for man-db (2.8.3-2) ...
root@b1:~# mv 99-empty.yaml /etc/netplan/
root@b1:~# netplan apply
root@b1:~# networkctl status
● State: routable
       Address: 10.8.107.180 on eth0
                fe80::216:3eff:fede:ccf1 on eth0
       Gateway: 10.8.107.1 on eth0
           DNS: 10.8.107.1
Search Domains: lxd

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.40.2

---------------
netplan.io (0.40.2) cosmic; urgency=medium

  * tests/integration.py: Mark regexes with r to pacify pycodestyle's W605.

 -- Mathieu Trudel-Lapierre <email address hidden> Thu, 04 Oct 2018 16:02:53 -0400

Changed in netplan.io (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Marking verification-done based on Ryan's verification.

tags: added: verification-done-bionic
removed: regression verification-needed verification-needed-bionic
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello EOLE, or anyone else affected,

Accepted netplan.io into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.40.1~18.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

tags: added: verification-needed verification-needed-bionic
removed: verification-done-bionic
Revision history for this message
EOLE team (eole-team) wrote :

It's working fine with version 0.40.1~18.04.1.

tags: added: verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.40.1~18.04.2

---------------
netplan.io (0.40.1~18.04.2) bionic; urgency=medium

  * Fix typo breaking rename on 'netplan apply'. (LP: #1770082)

netplan.io (0.40.1~18.04.1) bionic; urgency=medium

  * Backport netplan 0.40.1 to 18.04. (LP: #1793309)

netplan.io (0.40.1) cosmic; urgency=medium

  * tests/generate.py: use random.sample() instead of random.choices() to
    better support older pythons.
  * Deal gracefully with empty files on 'netplan apply' (LP: #1795343)

netplan.io (0.40) cosmic; urgency=medium

  * New upstream release:
    - networkd: route source is PreferredSource= not From=
    - Improve NetworkManager error reporting on unrenderable routes.
    - Don't render ipv4 dns-search unless we have an ipv4 address.
      (LP: #1786726)
    - Set permissive umask on networkd .network, .link and .netdev files
      (LP: #1736965, LP: #1768560)
    - Fix support for link-scope routes. (LP: #1747455)
    - Update man pages for deletion of replug code.
    - Spell Gratuitous ARP correctly and make it work. (LP: #1756701)
    - Many typo fixes for documentation. (LP: #1783940)
    - Various build system fixes.
    - Fix integration tests:
      - iproute2 output changes for link-scope routes
      - fix stability of networkd igmp-resend test
      - fix manual_addresses test now that networkd lists ~. domain
    - Deduplicate code for parsing interface options
    - Add support for optional-addresses.

netplan.io (0.39) cosmic; urgency=medium

  * New upstream release:
    - Allow link-local addresses to be configured. (LP: #1771704)
    - Forces bridges with no addresses to be brought online. (LP: #1736975)

netplan.io (0.38) cosmic; urgency=medium

  * New upstream release:
    - Write udev .rules files to /run/udev/rules.d to enforce interface
      renaming. (LP: #1770082)
    - Don't traceback for 'netplan ip leases' when iface is not managed or
      doesn't DHCP (LP: #1768823)
    - Fix duplicate "/" path separator in error messages (LP: #1771440)
    - Fix incorrect terminal reset in 'netplan try' on Ctrl-C. (LP: #1768798)
    - Updated doc entries: mtu, fix fwmark->mark, cleanup optional.
      (LP: #1768783)
    - Added documentation validation at build.
    - Added configuration example for multi-ip interfaces.
  * tests/integration.py: fix test_eth_and_bridge autopkg test harder.
  * debian/control:
    - Add iproute2 to Depends.
    - Add python3-netifaces to Depends, Build-Depends.

 -- Mathieu Trudel-Lapierre <email address hidden> Mon, 22 Oct 2018 15:02:30 -0400

Changed in netplan.io (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for netplan.io has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Steve Langasek (vorlon)
Changed in netplan.io (Ubuntu Bionic):
status: Fix Released → Fix Committed
status: Fix Committed → Fix Released
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello EOLE, or anyone else affected,

Accepted netplan.io into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/netplan.io/0.40.1~18.04.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in netplan.io (Ubuntu Bionic):
status: Fix Released → Fix Committed
tags: added: verification-needed verification-needed-bionic
removed: verification-done-bionic
Revision history for this message
EOLE team (eole-team) wrote :

OK with 0.40.1~18.04.3

tags: added: verification-done-bionic
removed: verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package netplan.io - 0.40.1~18.04.3

---------------
netplan.io (0.40.1~18.04.3) bionic; urgency=medium

  * Fix idempotency in renaming: bond members should be exempt from rename, as
    they may all share a single MAC for the bond device. (LP: #1802322)
  * tests/integration.py: add test designed to catch the above regression.

netplan.io (0.40.1~18.04.2) bionic; urgency=medium

  * Fix typo breaking rename on 'netplan apply'. (LP: #1770082)

netplan.io (0.40.1~18.04.1) bionic; urgency=medium

  * Backport netplan 0.40.1 to 18.04. (LP: #1793309)

netplan.io (0.40.1) cosmic; urgency=medium

  * tests/generate.py: use random.sample() instead of random.choices() to
    better support older pythons.
  * Deal gracefully with empty files on 'netplan apply' (LP: #1795343)

netplan.io (0.40) cosmic; urgency=medium

  * New upstream release:
    - networkd: route source is PreferredSource= not From=
    - Improve NetworkManager error reporting on unrenderable routes.
    - Don't render ipv4 dns-search unless we have an ipv4 address.
      (LP: #1786726)
    - Set permissive umask on networkd .network, .link and .netdev files
      (LP: #1736965, LP: #1768560)
    - Fix support for link-scope routes. (LP: #1747455)
    - Update man pages for deletion of replug code.
    - Spell Gratuitous ARP correctly and make it work. (LP: #1756701)
    - Many typo fixes for documentation. (LP: #1783940)
    - Various build system fixes.
    - Fix integration tests:
      - iproute2 output changes for link-scope routes
      - fix stability of networkd igmp-resend test
      - fix manual_addresses test now that networkd lists ~. domain
    - Deduplicate code for parsing interface options
    - Add support for optional-addresses.

netplan.io (0.39) cosmic; urgency=medium

  * New upstream release:
    - Allow link-local addresses to be configured. (LP: #1771704)
    - Forces bridges with no addresses to be brought online. (LP: #1736975)

netplan.io (0.38) cosmic; urgency=medium

  * New upstream release:
    - Write udev .rules files to /run/udev/rules.d to enforce interface
      renaming. (LP: #1770082)
    - Don't traceback for 'netplan ip leases' when iface is not managed or
      doesn't DHCP (LP: #1768823)
    - Fix duplicate "/" path separator in error messages (LP: #1771440)
    - Fix incorrect terminal reset in 'netplan try' on Ctrl-C. (LP: #1768798)
    - Updated doc entries: mtu, fix fwmark->mark, cleanup optional.
      (LP: #1768783)
    - Added documentation validation at build.
    - Added configuration example for multi-ip interfaces.
  * tests/integration.py: fix test_eth_and_bridge autopkg test harder.
  * debian/control:
    - Add iproute2 to Depends.
    - Add python3-netifaces to Depends, Build-Depends.

 -- Mathieu Trudel-Lapierre <email address hidden> Wed, 21 Nov 2018 14:42:59 -0500

Changed in netplan.io (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.