system setup: reduce WSLConfigurationAdvanced size

by inheriting WSLConfigurationBase
This commit is contained in:
Patrick Wu 2021-09-02 19:43:11 +08:00 committed by Dan Bungert
parent 9c47505ae0
commit 43497a99cb
2 changed files with 4 additions and 12 deletions

View File

@ -346,7 +346,7 @@ class WSLConfigurationBase:
@attr.s(auto_attribs=True)
class WSLConfigurationAdvanced:
class WSLConfigurationAdvanced(WSLConfigurationBase):
gui_theme: str = attr.ib(default='default')
gui_followwintheme: bool = attr.ib(default=True)
legacy_gui: bool = attr.ib(default=False)
@ -355,10 +355,5 @@ class WSLConfigurationAdvanced:
wsl_motd_news: bool = attr.ib(default=True)
automount: bool = attr.ib(default=True)
mountfstab: bool = attr.ib(default=True)
# TODO WSL: remove all duplications from WSLConfigurationBase
custom_path: str = attr.ib(default='/mnt/')
custom_mount_opt: str = ''
gen_host: bool = attr.ib(default=True)
gen_resolvconf: bool = attr.ib(default=True)
interop_enabled: bool = attr.ib(default=True)
interop_appendwindowspath: bool = attr.ib(default=True)

View File

@ -18,6 +18,7 @@ import subprocess
import attr
from subiquitycore.utils import run_command
from .wslconfbase import WSLConfigurationBase
log = logging.getLogger('subiquity.models.wsl_configuration_advanced')
@ -25,7 +26,7 @@ log = logging.getLogger('subiquity.models.wsl_configuration_advanced')
@attr.s
class WSLConfigurationAdvanced(object):
class WSLConfigurationAdvanced(WSLConfigurationBase):
gui_theme = attr.ib()
gui_followwintheme = attr.ib()
legacy_gui = attr.ib()
@ -34,10 +35,6 @@ class WSLConfigurationAdvanced(object):
wsl_motd_news = attr.ib()
automount = attr.ib()
mountfstab = attr.ib()
custom_path = attr.ib()
custom_mount_opt = attr.ib()
gen_host = attr.ib()
gen_resolvconf = attr.ib()
interop_enabled = attr.ib()
interop_appendwindowspath = attr.ib()
@ -68,7 +65,7 @@ class WSLConfigurationAdvancedModel(object):
d['wsl_motd_news'] = result.wsl_motd_news
d['automount'] = result.automount
d['mountfstab'] = result.mountfstab
self._wslconfadvanced = WSLConfigurationAdvancedModel(**d)
self._wslconfadvanced = WSLConfigurationAdvanced(**d)
# TODO WSL: Drop all calls of ubuntuwsl here and ensure the data
# are passed to the app model
if not is_dry_run: