I think the client machine should address this bug. A hint to resolve it could be: sudo locale-gen en_US.UTF-8 sudo update-locale LANG=C.UTF-8
Landscape Client could also try to prevent future failures when detected by applying the solution proposed above:
@@ -3,6 +3,7 @@ except ImportError: import urllib.parse as urlparse
+import subprocess import locale import logging import time @@ -943,7 +944,12 @@ def main(args): # Force UTF-8 encoding only for the reporter, thus allowing libapt-pkg to # return unmangled descriptions. - locale.setlocale(locale.LC_CTYPE, ("C", "UTF-8")) + try: + locale.setlocale(locale.LC_CTYPE, ("C", "UTF-8")) + except locale.Error: + subprocess.run(["sudo", "locale-gen", "en_US.UTF-8"], check=True) + subprocess.run(["sudo", "update-locale", "LANG=C.UTF-8"], check=True) + raise
if "FAKE_GLOBAL_PACKAGE_STORE" in os.environ: return run_task_handler(FakeGlobalReporter, args)
There is a PR with this proposed solution at: https://github.com/CanonicalLtd/landscape-client/pull/161
I think the client machine should address this bug. A hint to resolve it could be:
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=C.UTF-8
Landscape Client could also try to prevent future failures when detected by applying the solution proposed above:
@@ -3,6 +3,7 @@
except ImportError:
import urllib.parse as urlparse
+import subprocess setlocale( locale. LC_CTYPE, ("C", "UTF-8")) setlocale( locale. LC_CTYPE, ("C", "UTF-8")) run(["sudo" , "locale-gen", "en_US.UTF-8"], check=True) run(["sudo" , "update-locale", "LANG=C.UTF-8"], check=True)
import locale
import logging
import time
@@ -943,7 +944,12 @@
def main(args):
# Force UTF-8 encoding only for the reporter, thus allowing libapt-pkg to
# return unmangled descriptions.
- locale.
+ try:
+ locale.
+ except locale.Error:
+ subprocess.
+ subprocess.
+ raise
if "FAKE_GLOBAL_ PACKAGE_ STORE" in os.environ: handler( FakeGlobalRepor ter, args)
return run_task_
There is a PR with this proposed solution at: /github. com/CanonicalLt d/landscape- client/ pull/161
https:/