← Back to issue list

charmcraft init --profile machine does not produce a valid charmcraft.yaml

View original Github issue

Metadata

Project
charmcraft
Number
#2167
Type
issue
State
closed
Author
erik78se
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by #2200 (commit c4d43add), which migrated the machine init template from legacy bases syntax to platforms.

Resolution: closed resolved

Reason: PR #2200 was merged in commit c4d43add, replacing the invalid legacy bases configuration with the platforms notation required by newer Ubuntu bases.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description charmcraft init --profile machine Does not produce a charmcraft.yaml that works ### To Reproduce charmcraft init --profile machine ### Environment charmcraft version = 3.4.2 ### charmcraft.yaml ```yaml gets produced ``` ### Relevant log output ```shell charmcraft init --profile machine Charmed operator package file and directory tree initialised. Now edit the following package files to provide fundamental charm metadata and other information: charmcraft.yaml src/charm.py README.md erik@frozen:~/opdb$ charmcraft fetch-lib charms.data_platform_libs.v0.data_interfaces Library charms.data_platform_libs.v0.data_interfaces version 0.41 downloaded. erik@frozen:~/opdb$ code . erik@frozen:~/opdb$ charmcraft pack Bad charmcraft.yaml content: - base requires 'platforms' definition: {'name': 'ubuntu', 'channel': '24.04'} (in field 'bases[0]') ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by #2200 (commit c4d43add), which migrated the machine init template from legacy bases syntax to platforms.
stealth/space-bunny-alpha — closed resolved The machine template’s legacy bases syntax was replaced with platforms notation by PR #2200 (commit c4d43add), implementing the planned template migration.
qwen3.6-35b-a3b-mtp-q6 — — Closed and converted to a feature request. The machine profile template uses the legacy bases key, causing validation failures on newer versions. Resolution involves updating templates to use the platforms key.
qwen/qwen3.6-35b-a3b — — Closed as a feature request to migrate charmcraft templates from the bases key to platforms. Maintainers noted the default 22.04 template accepts bases, but updating templates to platforms is required for newer Ubuntu versions.
qwen/qwen3.6-35b-a3b — — Closed and converted to a feature request. Maintainers confirmed the generated YAML was valid for Ubuntu 22.04 but decided to update all templates to use the new platforms key instead of the deprecated bases key.
qwen3.6-35b-a3b-mtp-q6 — — Closed and converted to a feature request. The template generates for 22.04, which accepts bases, so the error likely stemmed from manually switching to 24.04. The team will update templates to use the platforms key instead.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#2200 (confidence 99%)

    The issue resolution identifies #2200 and commit c4d43add as the template migration that fixed it.

Related issues

Issue Project State Summary Similarity
#1139 `charmcraft init --profile machine` doesn't produce `config.yaml` charmcraft closed Fixed in canonical/charmcraft#1149 via commit ca4df024: machine init now uses charmcraft.yaml and no longer tells users to edit metadata.yaml or config.yaml.
83%
#328 charmcraft init produces error charm for machine charms charmcraft closed Machine charms gained a dedicated charmcraft init profile, resolving Kubernetes-only initialization; the change was merged in PR #868 (commit 2ed9033c).
78%
#868 Added a machine profile to init command (CRAFT-1046). charmcraft merged Merged PR #868 added a machine profile to charmcraft init, resolving #568 and #593; merge commit: a6c21119.
74%
#1259 Init output issue charmcraft closed Fixed by merged PR #1149 (commit ca4df024): machine-profile init no longer advertises nonexistent config.yaml and metadata.yaml after adopting charmcraft.yaml.
73%
#2494 charmcraft pack wont produce a proper charm charmcraft open Machine-profile init used Ubuntu 22.04 and lacked clear uv-lock guidance. The current implementation defaults machine to 24.04 and supplies uv/migration instructions, so the reported template concerns appear addressed.
73%
#1149 command: charmcraft init to use charmcraft.yaml only charmcraft merged Merged in ca4df024: charmcraft init now generates a unified charmcraft.yaml containing metadata, actions, and config, with profile descriptions and an updated URL.
72%
#568 Add a `charmcraft init` template for machine charms charmcraft closed The machine-charm init-template request was closed without a linked fix after the March 2022 discussion; later profile work is not tied to its closure.
72%
#966 `charmcraft init --help` doesn't list the available profiles charmcraft closed Fixed by merged PR #2311 (commit c24c0f47): charmcraft init help now lists Kubernetes, machine, and supported 12-factor profiles.
71%