[Bug 1946957] Re: Unset of a subtree crashes with invalid (non existing) origin-hint

Launchpad Bug Tracker 1946957 at bugs.launchpad.net
Tue Dec 7 22:14:50 UTC 2021


This bug was fixed in the package netplan.io - 0.103-0ubuntu7.2

---------------
netplan.io (0.103-0ubuntu7.2) impish; urgency=medium

  * Add d/p/0012-test-bridge-base-give-bridge-some-more-time-to-reach.patch
    To fix flaky test_bridge_anonymous autopkgtest (upstream c6ad8e6)
  * Upstream cherry-picks for snapd dbus config set-try-apply integration fixes
    - dbus-wait-for-netplan-try-to-be-ready-LP-1949893-245.patch (LP: #1949893)
    - get-set-ignore-empty-YAML-hints-and-delete-files-on-.patch (LP: #1946957)

 -- Lukas Märdian <slyon at ubuntu.com>  Tue, 30 Nov 2021 17:14:05 +0100

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

-- 
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/1946957

Title:
  Unset of a subtree crashes with invalid (non existing) origin-hint

Status in netplan:
  Fix Committed
Status in netplan.io package in Ubuntu:
  Fix Released
Status in netplan.io source package in Focal:
  Fix Released
Status in netplan.io source package in Hirsute:
  Fix Released
Status in netplan.io source package in Impish:
  Fix Released
Status in netplan.io source package in Jammy:
  Fix Released

Bug description:
  [Impact]
  snapd uses netplan's DBus API to create config objects and set/try/apply changed configuration. It uses origin-hints (like 90-snapd-conf.yaml) to separate it's configuration from the user owned YAML configuration.

  If this origin-hint file does not exist or is empty, it might lead to
  crashes inside the 'netplan set' CLI, depending on the called
  operation and configuration.

  [Test Plan]
  In addition to running & passing the full set of unit- and integration-tests (that contains new tests to check for the cases described in this bug), as described in https://wiki.ubuntu.com/NetplanUpdates we want to run the two reproducer scripts attached to this bug and make sure they do not show any python crashes from the netplan CLI:

  $ ./netplan-dbus-perculiar2.sh
  $ ./repro.sh

  autopkgtest logs:
  * Impish:
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/impish_amd64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/impish_arm64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/impish_armhf.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/impish_ppc64el.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/impish_s390x.log

  * Hirsute:
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/hirsute_amd64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/hirsute_arm64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/hirsute_armhf.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/hirsute_ppc64el.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/hirsute_s390x.log

  * Focal:
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/focal_amd64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/focal_arm64.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/focal_armhf.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/focal_ppc64el.log
  https://git.launchpad.net/~slyon/+git/files/tree/LP1949893/focal_s390x.log

  [Where problems could occur]
  This upload contains changes to the CLI of netplan, if anything goes wrong it could impact the interactive usage of 'netplan set' by the user.

  [Other Info]
  The full set of autopkgtest logs will be attached after the upload is accepted into -proposed and the tests have been run on the official autopkgtest.u.c
  infrastructure.

  === Original Description ===

  Hey, sorry to bother you again with a crash. Help welcome!

  I have:

  $ $ apt list netplan.io
  Listing... Done
  netplan.io/now 0.103-0ubuntu5~21.04.2 amd64 [installed,local]

  $ zcat /usr/share/doc/netplan.io/changelog.Debian.gz |head -n 6
  netplan.io (0.103-0ubuntu5~21.04.2) hirsute; urgency=medium

    * Backport patches from impish:
      + Add d/p/0006-netplan-set-make-it-possible-to-unset-a-whole-devtyp.patch:
        Fix unset of a devtype subtree, e.g. "netplan set network.ethernets=null"
        (LP: #1942930)

  With:
  $ netplan get
  network:
    renderer: NetworkManager
    version: 2

  When I do the following:
  $ sudo netplan set network.ethernets=null
  that works just fine now.

  But when I do (what I think is) the dbus equivalent:

  path=$(dbus-send --system --print-reply --type=method_call --dest=io.netplan.Netplan /io/netplan/Netplan io.netplan.Netplan.Config|grep path|cut -f2 -d'"')
  dbus-send --system --print-reply --type=method_call --dest=io.netplan.Netplan "$path" io.netplan.Netplan.Config.Set string:"network.ethernets=null"  string:"90-snapd-conf"

  I get:

  Error org.freedesktop.DBus.Error.Failed: netplan set failed: Child process exited with code 1
  stdout: ''
  stderr: '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 310, in run_command
      self.func()
    File "/usr/share/netplan/netplan/cli/commands/set.py", line 53, in run
      self.run_command()
    File "/usr/share/netplan/netplan/cli/utils.py", line 310, in run_command
      self.func()
    File "/usr/share/netplan/netplan/cli/commands/set.py", line 106, in command_set
      self.write_file(subtree, hint + '.yaml', self.root_dir)
    File "/usr/share/netplan/netplan/cli/commands/set.py", line 176, in write_file
      raise Exception('Invalid input: {}'.format(set_tree))
  Exception: Invalid input: {'network': {'ethernets': None}}
  '

  Any help or tips appreciated!

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




More information about the foundations-bugs mailing list