Style improvements.

This commit is contained in:
Carlos Nihelton 2021-11-09 09:36:10 -03:00
parent f9d3877feb
commit 4e050ecddb
1 changed files with 12 additions and 10 deletions

View File

@ -88,13 +88,15 @@ class ConfigureController(SubiquityController):
def __update_locale_cmd(self, lang) -> List[str]: def __update_locale_cmd(self, lang) -> List[str]:
""" Adds mocking cli to update-locale if in dry-run. """ """ Adds mocking cli to update-locale if in dry-run. """
updateLocCmd = ["update-locale", "LANG={}".format(lang)] updateLocCmd = ["update-locale", "LANG={}".format(lang)]
if self.app.opts.dry_run: if not self.app.opts.dry_run:
defaultLocDir = os.path.join(self.model.root, return updateLocCmd
"etc/default/")
os.makedirs(defaultLocDir, exist_ok=True) defaultLocDir = os.path.join(self.model.root,
updateLocCmd += ["--locale-file", "etc/default/")
os.path.join(defaultLocDir, "locale"), os.makedirs(defaultLocDir, exist_ok=True)
"--no-checks"] updateLocCmd += ["--locale-file",
os.path.join(defaultLocDir, "locale"),
"--no-checks"]
return updateLocCmd return updateLocCmd
@ -102,7 +104,7 @@ class ConfigureController(SubiquityController):
""" Last commands to run for locale support. Returns True on success""" """ Last commands to run for locale support. Returns True on success"""
(locGenCmd, ok) = self.__locale_gen_cmd() (locGenCmd, ok) = self.__locale_gen_cmd()
if ok is False: if not ok:
log.error("Locale generation failed.") log.error("Locale generation failed.")
return False return False
@ -216,12 +218,12 @@ class ConfigureController(SubiquityController):
ok = await self._install_check_lang_support_packages(lang, env) ok = await self._install_check_lang_support_packages(lang, env)
if ok is False: if not ok:
log.error("Failed to install recommended language packs.") log.error("Failed to install recommended language packs.")
return return
ok = await self._activate_locale(lang, env) ok = await self._activate_locale(lang, env)
if ok is False: if not ok:
log.error("Failed to run locale activation commands.") log.error("Failed to run locale activation commands.")
return return