WSL Locale controller is not needed anymore.
- With 'prefill' working, calling Powershell to find Windows locale is not required anymore. - Since `f21986be` subiquity's default locale controller respects mode.selected_language initialization.
This commit is contained in:
parent
168a5c13a0
commit
2125acffe6
|
@ -36,31 +36,6 @@ def is_reconfigure(is_dryrun):
|
|||
return not is_dryrun and if_normaluser
|
||||
|
||||
|
||||
def get_windows_locale():
|
||||
windows_locale_failed_msg = (
|
||||
"Cannot determine Windows locale, fallback to default."
|
||||
" Reason of failure: "
|
||||
)
|
||||
|
||||
try:
|
||||
process = subprocess.run(["powershell.exe", "-NonInteractive",
|
||||
"-NoProfile", "-Command",
|
||||
"(Get-Culture).Name"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
if process.returncode:
|
||||
log.info(windows_locale_failed_msg +
|
||||
process.stderr.decode("utf-8"))
|
||||
return None
|
||||
|
||||
tmp_code = process.stdout.rstrip().decode("utf-8")
|
||||
tmp_code = tmp_code.replace("-", "_")
|
||||
return tmp_code
|
||||
except OSError as e:
|
||||
log.info(windows_locale_failed_msg + e.strerror)
|
||||
return None
|
||||
|
||||
|
||||
def convert_if_bool(value):
|
||||
if value.lower() in ('true', 'false'):
|
||||
return value.lower() == 'true'
|
||||
|
|
|
@ -20,8 +20,8 @@ from subiquity.server.controllers.cmdlist import (
|
|||
)
|
||||
from subiquity.server.controllers.reporting import ReportingController
|
||||
from subiquity.server.controllers.userdata import UserdataController
|
||||
from subiquity.server.controllers.locale import LocaleController
|
||||
from .identity import WSLIdentityController
|
||||
from .locale import WSLLocaleController
|
||||
from .wslconfbase import WSLConfigurationBaseController
|
||||
from .wslconfadvanced import WSLConfigurationAdvancedController
|
||||
from .configure import ConfigureController
|
||||
|
@ -32,7 +32,7 @@ __all__ = [
|
|||
'ErrorController',
|
||||
'WSLIdentityController',
|
||||
'LateController',
|
||||
'WSLLocaleController',
|
||||
'LocaleController',
|
||||
'ReportingController',
|
||||
'SetupShutdownController',
|
||||
'UserdataController',
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
# Copyright 2021 Canonical, Ltd.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
from system_setup.common.wsl_utils import get_windows_locale
|
||||
from subiquity.server.controllers.locale import LocaleController
|
||||
|
||||
|
||||
class WSLLocaleController(LocaleController):
|
||||
|
||||
def start(self):
|
||||
win_lang = get_windows_locale()
|
||||
self.model.selected_language = os.environ.get("LANG") \
|
||||
or self.autoinstall_default
|
||||
if win_lang:
|
||||
self.model.selected_language = win_lang + ".UTF-8"
|
||||
self.app.aio_loop.create_task(self.configured())
|
|
@ -45,7 +45,7 @@ class SystemSetupServer(SubiquityServer):
|
|||
"Early",
|
||||
"Reporting",
|
||||
"Error",
|
||||
"WSLLocale",
|
||||
"Locale",
|
||||
"WSLIdentity",
|
||||
"WSLConfigurationBase",
|
||||
"WSLConfigurationAdvanced",
|
||||
|
|
Loading…
Reference in New Issue