Fixes missing dir on system_setup integration test

By providing alternative directories to find LC_* locale definitions.
This commit is contained in:
Carlos Nihelton 2022-02-16 22:59:05 -03:00
parent 4914e537ae
commit a7fd83a384
No known key found for this signature in database
GPG Key ID: 6FE346D245197E9A
1 changed files with 8 additions and 2 deletions

View File

@ -58,8 +58,14 @@ class ConfigureController(SubiquityController):
cmdFile = os.path.join(self.model.root, cmd)
shutil.copy(os.path.join("/", cmd), cmdFile)
# Supply LC_* definition files to avoid complains from localedef.
shutil.copytree("/usr/lib/locale/C.UTF-8/", outDir,
dirs_exist_ok=True)
candidateSourceDirs = ["/usr/lib/locale/C.UTF-8/",
"/usr/lib/locale/C.utf8/"]
sourceDirs = [d for d in candidateSourceDirs if os.path.exists(d)]
if len(sourceDirs) == 0 or sourceDirs is None:
log.error("No available LC_* definitions found in this system")
return ("", False)
shutil.copytree(sourceDirs[0], outDir, dirs_exist_ok=True)
try:
# Altering locale-gen script to output to the desired folder.
with open(cmdFile, "r+") as f: