Skip to content

Commit

Permalink
pro: replace deprecated cloud-init key ubuntu_advantage
Browse files Browse the repository at this point in the history
On cloud-init versions >= 24.1, having the ubuntu_advantage key leads to
the following deprecation notice:

  > cc_ubuntu_pro.py[WARNING]: Deprecated configuraiton key(s) provided:
  > ubuntu_advantage. Expected "ubuntu_pro": will attempt to continue.

Let's use ubuntu_pro instead ; which should be available on 20.04.5,
22.04.5 and all the 24.04+ ISOs.

Signed-off-by: Olivier Gayot <[email protected]>
  • Loading branch information
ogayot committed Aug 27, 2024
1 parent f5c04a7 commit 2f225ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ python3 scripts/check-yaml-fields.py "$tmpdir"/var/log/installer/curtin-install/
python3 scripts/check-yaml-fields.py <(python3 scripts/check-yaml-fields.py $tmpdir/etc/cloud/cloud.cfg.d/99-installer.cfg datasource.None.userdata_raw) \
locale='"en_GB.UTF-8"' \
timezone='"Pacific/Guam"' \
ubuntu_advantage.token='"C1NWcZTHLteJXGVMM6YhvHDpGrhyy7"' \
ubuntu_pro.token='"C1NWcZTHLteJXGVMM6YhvHDpGrhyy7"' \
'snap.commands=[snap install --channel=3.2/stable etcd]'
grep -q 'finish: subiquity/Install/install/postinstall/install_package1: SUCCESS: installing package1' \
$tmpdir/subiquity-server-debug.log
Expand Down
2 changes: 1 addition & 1 deletion subiquity/models/tests/test_ubuntu_pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_make_cloudconfig_(self):
# Test with a token
model.token = "0a1b2c3d4e5f6"
expected = {
"ubuntu_advantage": {
"ubuntu_pro": {
"token": "0a1b2c3d4e5f6",
}
}
Expand Down
5 changes: 1 addition & 4 deletions subiquity/models/ubuntu_pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ def make_cloudconfig(self) -> dict:
"""
if not self.token:
return {}
# Both "ubuntu_advantage" and "ubuntu-advantage" keys are accepted, but
# "ubuntu-advantage" is deprecated despite not being mentioned in the
# documentation.
return {
"ubuntu_advantage": {
"ubuntu_pro": {
"token": self.token,
},
}

0 comments on commit 2f225ab

Please sign in to comment.