Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_region: format: en-150 = English (Europe) not accepted #438

Closed
nikiwaibel opened this issue Sep 15, 2022 · 0 comments · Fixed by nikiwaibel/community.windows#1 or #439
Closed

Comments

@nikiwaibel
Copy link
Contributor

SUMMARY

windows supports the regional format English (Europe), which equals to en-150 (sometimes also referenced as en-EU or en-Europe, but it seems windows uses en-150).

when used with win_region (format: en-150) the following error is thrown:

fatal: [XXX]: FAILED! => {"changed": false, "msg": "The argument format 'en-150' does not contain a valid Culture Name", "restart_required": false}

in fact, en-150 is a valid culture name.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_region

ANSIBLE VERSION
ansible [core 2.12.7]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/niki/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/niki/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.6 (main, Aug  2 2022, 00:00:00) [GCC 12.1.1 20220507 (Red Hat 12.1.1-1)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.windows 1.10.0
CONFIGURATION
OS / ENVIRONMENT

win10 and win11

STEPS TO REPRODUCE
  - name: Make sure region is set to location=Austria, format=en-Europe, language=en-US.
    win_region:
      location: 14   # Republic of Austria
      format: en-150
EXPECTED RESULTS

set the regional format to en-150, aka English (Europe).

ACTUAL RESULTS

not set. error thrown

fatal: [XXX]: FAILED! => {"changed": false, "msg": "The argument format 'en-150' does not contain a valid Culture Name", "restart_required": false}

FIX

replace InstalledWin32Cultures by AllCultures in plugins/modules/win_region.ps1

# diff -u  plugins/modules/win_region.ps1.orig plugins/modules/win_region.ps1
--- plugins/modules/win_region.ps1.orig	2022-09-15 15:29:27.404771813 +0200
+++ plugins/modules/win_region.ps1	2022-09-15 15:29:37.743664353 +0200
@@ -345,7 +345,7 @@
     $module.FailJson("An argument for 'format', 'location' or 'unicode_language' needs to be supplied")
 }
 else {
-    $valid_cultures = [System.Globalization.CultureInfo]::GetCultures('InstalledWin32Cultures')
+    $valid_cultures = [System.Globalization.CultureInfo]::GetCultures('AllCultures')
     $valid_geoids = Get-ValidGeoId -cultures $valid_cultures

     if ($null -ne $location) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant