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

Set locale for python apt #79546

Merged
merged 4 commits into from Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/79546-apt-fix-setting-locale.yml
@@ -0,0 +1,2 @@
bugfixes:
- apt - set locale to fix updating the cache (https://github.com/ansible/ansible/issues/79523).
2 changes: 2 additions & 0 deletions lib/ansible/modules/apt.py
Expand Up @@ -354,6 +354,7 @@
import datetime
import fnmatch
import itertools
import locale as locale_module
import os
import random
import re
Expand Down Expand Up @@ -1218,6 +1219,7 @@ def main():
# to make sure we use the best parsable locale when running commands
# also set apt specific vars for desired behaviour
locale = get_best_parsable_locale(module)
locale_module.setlocale(locale_module.LC_ALL, locale)
# APT related constants
APT_ENV_VARS = dict(
DEBIAN_FRONTEND='noninteractive',
Expand Down