Repository navigation
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest - #1047
Open
vsz-work wants to merge 2 commits into
Open
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest#1047vsz-work wants to merge 2 commits into
vsz-work wants to merge 2 commits into
Conversation
…g from the manifest
The deploy-pro plan only set the token on the ubuntu-advantage charm, so
contract_url and the other charm options kept their defaults. The only
way to change them was a manual `juju config`, which Sunbeam does not
own and can lose on a later apply or redeploy.
Register the ubuntu-advantage charm in the pro feature's default
software config, with UBUNTU_ADVANTAGE_CHANNEL (latest/edge, the
existing plan default) as its channel, and map its channel, revision
and config to new or existing plan variables, as other features do:
- ubuntu-advantage-channel (existing)
- ubuntu-advantage-revision (new, default null)
- ubuntu-advantage-config (new, map(string), default {})
Any charm option can now be set in the manifest, for example:
features:
pro:
software:
charms:
ubuntu-advantage:
config:
contract_url: https://contracts.example.com
The plan merges the manifest config under the token passed on the
command line, so the CLI token always wins over a token key in the
manifest.
Backport notes: stable/2025.1, like stable/2024.1, still deploys the
ubuntu-advantage charm (the switch to ubuntu-pro is only on main), so
the manifest key, tfvars and default channel use the ubuntu-advantage
names. The new CHARM constant holds the charm name, which differs from
the ubuntu-pro application name; refresh looks manifest entries up by
charm name. The ubuntu-pro plan tests from main are not included.
Jira: OPEN-4937
Assisted-By: Claude Code (Claude Opus 5.5)
Related-Bug: #2174604
(cherry picked from commit 03ffd06)
Signed-off-by: Vítor Zeni <vitor.zeni@bairesdev.com>
…le> pro` The pro feature never stored a manifest given with --manifest. The file only applied to that one run, and a later `sunbeam enable pro <token>` read the latest manifest from clusterd, fell back to an empty charm config and dropped options such as contract_url again. Start the enable plan with AddManifestStep when --manifest is given, as the OpenStack features and telemetry already do. Like for those features, the file is stored as the whole latest manifest, so it should be a full manifest (e.g. from `sunbeam manifest show latest`) with the pro section added, not a pro-only file. Without --manifest the plan is unchanged. Jira: OPEN-4937 Assisted-By: Claude Code (Claude Opus 5.5) Closes-Bug: #2174604 Signed-off-by: Vítor Zeni <vitor.zeni@bairesdev.com> (cherry picked from commit 63bfa2b)
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest
vsz-work
marked this pull request as ready for review
November 25, 2026 19:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(pro): set the ubuntu-advantage charm channel, revision and config from the manifest03ffd06d(#1032), as adapted in #1039channel,revisionandconfig. The CLI token always wins over atokenkey in the manifestfix(pro): store the manifest passed to sunbeam enable --manifest <file> pro63bfa2b2(#1032), as in #1039enable --manifeststores the file as the latest manifest, so laterenable proruns keep the settingsAdaptations for 2025.1
None beyond the 2024.1 ones.
stable/2025.1has the same pro feature, plan and tests asstable/2024.1: thedeploy-proplan still deploys theubuntu-advantagecharm, and #1020 (switch toubuntu-pro) is only on main. So these are #1039's commits, cherry-picked unchanged. They apply cleanly; only the "Backport notes" paragraph in the first commit message now names 2025.1. As in #1039:ubuntu-advantage(theCHARMconstant), notubuntu-pro. The Juju application is still namedubuntu-pro, butsunbeam cluster refreshlooks manifest entries up by the deployed charm name (find_charm), so the key has to match the charm.ubuntu-advantage-channel(existing), plus newubuntu-advantage-revisionandubuntu-advantage-config.latest/edge(UBUNTU_ADVANTAGE_CHANNEL), the existing default of the plan's channel variable, so existing deployments don't move channel.The code the backport relies on (
AddManifestStep,validate_charm_keys,find_charmin the in-channel refresh,manifest_attributes_tfvar_map,enable --manifest) is the same on 2025.1 as on 2024.1. The only differences between the two branches in that area are unrelated: a TLS re-provision step inrefresh.pythat only 2024.1 has, and an import typo fix inmain.py.Manifest example on 2025.1:
Why 2025.1 needs it too
The bug targets 2024.1, 2026.1 and main, but 2025.1 is a current stable series and has the same gap. There's also an upgrade dependency on #1039: Sunbeam validates the stored manifest's charm keys on every command. A 2024.1 deployment that stores an
ubuntu-advantageentry (possible once #1039 lands) and is upgraded to a 2025.1 snap without this backport would fail every command that loads the manifest withManifest Software charms keys should be one of …. With this backport, 2024.1 → 2025.1 keeps working because both use the same key.Caveats (same as #1039)
latest/edge→latest/stablecan't be done. On 24.04 amd64,ubuntu-advantagelatest/edge(rev 147, the default) is a charm format v2 build andlatest/stable(rev 143) is v1. Juju refuses v2 → v1 (ERROR cannot downgrade from v2 charm format to v1, seen in backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest #1039's QA). Moving to stable needs a disable, then an enable with the stable channel. stable → edge works.ubuntu-advantageto one withubuntu-proneeds the pro section renamed or dropped first. See backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest #1039 for the options.QA steps
Unit tests:
On a 2025.1 single-node deployment, with a snap built from this branch:
Tested
stable/2025.1+ this branchruff format,ruff checkandmypy sunbeamare cleanterraform fmt -checkandterraform validateondeploy-proubuntu-advantagelatest/edgerev 147, as before; tfvarsubuntu-advantage-channel: latest/edge, no-config;contract_urlis the charm defaultcontract_urlfrom--manifest(keyubuntu-advantage)ubuntu-advantage-config;juju configanduaclient.confshow the value; the charm re-attached; attached--manifestubuntu-advantageentry; the value is kepttokenkey in the manifest configcontract_urlback to the charm defaultenable profails:unknown option "contrct_url"; the unit stays active and attachedlatest/stable, thencluster refreshtolatest/edgelatest/stablerev 143 from the manifest. Refresh with no pro section found the default entry (Running refresh for app ubuntu-pro with manifest config): rev 143 →latest/edgerev 147,upgrade-charm+config-changed, no detach. CLI token kept; attached; stored manifest has no pro sectionenable proafter the refreshlatest/edge;Apply complete! Resources: 0 added, 0 changed, 0 destroyed; charm unchanged; attachedubuntu-proapp orjuju-inforelation left. Needs #1023Sunbeam VM run (2026-11-25):
2025.1/candidate, then the QA snap installed over it. Juju 3.6.29.2025.1/candidate's embedded manifest has noepa-orchestratorentry, so bootstrap fails with the default manifest. It was bootstrapped with--manifestand an addedepa-orchestratorentry (2025.1/candidate). This is unrelated to this PR.disable proneeds fix(pro): pass machine_model_uuid when disabling Ubuntu Pro #1023 (machine_model_uuid), and without fix(pro): detach machines from Ubuntu Pro before removing the charm #1028 the machine was detached by hand after each disable.https://contracts.canonical.com/, as in feat(pro): manage the ubuntu-pro charm from the manifest and store enable --manifest #1032 and backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest #1039.C2, tfvars written by Sunbeam (token removed) and the charm's log:
{ "ubuntu-advantage-config": { "contract_url": "https://contracts.canonical.com/" }, "machine_model_uuid": "…" }C7b, refresh from
latest/stableto the defaultlatest/edge:Full trimmed evidence: attached
lp2174604-2025.1-qa.pr.txt.The behaviour was also tested end to end on main in #1032 (T1–T10) and on 2024.1 in #1039 (B1–B10).
Links
ubuntu-procharm, main only)Jira card: OPEN-XXXX