← Back to issue list

[v3] charmcraft whoami internal error with charm-scoped exported credentials

View original Github issue

Metadata

Project
charmcraft
Number
#1869
Type
issue
State
closed
Author
aieri
Labels
—
Created
Updated
Closed

Current evaluation

Fixed in #1904 via commit 5b85a11e, making whoami handle charm-scoped credentials. Released in Charmcraft 3.2.2.

Resolution: closed resolved

Reason: PR #1904 updated whoami to process package entries returned for charm-scoped credentials instead of raising an AttributeError. The fix was merged as commit 5b85a11e and documented in the 3.2.2 changelog.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description While following https://juju.is/docs/sdk/remote-env-auth, I have created a charm-scoped token. `whoami` fails with an internal error with charmcraft v3 ### To Reproduce ``` $ charmcraft --version charmcraft 3.1.2 $ charmcraft login --export=secrets --charm=openstack-service-checks Opening an authorization web page in your browser. If it does not open, please open this URL: https://api.jujucharms.com/identity/login?did=6e892a7493ff6282d6dc549811befbb835ae2b95d955b08569b6989a5c94ee0dID Login successful. Credentials exported to 'secrets'. $ CHARMCRAFT_AUTH=$(cat secrets) charmcraft whoami charmcraft internal error: AttributeError("'dict' object has no attribute 'type'") Full execution log: '/home/aieri/.local/state/charmcraft/log/charmcraft-20240903-132309.446542.log' $ snap refresh charmcraft --channel 2.x/stable charmcraft (2.x/stable) 2.7.1 from Canonical✓ refreshed $ CHARMCRAFT_AUTH=$(cat secrets) charmcraft whoami name: Andrea Ieri username: aieri id: brFMJfQRgRjqo3hU6Yw7xTbb3awiNAuA permissions: - account-register-package - account-view-packages - package-manage - package-view charms: - name: openstack-service-checks ``` ### Environment charmcraft v3.1.2 on Ubuntu 24.04 ### charmcraft.yaml ```yaml N/A ``` ### Relevant log output ```shell 2024-09-03 13:23:09.447 Starting charmcraft, version 3.1.2 2024-09-03 13:23:09.447 Log verbosity level set to BRIEF 2024-09-03 13:23:09.447 Configuring application... 2024-09-03 13:23:09.447 Preparing application... 2024-09-03 13:23:09.447 Build plan: platform=None, build_for=None 2024-09-03 13:23:09.447 Running charmcraft whoami on host 2024-09-03 13:23:09.447 Setting up StoreService 2024-09-03 13:23:09.448 Storing credentials for 'charmcraft' on 'api.charmhub.io' in keyring 'auth MemoryKeyring'. 2024-09-03 13:23:09.448 Retrieving credentials for 'charmcraft' on 'api.charmhub.io' from keyring 'auth MemoryKeyring'. 2024-09-03 13:23:09.448 HTTP 'GET' for 'https://api.charmhub.io/v1/tokens/whoami' with params None and headers {'Authorization': '<macaroon>', 'User-Agent': 'Charmcraft/3.1.2 (Linux 6.8.0-41-generic; x86_64; CPython 3.10.12; Ubuntu 24.04)'} 2024-09-03 13:23:10.740 charmcraft internal error: AttributeError("'dict' object has no attribute 'type'") 2024-09-03 13:23:10.741 Traceback (most recent call last): 2024-09-03 13:23:10.742 File "/snap/charmcraft/4369/lib/python3.10/site-packages/craft_application/application.py", line 538, in run 2024-09-03 13:23:10.742 return_code = dispatcher.run() or 0 2024-09-03 13:23:10.742 File "/snap/charmcraft/4369/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run 2024-09-03 13:23:10.742 return self._loaded_command.run(self._parsed_command_args) 2024-09-03 13:23:10.742 File "/snap/charmcraft/4369/lib/python3.10/site-packages/charmcraft/application/commands/store.py", line 279, in run 2024-09-03 13:23:10.742 grouped.setdefault(package.type, []).append(package) 2024-09-03 13:23:10.742 AttributeError: 'dict' object has no attribute 'type' 2024-09-03 13:23:10.742 Full execution log: '/home/aieri/.local/state/charmcraft/log/charmcraft-20240903-132309.446542.log' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in #1904 via commit 5b85a11e, making whoami handle charm-scoped credentials. Released in Charmcraft 3.2.2.
stealth/space-bunny-alpha — closed resolved Fixed Charmcraft v3 whoami handling of charm-scoped credentials by merging PR #1904 (commit 5b85a11e), resolving the AttributeError reported in #1869.
qwen3.6-35b-a3b-mtp-q6 — — Charmcraft v3's whoami command crashed with an AttributeError when processing charm-scoped credentials. The report was closed after a quick fix was implemented to resolve the credential parsing error.
qwen/qwen3.6-35b-a3b — — Closed after triage. The whoami AttributeError with charm-scoped credentials was identified as a quick fix and tracked via Jira ticket CRAFT-3350.
qwen/qwen3.6-35b-a3b — — The charmcraft whoami command crashed with an AttributeError when using charm-scoped credentials in v3. The issue was closed after the bug was identified as a quick fix and subsequently resolved.
qwen3.6-35b-a3b-mtp-q6 — — Resolved an AttributeError in charmcraft v3 that caused the whoami command to crash with charm-scoped credentials. Fixed by correcting package type attribute handling in the store command.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#1904 (confidence 100%)

    Merged fix for charm-scoped whoami responses, recorded as commit 5b85a11e.

Related issues

Issue Project State Summary Similarity
#1904 fix(store): make "whoami" work with charm-scoped credentials charmcraft merged Merged PR charmcraft#1904 (commit 5b85a11e) fixed whoami for charm-scoped credentials and closed #1869.
77%
#1957 Release/3.2.2 charmcraft merged Release/3.2.2 PR merged, adding the 3.2.2 changelog entry (+7 lines, commit 9828d0f5). Charmcraft 3.2.2 (2024-10-16) shipped the whoami charm-scoped credentials fix; back-merged to main via #1965.
73%