From d37ba75525acf9b8b5aa625875d938b42990180e Mon Sep 17 00:00:00 2001 From: Konstantin Shalygin Date: Mon, 17 Feb 2025 16:48:45 +0300 Subject: [PATCH] tests: enable locale_gen not only for Debian Signed-off-by: Konstantin Shalygin --- ...gen-use_glibc_ubuntu_mode_only_if_file_exists.yml | 2 +- plugins/modules/locale_gen.py | 12 ++++++------ tests/integration/targets/locale_gen/tasks/main.yml | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/changelogs/fragments/9735-locale_gen-use_glibc_ubuntu_mode_only_if_file_exists.yml b/changelogs/fragments/9735-locale_gen-use_glibc_ubuntu_mode_only_if_file_exists.yml index eef68f474b1..9e17d38b2ef 100644 --- a/changelogs/fragments/9735-locale_gen-use_glibc_ubuntu_mode_only_if_file_exists.yml +++ b/changelogs/fragments/9735-locale_gen-use_glibc_ubuntu_mode_only_if_file_exists.yml @@ -1,2 +1,2 @@ bugfixes: - - "locale_gen - use ``glibc_ubuntu`` mode only if files for that exists (https://github.com/ansible-collections/community.general/pull/9735)." + - "locale_gen - use ``glibc`` mode only if files for that exists. In other case us ``other_glibc`` mode (https://github.com/ansible-collections/community.general/pull/9735)." diff --git a/plugins/modules/locale_gen.py b/plugins/modules/locale_gen.py index 0d7d58ec631..d832a2166f8 100644 --- a/plugins/modules/locale_gen.py +++ b/plugins/modules/locale_gen.py @@ -68,9 +68,9 @@ description: Mechanism used to deploy the locales. type: str choices: - - ubuntu_glibc - - ubuntu_legacy - glibc + - ubuntu_legacy + - other_glibc returned: success sample: glibc version_added: 10.2.0 @@ -120,11 +120,11 @@ def __init_module__(self): available=SUPPORTED_LOCALES, apply_change=self.apply_change_ubuntu_legacy, ), - ubuntu_glibc=dict( + glibc=dict( available=SUPPORTED_LOCALES, apply_change=self.apply_change_glibc, ), - glibc=dict( + other_glibc=dict( available=ETC_LOCALE_GEN, apply_change=self.apply_change_glibc, ), @@ -132,10 +132,10 @@ def __init_module__(self): if os.path.exists(ETC_LOCALE_GEN) and os.path.exists(SUPPORTED_LOCALES): self.vars.ubuntu_mode = False - self.vars.mechanism = "ubuntu_glibc" + self.vars.mechanism = "glibc" elif os.path.exists(ETC_LOCALE_GEN): self.vars.ubuntu_mode = False - self.vars.mechanism = "glibc" + self.vars.mechanism = "other_glibc" elif os.path.exists(VAR_LIB_LOCALES): self.vars.ubuntu_mode = True self.vars.mechanism = "ubuntu_legacy" diff --git a/tests/integration/targets/locale_gen/tasks/main.yml b/tests/integration/targets/locale_gen/tasks/main.yml index 358247c4ee3..b9f345ecc19 100644 --- a/tests/integration/targets/locale_gen/tasks/main.yml +++ b/tests/integration/targets/locale_gen/tasks/main.yml @@ -10,7 +10,8 @@ - name: Bail out if not supported ansible.builtin.meta: end_play - when: ansible_distribution not in ('Ubuntu', 'Debian') + when: + - "ansible_distribution == 'MacOSX'" - name: Run tests auto-detecting mechanism ansible.builtin.include_tasks: basic.yml