"cups" interface merged into snapd - Additional steps to complete

Now I am doing an up/downgrade test (before starting I was on snapd 2.55.3, at the end of the tests of the previous post, also keep in mind that the Snap cups-admin-test plugs cups-control and the Snap cups-admin-test-no-control plugs cups):

$ sudo snap refresh --candidate snapd
2022-04-09T15:52:23+02:00 INFO Waiting for automatic snapd restart...
snapd (candidate) 2.55.2 from Canonical✓ refreshed
$ snap run --shell cups-admin-test-no-control.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER
/var/cups/cups.sock
$ stat / /var/cups | grep Device
Device: 740h/1856d	Inode: 11789       Links: 21
Device: 10302h/66306d	Inode: 53813571    Links: 2
$ exit
exit
$ snap run --shell cups-admin-test.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER

$ stat / /var/cups | grep Device
Device: 740h/1856d	Inode: 11789       Links: 21
Device: 740h/1856d	Inode: 11669       Links: 2
$ exit
exit
$ sudo /usr/lib/snapd/snap-discard-ns cups-admin-test
$ snap run --shell cups-admin-test.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER
/var/cups/cups.sock
$ stat / /var/cups | grep Device
Device: 740h/1856d	Inode: 11789       Links: 21
Device: 740h/1856d	Inode: 11669       Links: 2
$ exit
exit
$ snap run --shell cups.cupsd
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER

$ exit
exit
$ sudo /usr/lib/snapd/snap-discard-ns cups
$ snap run --shell cups.cupsd
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER
/var/cups/cups.sock
$ exit
exit
$ sudo snap refresh --beta snapd
2022-04-09T15:56:58+02:00 INFO Waiting for automatic snapd restart...
snapd (beta) 2.55.3 from Canonical✓ refreshed
$ snap run --shell cups-admin-test.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER
/var/cups/cups.sock
till@till-x1nano:/home/till/printing/openprinting/cups-snap/x$ exit
exit
$ sudo /usr/lib/snapd/snap-discard-ns cups-admin-test
$ snap run --shell cups-admin-test.lpstat
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER

$ exit
exit
$ snap run --shell cups.cupsd
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER
/var/cups/cups.sock
$ exit
exit
$ sudo /usr/lib/snapd/snap-discard-ns cups
$ snap run --shell cups.cupsd
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $CUPS_SERVER

$ exit
exit
$ 

Here one sees that updating or downdating snapd does not update the environments of the installed Snaps, independent whether variables need to get set or removed. One gets the installed Snaps only up-to-date with the running snapd if one runs snap-discard-ns on each of them. So to get all problems solved with updating snapd and with the cups interface bug fix (and consistent updating in general) the snapd install/update process should run snap-discard-ns on each installed Snap.

In the above example I am on snapd 2.55.3, which sets the CUPS_SERVER environment variable correctly only in Snaps plugging cups, identified by the bind mount on /var/cups/. Now to investigate u/downgrade behavior of snapd, I downgrade to snapd 2.55.2 by switching into the candidate channel. This version wrongly sets the CUPS_SERVER environment variable on every Snap. So I now expect it to be set on all my test Snaps. This is not the case, it is set only on the cups-admin-test-no-control Snaps, as it gets done by snapd 2.55.3, but we are under 2.55.2 now. So I run snap-discard-ns on all my test Snaps now and only then I get the snapd 2.55.2 behavior of CUPS_SERVER being set in all Snaps.

Now I upgrade back to snapd 2.55.3 by switching to the beta channel again. I expect an immediate transition to the correct configuration of the CUPS_SERVER environment variable being set only in the Snap which plugs cups, but it is still set in the other Snaps. I again have to run snap-discard-ns on all my test Snaps to get their CUPS_SERVER settings correct according to snapd 2.55.3.