← Back to issue list

charmcraft doesn't support actions

View original Github issue

Metadata

Project
charmcraft
Number
#35
Type
issue
State
closed
Author
lourot
Labels
—
Created
Updated
Closed

Current evaluation

Reported that charmcraft builds omitted actions.yaml, so charms with actions failed on install with 'CharmEvents' has no attribute. Fixed by merged PR #36 (commit a8cdb744), which makes 'charmcraft build' copy actions.yaml and config.yaml into the charm.

Resolution: closed resolved

Reason: PR #36 ("'charmcraft build' should pull in actions.yaml and config.yaml", commit b2a7bd91, merge a8cdb744) was merged and automatically packages optional actions.yaml/config.yaml in built charms. The reporter confirmed "Solved by #36" before closing.

Evaluated by: mr-cal-bot

No scores available.

Issue body

See this simple hello-world charm with an action: https://github.com/AurelienLourot/charm-ops-with-action Without charmcraft it works but with charmcraft it fails with ``` 2020-06-16 09:57:36 ERROR juju-log Uncaught exception while in charm code: Traceback (most recent call last): File "/var/lib/juju/agents/unit-ops-with-action-0/charm/hooks/install", line 38, in <module> main(CharmOpsWithAction) File "lib/ops/main.py", line 313, in main charm = charm_class(framework) File "/var/lib/juju/agents/unit-ops-with-action-0/charm/hooks/install", line 30, in __init__ self.framework.observe(self.on.hello_action, self.on_hello_action) AttributeError: 'CharmEvents' object has no attribute 'hello_action' 2020-06-16 09:57:36 ERROR juju.worker.uniter.operation runhook.go:132 hook "install" failed: exit status 1 ``` This is apparently because charmcraft doesn't copy `actions.yaml` into the charm.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Reported that charmcraft builds omitted actions.yaml, so charms with actions failed on install with 'CharmEvents' has no attribute. Fixed by merged PR #36 (commit a8cdb744), which makes 'charmcraft build' copy actions.yaml and config.yaml into the charm.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/charmcraft#36, merged to package actions.yaml and config.yaml automatically in built charms.
qwen/qwen3.6-35b-a3b — — Resolved by PR #36, which updated charmcraft to correctly copy actions.yaml into packaged charms, fixing the AttributeError when using the ops framework.
qwen/qwen3.6-35b-a3b — — Resolved by merging PR #36, which fixed the packaging bug that prevented charmcraft from including actions.yaml and supporting Juju actions.
qwen/qwen3.6-35b-a3b — — Fixed by PR #36, which updated charmcraft to correctly package actions.yaml into built charms, resolving the missing action attribute error during hook execution.
qwen3.6-35b-a3b-mtp-q6 — — Resolved by PR #36, which updated charmcraft to properly copy actions.yaml into packaged charms, fixing the AttributeError when using the ops framework with actions.

Update history

No update history recorded yet.

Related work

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

    Merged PR adding automatic inclusion of actions.yaml/config.yaml; closing comment from the reporter cites it.

  • Related To: canonical/charmcraft#1829 (confidence 35%)

    Later fix so reactive charms' actions.yaml is not overwritten, showing continued evolution of actions.yaml handling.

Related issues

Issue Project State Summary Similarity
#36 'charmcraft build' should pull in actions.yaml and config.yaml charmcraft merged Merged PR #36 as commit a8cdb744, making charmcraft build automatically include actions.yaml and config.yaml in charm builds.
82%
#763 charmcraft V1.5.0 and V1.6.0 not bundling up bash actions charmcraft closed Reported that charmcraft 1.5.0/1.6.0 omitted the charm's `actions` directory from built charms. Maintainer facundobatista closed it as a duplicate of #764, which was fixed by merged PR #768 (commit 5ada563c).
81%
#1114 config: support use actions in charmcraft.yaml charmcraft merged Merged #1114 as commit 201b40f6, enabling actions in charmcraft.yaml and refactoring configuration models to avoid circular imports.
77%
#197 `charmcraft init` should not populate actions.yaml with real data charmcraft closed charmcraft#197 was closed as abandoned after years of inactivity, with no recorded resolving PR or commit.
72%
#249 `charmcraft build` will let you build a charm that won't deploy charmcraft closed Closed by facundobatista as a duplicate, tracking all build-time sanity checks (incl. config.yaml/actions.yaml validity) in the umbrella issue charmcraft#27; later implemented by merged PR #556 (a585aec6).
71%
#764 The `actions` directory is not being included by default charmcraft closed Fixed by merged PR #768 (commit 5ada563c), which now includes an existing root actions directory in built charms.
70%