Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On netplan apply, tolerate devices that do not appear in /sys/class/net #86

Merged
merged 2 commits into from May 21, 2019
Merged

On netplan apply, tolerate devices that do not appear in /sys/class/net #86

merged 2 commits into from May 21, 2019

Conversation

Deltik
Copy link
Contributor

@Deltik Deltik commented May 11, 2019

Description

When using the NetworkManager renderer, the logic in NetplanApply.command_apply() tells nmcli to disconnect the devices previously populated by netifaces.interfaces().

In addition, if an alias like "eth0:0" exists, it will show as a device from netifaces.interfaces() but will not have a path in /sys/class/net.

This means that the devices variable may have more devices than actually exist due to the past nmcli device disconnect run or the presence of one or more aliases.

This merge request fixes this bug by tolerating all errors from udevadm test-builtin net_setup_link /sys/class/net/XXX so that netplan apply doesn't quit and leave the user without a network setup.

Fixes Launchpad bug #1810043

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Closes an open bug in Launchpad.

@codecov-io
Copy link

codecov-io commented May 11, 2019

Codecov Report

Merging #86 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #86   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          34     34           
  Lines        4005   4005           
=====================================
  Hits         4005   4005

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee94ec1...8ac281f. Read the comment docs.

When using the NetworkManager renderer, the logic in
`NetplanApply.command_apply()` tells `nmcli` to disconnect the devices
previously populated by `netifaces.interfaces()`.

In addition, if an alias like "eth0:0" exists, it will show as a device
from `netifaces.interfaces()` but will not have a path in
`/sys/class/net`.

This means that the `devices` variable may have more devices than
actually exist due to the past `nmcli device disconnect` run or the
presence of one or more aliases.

The attached patch fixes this bug by tolerating all errors from `udevadm
test-builtin net_setup_link /sys/class/net/XXX` so that `netplan apply`
doesn't quit and leave the user without a network setup.

Fixes LP #1810043
Launchpad: https://bugs.launchpad.net/netplan/+bug/1810043

Signed-off-by: Nick Liu <deltik@gmx.com>
@Deltik Deltik changed the title Rescan network interfaces after nmcli device disconnect runs Tolerate devices that do not appear in /sys/class/net on netplan apply May 11, 2019
@Deltik Deltik changed the title Tolerate devices that do not appear in /sys/class/net on netplan apply On netplan apply, tolerate devices that do not appear in /sys/class/net May 11, 2019
@cyphermox cyphermox merged commit 7a1127f into canonical:master May 21, 2019
@YamiYukiSenpai
Copy link

Seems this patch isn't applied in Debian Buster

I'm using Netplan on Raspbian Buster, and I had to apply the patch manually.

@ep4sh
Copy link

ep4sh commented Jul 19, 2020

Still no changes in Debian Buster =(

@Deltik
Copy link
Contributor Author

Deltik commented Jul 19, 2020

@YamiYukiSenpai and @ep4sh: Comments about packaging netplan.io on Debian won't go anywhere on this thread. If you want to bring this issue to the attention of the package's maintainers, you can find their contact information on this page: https://packages.debian.org/buster/netplan.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants