parent
4c0ad44738
commit
af91bb0a6f
|
@ -18,7 +18,6 @@ import functools
|
|||
import logging
|
||||
|
||||
from subiquity.models.subiquity import SubiquityModel
|
||||
from subiquity.common.types import IdentityData
|
||||
from subiquity.models.locale import LocaleModel
|
||||
from subiquity.models.identity import IdentityModel
|
||||
from subiquity.server.types import InstallerChannels
|
||||
|
@ -48,7 +47,7 @@ class SystemSetupModel(SubiquityModel):
|
|||
target = '/'
|
||||
|
||||
def __init__(self, root, hub, install_model_names,
|
||||
postinstall_model_names, prefillInfo):
|
||||
postinstall_model_names):
|
||||
# Parent class init is not called to not load models we don't need.
|
||||
self.root = root
|
||||
if root != '/':
|
||||
|
@ -62,23 +61,6 @@ class SystemSetupModel(SubiquityModel):
|
|||
self.wslconfbase = WSLConfigurationBaseModel()
|
||||
self.wslconfadvanced = WSLConfigurationAdvancedModel()
|
||||
|
||||
if prefillInfo:
|
||||
welcome = prefillInfo.get('Welcome', {'lang': None})
|
||||
if welcome is not None and welcome.get('lang') is not None:
|
||||
self.locale.selected_language = welcome['lang']
|
||||
log.debug('Prefill Language: {}'
|
||||
.format(self.locale.selected_language))
|
||||
|
||||
identity = prefillInfo.get('WSLIdentity', None)
|
||||
if identity:
|
||||
idata = IdentityData()
|
||||
idata.realname = identity.get('realname', '')
|
||||
idata.username = identity.get('username', '')
|
||||
idata.hostname = ''
|
||||
idata.crypted_password = ''
|
||||
self.identity.add_user(idata)
|
||||
log.debug('Prefill Identity: {}'.format(self.identity.user))
|
||||
|
||||
self._confirmation = asyncio.Event()
|
||||
self._confirmation_task = None
|
||||
|
||||
|
|
|
@ -77,19 +77,10 @@ class SystemSetupServer(SubiquityServer):
|
|||
|
||||
def make_model(self):
|
||||
root = '/'
|
||||
prefillInfo = None
|
||||
if self.opts.dry_run:
|
||||
root = os.path.abspath('.subiquity')
|
||||
if self.opts.prefill:
|
||||
with open(self.opts.prefill, 'r') as stream:
|
||||
try:
|
||||
prefillInfo = yaml.safe_load(stream)
|
||||
except yaml.YAMLError as exc:
|
||||
log.error('Exception while parsing prefill file: {}.'
|
||||
' Ignoring file.'.format(exc))
|
||||
prefillInfo = None
|
||||
return SystemSetupModel(root, self.hub, INSTALL_MODEL_NAMES,
|
||||
POSTINSTALL_MODEL_NAMES, prefillInfo)
|
||||
POSTINSTALL_MODEL_NAMES)
|
||||
|
||||
# We don’t have cloudinit in system_setup.
|
||||
async def wait_for_cloudinit(self):
|
||||
|
|
Loading…
Reference in New Issue