Skip to content

Commit

Permalink
locale_gen: fix: use glibc_ubuntu mode only if files for that exists
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Shalygin <k0ste@k0ste.ru>
  • Loading branch information
k0ste committed Feb 12, 2025
1 parent ffae71a commit f222ea2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/modules/locale_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@
description: Mechanism used to deploy the locales.
type: str
choices:
- glibc
- ubuntu_glibc
- ubuntu_legacy
- glibc
returned: success
sample: glibc
version_added: 10.2.0
Expand Down Expand Up @@ -119,13 +120,20 @@ def __init_module__(self):
available=SUPPORTED_LOCALES,
apply_change=self.apply_change_ubuntu_legacy,
),
glibc=dict(
ubuntu_glibc=dict(
available=SUPPORTED_LOCALES,
apply_change=self.apply_change_glibc,
),
glibc=dict(
available=ETC_LOCALE_GEN,
apply_change=self.apply_change_glibc,
),
)

if os.path.exists(ETC_LOCALE_GEN):
if os.path.exists(ETC_LOCALE_GEN) and os.path.exists(SUPPORTED_LOCALES):
self.vars.ubuntu_mode = False
self.vars.mechanism = "ubuntu_glibc"
elif os.path.exists(ETC_LOCALE_GEN) and not os.path.exists(SUPPORTED_LOCALES):
self.vars.ubuntu_mode = False
self.vars.mechanism = "glibc"
elif os.path.exists(VAR_LIB_LOCALES):
Expand Down

0 comments on commit f222ea2

Please sign in to comment.