Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion salt/modules/localemod.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ def set_locale(locale):
salt '*' locale.set_locale 'en_US.UTF-8'
"""
lc_ctl = salt.utils.systemd.booted(__context__)
# localectl on SLE12 is installed but the integration is broken -- config is rewritten by YaST2
if lc_ctl and not (
# localectl on SLE12 is installed but the integration is broken -- config is rewritten by YaST2
__grains__["os_family"] in ["Suse"] and __grains__["osmajorrelease"] in [12]
# starting from Debian 13, update-locale must be used instead of localectl set-locale
or __grains__["os_family"] in ["Debian"] and __grains__["osmajorrelease"] >= 13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be done conditionally for versions >= 13. I think update-locale can just be used for all versions of Debian.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked until debian 13. I guess we should not try to fix something that is not broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but it adds more special cases and makes code harder to follow and maintain. According to all the research I have done, the way to set the default locale non-interactively on Debian is to use update-locale on all versions. I could not find any documentation on the Debian wikis, man pages, etc prescribing the use of localctl set-locale.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a test we can know for sure.

):
return _localectl_set(locale)

Expand Down