canonical / ubuntu-pro-client

Ubuntu Pro Client for offerings from Canonical
https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/
GNU General Public License v3.0
52 stars 73 forks source link

realtime: auto-select raspi variant when appropriate #3144

Closed orndorffgrant closed 3 months ago

orndorffgrant commented 3 months ago

Why is this needed?

This helps users get the right realtime-kernel when running on a raspberry pi. It also informs users of what variant will be installed when it is auto-selected.

Test Steps

Ideally test on a rpi3/4/5 and test that auto-selection works as expected (select raspi on 4/5 and generic everwhere else) Or you can trick the rpi5 detection on a multipass vm with something like this:

./tools/test-in-multipass.sh noble

# now in vm
pro attach --no-auto-enable

cat > /usr/local/bin/dpkg << EOF
#!/usr/bin/bash
echo arm64
EOF
chmod +x /usr/local/bin/dpkg

sed -i 's/(proc_file_path)/("\/home\/ubuntu\/fake")/' /usr/lib/python3/dist-packages/uaclient/entitlements/realtime.py
echo "Raspberry Pi 5 Model B Rev 1.0" > /home/ubuntu/fake

Then pro enable realtime-kernel and ensure that the raspi variant is auto-selected.

Also test that raspi is not selected if the proc file is mocked but the arch is not arm64.

Checklist

Does this PR require extra reviews?

github-actions[bot] commented 3 months ago

🌎 This PR changes translatable messages. 🌏

Please select which scenarios apply. For further explanation, please read our policy on message changes.

github-actions[bot] commented 3 months ago

Jira: This PR is not related to a Jira item. (The PR title does not include a SC-#### reference)

GitHub Issues: No GitHub issues are fixed by this PR. (No commits have Fixes: #### references)

Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references)

Documentation: The changes in this PR do not require documentation changes.

👍 this comment to confirm that this is correct.