canonical / canonical/cloud-init
[enhancement]: stop setting a default locale
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Enhancement
Cloud-init provides the ability to set the locale. This history of locale in cloud-init goes back to a time when locale was set based on which EC2 region [an instance was in](https://github.com/canonical/cloud-init/commit/2d667f57536a532d84872404e19e777820692665). Today, if a user or cloud wants to set locale, they can use cloud-config.
In absence of a user or cloud locale setting provided at boot via the IMDS, cloud-init will automatically set its own default value[1]. This shouldn't be necessary, since cloud images should already have a preferred locale set. I haven't done a complete catalogue of cloud images to back up this claim, but in addition to being familiar with Ubuntu's builds I checked Centos stream and opensuse leap (15.5) cloud images, and both of these already had locales set.
Setting locale is fine to do at the user's request, but cloud-init today might override an image builder's defaults with its own default setting choice[1] - which might not be what the distro or image builder wanted. Cloud-init would be easier to document and maintain and be more performant (less code running by default) if this code path could be opted into via cloud-config (no default behavior) rather than forcing all cloud-init instances to use this module which is almost never necessary.
[1] How this happens varies by distro:
1) debian and rhel derivatives manually check locale and skip if already set
2) other distros regenerate locale by default
Contributor guide
Assessment
This issue has not been assessed yet.