[Bug 2027584] Re: removing an NM connection removes also the set renderer

Lukas Märdian 2027584 at bugs.launchpad.net
Wed Jul 19 13:29:49 UTC 2023


So I found a minimal reproducer and prepared a unit-test case:

```
#!/bin/bash
# setup
netplan set network.renderer=NetworkManager --origin-hint=00-no-netdefs-just-globals
netplan set network.ethernets.eth99.dhcp4=true --origin-hint=90-some-netdefs
ls -l /etc/netplan/
# test
netplan set network.ethernets.eth99=NULL
# result
cat /etc/netplan/00-no-netdefs-just-globals.yaml
```

```
    def test_set_no_netdefs_just_globals(self):  # LP: #2027584
        keepme1 = os.path.join(self.workdir.name, 'etc', 'netplan',
                              '00-no-netdefs-just-renderer.yaml')
        with open(keepme1, 'w') as f:
            f.write('''network: {renderer: NetworkManager}''')
        keepme2 = os.path.join(self.workdir.name, 'etc', 'netplan',
                              '00-no-netdefs-just-version.yaml')
        with open(keepme2, 'w') as f:
            f.write('''network: {renderer: NetworkManager}''')
        deleteme = os.path.join(self.workdir.name, 'etc', 'netplan',
                                '90-some-netdefs.yaml')
        with open(deleteme, 'w') as f:
            f.write('''network: {ethernets: {eth99: {dhcp4: true}}}''')

        self._set(['ethernets.eth99=NULL'])
        self.assertFalse(os.path.isfile(deleteme))
        self.assertTrue(os.path.isfile(keepme1))
        with open(keepme1, 'r') as f:
            yml = yaml.safe_load(f)
            self.assertEqual('NetworkManager', yml['network']['renderer'])
        self.assertTrue(os.path.isfile(keepme2))
        with open(keepme2, 'r') as f:
            yml = yaml.safe_load(f)
            self.assertEqual(2, yml['network']['version'])
```

The issue seems to happen in Jammy+ so it's not necessarily a
regression.

I'm fairly sure it's related to the combination of (as SRUed into Jammy via 0.105-0ubuntu2~22.04.2):
https://github.com/canonical/netplan/pull/254
https://github.com/canonical/netplan/pull/299

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/2027584

Title:
  removing an NM connection removes also the set renderer

Status in netplan:
  Triaged

Bug description:
  While testing netplan 0.106 from
  https://launchpad.net/~slyon/+archive/ubuntu/lp2023238-wpa3/ on Ubuntu
  Core 22:

  ubuntu at ubuntu:~$ sudo snap install network-manager
  network-manager (22/stable) 1.36.6-5 from Canonical✓ installed
  ubuntu at ubuntu:~$ ls /etc/netplan/
  00-default-nm-renderer.yaml  70-netplan-set.yaml
  ubuntu at ubuntu:~$ sudo cat /etc/netplan/*
  network:
    renderer: NetworkManager
  network:
    version: 2

  ubuntu at ubuntu:~$ nmcli c add type gsm ifname '*' con-name arkessa apn arkessa.com
  Connection 'arkessa' (2e763389-e2ca-4465-b633-65b8752fed54) successfully added.

  ubuntu at ubuntu:~$ nmcli c del arkessa
  Connection 'arkessa' (2e763389-e2ca-4465-b633-65b8752fed54) successfully deleted.
  ubuntu at ubuntu:~$ ls /etc/netplan/
  70-netplan-set.yaml
  ubuntu at ubuntu:~$ sudo cat /etc/netplan/*
  network:
    version: 2

  00-default-nm-renderer.yaml, which contains the renderer setting, has
  been removed. I have attached the base snap used for testing.

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




More information about the foundations-bugs mailing list