Skip to content

feat(pro): deploy the ubuntu-pro charm instead of ubuntu-advantage - #1020

Merged
hmlanigan merged 1 commit into
canonical:mainfrom
vsz-work:open-4914-ubuntu-pro-charm
Nov 12, 2026
Merged

hmlanigan merged 1 commit into
canonical:mainfrom
vsz-work:open-4914-ubuntu-pro-charm

Conversation

@vsz-work

@vsz-work vsz-work commented Nov 9, 2026 •

Copy link
Copy Markdown

The ubuntu-advantage charm is deprecated in favour of ubuntu-pro. This PR switches the pro feature's Terraform plan so that sunbeam enable pro deploys ubuntu-pro from latest/stable. That channel publishes an ubuntu@24.04 build, amd64 only.

Changes:

  • deploy-pro/main.tf: the charm is now ubuntu-pro. The Juju application name (ubuntu-pro) and the Terraform resource address (juju_application.ubuntu_pro) are unchanged. As a result, sunbeam disable pro still removes an application deployed with the old charm, because it destroys whatever is recorded in Terraform state.
  • deploy-pro/variables.tf: ubuntu-advantage-channel is renamed to ubuntu-pro-channel, and its default changes from latest/edge to latest/stable. Nothing else referenced the old variable.
  • feature.py: adds a UBUNTU_PRO_CHANNEL constant, which a test checks against the Terraform default. The charm reports attach failures in the same Failed running command ... stderr: ... stdout: ... format as before, so the code that extracts the blocked-status error is unchanged.
  • test_pro.py: new tests for the blocked-status error paths, which were previously untested, and for the plan deploying ubuntu-pro with the expected channel default.

There is no in-place migration. On an existing deployment with pro enabled, run sunbeam disable pro and then sunbeam enable pro to move to the new charm. Operator docs and release notes for this are tracked separately in OPEN-4913. This change targets 2026.1 onwards and will not be backported to 2025.1 or earlier.

Depends on #1023 sunbeam disable pro is currently broken on main, stable/2026.1 and stable/2025.1: it never passes the required machine_model_uuid, so Terraform refuses to run. That fix (OPEN-4916) has to land before this PR, or with it in the same release. Otherwise existing deployments have no way to move to the new charm.

Partial-bug: #2158218

QA steps

Automated:

cd sunbeam-python
tox -e pep8,mypy
tox -e unit -- tests/unit/sunbeam/features/test_pro.py

cd sunbeam/features/pro/etc/deploy-pro
terraform init -backend=false && terraform validate

The manual steps below need a snap that also has the disable fix, e.g. this branch with # cherry-picked. With this branch alone, every sunbeam disable pro step fails.

New deployment (needs an Ubuntu Pro token):

  1. Install a snap built from this branch on a 2026.1 cluster and bootstrap it.
  2. Run sunbeam enable pro <token>, then juju status -m openstack-machines ubuntu-pro.
    • The ubuntu-pro application uses charm ubuntu-pro from latest/stable, with an active unit on every machine.
  3. Run sunbeam disable pro.
    • The ubuntu-pro application and its juju-info integration with sunbeam-machine are removed.
  4. Run sunbeam enable pro <invalid-token>.
    • The command fails and prints the error from the charm.

Existing deployment (old charm):

  1. Bootstrap with the current 2026.1/edge snap and run sunbeam enable pro <token>.
    • The ubuntu-pro application runs charm ubuntu-advantage.
  2. Refresh to a snap built from this branch.
    • The deployed charm is still ubuntu-advantage. Nothing changes until pro is disabled.
  3. Run sunbeam disable pro.
    • The ubuntu-pro application (old charm) and its juju-info integration are removed.
  4. Run sunbeam enable pro <token>.
    • The ubuntu-pro application now runs charm ubuntu-pro (latest/stable, rev 45), and the machine is attached.

Tested

On 2026-11-10, a single-node 2026.1 cluster in an LXD VM went through the existing-deployment steps above. It used a snap built from this branch with the disable fix cherry-picked:

Step Result
Enable on 2026.1/edge (rev 1165) ubuntu-advantage deployed and attached
Refresh to this build Deployed charm unchanged
sunbeam disable pro Succeeded. The application was already gone when the command returned
sunbeam enable pro ubuntu-pro latest/stable rev 45 on ubuntu@24.04, active and attached, within the 5-minute timeout
clean 2026.1/edge install with pro enabled, uses old charm
ubuntu-pro:
  charm-name: ubuntu-advantage
  charm-channel: latest/edge
  charm-rev: 147
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
sunbeam-machine:
  charm-name: sunbeam-machine
  charm-channel: 2026.1/edge
  charm-rev: 241
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
  - sunbeam-machine
after snap refresh, still has old charm, no in-place migration
ubuntu-pro:
  charm-name: ubuntu-advantage
  charm-channel: latest/edge
  charm-rev: 147
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
sunbeam-machine:
  charm-name: sunbeam-machine
  charm-channel: 2026.1/edge
  charm-rev: 241
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
  - sunbeam-machine
after pro disable, no ubuntu-pro app
ubuntu-pro: <absent>
sunbeam-machine:
  charm-name: sunbeam-machine
  charm-channel: 2026.1/edge
  charm-rev: 241
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - sunbeam-machine
after pro enable, new charm is listed
ubuntu-pro:
  charm-name: ubuntu-pro
  charm-channel: latest/stable
  charm-rev: 45
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
sunbeam-machine:
  charm-name: sunbeam-machine
  charm-channel: 2026.1/edge
  charm-rev: 241
  base:
    name: ubuntu
    channel: '24.04'
  status: active
  relations:
  - juju-info
  - sunbeam-machine

Known gaps, tracked under OPEN-4916 and not changed here:

  • Disable doesn't detach the machine. Neither charm detaches on removal; they detach only when token is set to empty, and disable deletes the application instead. The machine stays attached until the next enable, whose attach detaches first.
  • First enable can time out. With the old charm, the first sunbeam enable pro on a fresh VM took more than 10 minutes, longer than the 5-minute APP_TIMEOUT. The re-enable above was quick because the machine was already attached. A first enable with the new charm on a fresh machine hasn't been measured yet.

Links

The ubuntu-advantage charm is deprecated in favour of ubuntu-pro.
Switch the deploy-pro plan to deploy ubuntu-pro from latest/stable,
which publishes an ubuntu@24.04 build (amd64 only).

The Juju application name and the Terraform resource address are kept
as ubuntu-pro / juju_application.ubuntu_pro, so `sunbeam disable pro`
still removes an application deployed with the old charm. There is no
in-place migration: existing deployments must disable and re-enable
pro to move to the new charm.

The ubuntu-advantage-channel variable is renamed to ubuntu-pro-channel.
The ubuntu-pro charm reports attach failures in the same
"stderr: ... stdout: ..." format, so the error extraction is unchanged.

Add unit tests for the blocked-status error paths and for the plan
deploying ubuntu-pro with a channel default matching
UBUNTU_PRO_CHANNEL.

Jira: OPEN-4914
Assisted-By: Claude Code (Claude Opus 5.5)
Partial-Bug: #2158218
Signed-off-by: Vítor Zeni <vitor.zeni@bairesdev.com>
@vsz-work
vsz-work marked this pull request as draft November 9, 2026 17:53
@vsz-work
vsz-work marked this pull request as ready for review November 10, 2026 14:13

@hmlanigan hmlanigan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@Raven-182 Raven-182 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks. For the issue with timeout on first enable mentioned in the description, we should create a launchpad bug to track that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants