Set locale for python apt (#79546)

* set locale to get_best_parsable_locale for the python-apt API

* add a test case

* add changelog

* remove test that tests nothing
pull/79566/head
Sloane Hertel 2 years ago committed by GitHub
parent 527abba860
commit 11e43e9d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- apt - set locale to fix updating the cache (https://github.com/ansible/ansible/issues/79523).

@ -354,6 +354,7 @@ warnings.filterwarnings('ignore', "apt API not stable yet", FutureWarning)
import datetime
import fnmatch
import itertools
import locale as locale_module
import os
import random
import re
@ -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',

Loading…
Cancel
Save