Merge ~jawn-smith/ubuntu/+source/ubuntu-release-upgrader:ubuntu/jammy into ubuntu/+source/ubuntu-release-upgrader:ubuntu/jammy

Proposed by William Wilson
Status: Needs review
Proposed branch: ~jawn-smith/ubuntu/+source/ubuntu-release-upgrader:ubuntu/jammy
Merge into: ubuntu/+source/ubuntu-release-upgrader:ubuntu/jammy
Diff against target: 386 lines (+346/-0)
3 files modified
DistUpgrade/DistUpgradeQuirks.py (+60/-0)
debian/changelog (+8/-0)
tests/test_quirks.py (+278/-0)
Reviewer Review Type Date Requested Status
Dave Jones (community) Approve
Brian Murray (community) Needs Fixing
Review via email: mp+421557@code.qastaging.launchpad.net

Commit message

If upgrading to jammy on a Raspberry Pi, check for the presence of the broken "match" section of the yaml config. This was present in the default config for Raspberry Pi images dating back to focal.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

See my in-line comment.

review: Needs Fixing
Revision history for this message
Dave Jones (waveform) wrote :

I'm afraid there's a few issues:

* I'd much rather parse the YAML with a yaml library given there's so many possible representations here (which cloud-init is free to use when it converts network-config to the netplan config). For example, match: {driver: "bcmgenet smsc95xx lan78xx"} is valid YAML. I know adding dependencies is generally frowned upon, but python3-yaml is seeded on the pi server and desktop images (presumably because cloud-init and ubuntu-advantage-tools both depend on it, among many other things) so adding it as a dep of u-r-u won't *actually* pull in anything new, would simplify this code, and deal with all possible variants of the configuration.

* If you remove the match/driver: clause, the set-name: clause becomes invalid (it requires a match: clause). In this case it's probably sufficient to just remove the set-name: clause along with the match: clause.

* Ideally the config_txt variable in the various tests should be renamed; it's not the config.txt on the boot partition that's being modified (unlike the prior tests concerned with removing u-boot), it's the netplan yaml.

Other than that: nice to see a good set of tests, covering all the netplan config scenarios (match present, not present, present but only in certain files)!

review: Needs Fixing
Revision history for this message
William Wilson (jawn-smith) wrote :

Ah I had thought about using python3-yaml but didn't want to add dependencies to the upgrader, which I figured could be problematic. I didn't check if it was seeded though.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

If you are going to add python3-yaml as a dependency in jammy, then it should either (1) be SRU'd to focal and impish, or (2) there should be logic to handle a potential import exception.

This recently came up in bug 1965568, i.e. I learned this the hard way.

Revision history for this message
Brian Murray (brian-murray) wrote :

> If you are going to add python3-yaml as a dependency in jammy, then it should
> either (1) be SRU'd to focal and impish, or (2) there should be logic to
> handle a potential import exception.
>
> This recently came up in bug 1965568, i.e. I learned this the hard way.

Option 1 would result in there be two SRUs. One from the release being upgraded from and one for the release being upgraded to.

Revision history for this message
Dave Jones (waveform) wrote :

If it were a genuinely new dependency I would indeed worry, but I'm *fairly* sure python3-yaml's been seeded since forever (or since focal at least, which is the earliest we need to concern ourselves with as upgrades never span more than one LTS). Just checking ...

$ curl -s http://cdimage.ubuntu.com/ubuntu/releases/focal/release/ubuntu-20.04.4-preinstalled-server-arm64+raspi.manifest | grep python3-yaml
python3-yaml 5.3.1-1ubuntu0.1
$ curl -s http://cdimage.ubuntu.com/ubuntu/releases/focal/release/ubuntu-20.04.4-preinstalled-server-armhf+raspi.manifest | grep python3-yaml
python3-yaml 5.3.1-1ubuntu0.1
$ curl -s http://old-releases.ubuntu.com/releases/20.04.0/ubuntu-20.04-desktop-amd64.manifest | grep python3-yaml
python3-yaml 5.3.1-1
$ curl -s http://old-releases.ubuntu.com/releases/20.04.0/ubuntu-20.04-live-server-amd64.manifest | grep python3-yaml
python3-yaml 5.3.1-1

Yup, python3-yaml was seeded at least as far back as focal on PC server, PC desktop, and pi server images. So, technically yes, an SRU *should* be done but I wouldn't worry greatly in this particular case as python3-yaml should be universally installed.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

> Yup, python3-yaml was seeded at least as far back as focal on PC server, PC
> desktop, and pi server images. So, technically yes, an SRU *should* be done
> but I wouldn't worry greatly in this particular case as python3-yaml should be
> universally installed.

Right, then option (2) is probably more appropriate in this case. William's original patch already has a helpful `failure_action` string, so this should be displayed to the user if for some reason `import yaml` raises an exception.

Revision history for this message
Dave Jones (waveform) wrote :

Some inline comments; one thing needs changing (orig_yaml being a ref to netplan_yaml) but otherwise looking much better!

Revision history for this message
Dave Jones (waveform) wrote :

Excellent, looking good now (and no, there's nothing wrong with KeyError: continue :)

review: Approve

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches