add helper for discovering and aliasing system architecture
- Dominant language
- Python
- Stars
- 1
- Forks
- 8
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 1
Description
Several of our charms do something like this for architecture discovery:
```
arch = platform.processor()
if arch in ["x86_64", "amd64"]:
self._arch = "amd64"
elif arch in ["aarch64", "arm64", "armv8b", "armv8l"]:
self._arch = "arm64"
else:
self._arch = arch
```
Examples (note that they don't all map to the same final `arch` alias names):
* [cos-proxy](https://github.com/canonical/cos-proxy-operator/blob/5115a06e5b0392589cebaa96801154f6fc4aaac0/src/charm.py#L344-L347)
* [loki_push_api lib](https://github.com/canonical/loki-k8s-operator/blob/main/lib/charms/loki_k8s/v1/loki_push_api.py#L1853-L1859)
* [grafana agent operator pr](https://github.com/canonical/grafana-agent-operator/pull/131)
* [script exporter](https://github.com/canonical/script-exporter-operator/blob/bda9401eb4e384fdb41141561b741f1b3deef364/src/charm.py#L41)
* [parca](https://github.com/canonical/parca-agent-operator/blob/20f45a8db833ef0875cd8c1a02c91ceddc2f20d3/src/parca_agent.py#L20)
We should decide on one common method and include it here as a helper.
References:
- [craft-parts get_host_architecture](https://github.com/canonical/craft-parts/blob/85e45f6d31a64d6d8712eb326bba3d067e066832/craft_parts/infos.py#L983).
Contributor guide
No contributing guide indexed for this repository
Research direction
Compare the architecture handling in the linked cos-proxy, loki_push_api, script exporter, and parca examples with craft-parts' get_host_architecture implementation. Decide the common aliases and helper behavior, then verify that the resulting utility covers the architectures shown and is consistent across callers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100