Merge pull request #646 from mwhudson/ai-fs-config
a few autoinstall fixes
This commit is contained in:
commit
9e602a0e90
|
@ -83,12 +83,15 @@ class FilesystemController(SubiquityController):
|
|||
|
||||
def load_autoinstall_data(self, data):
|
||||
log.debug("load_autoinstall_data %s", data)
|
||||
if not self.interactive() and data is None:
|
||||
data = {
|
||||
'layout': {
|
||||
'name': 'lvm',
|
||||
},
|
||||
}
|
||||
if data is None:
|
||||
if not self.interactive():
|
||||
data = {
|
||||
'layout': {
|
||||
'name': 'lvm',
|
||||
},
|
||||
}
|
||||
else:
|
||||
data = {}
|
||||
log.debug("self.ai_data = %s", data)
|
||||
self.ai_data = data
|
||||
|
||||
|
@ -154,6 +157,10 @@ class FilesystemController(SubiquityController):
|
|||
disks = self.model.all_disks()
|
||||
disks.sort(key=lambda x: x.size)
|
||||
meth(disks[-1])
|
||||
elif 'config' in self.ai_data:
|
||||
with self.context.child("applying_autoinstall"):
|
||||
# needs to account for grub and swap data too.
|
||||
self.model.apply_autoinstall_config(self.ai_data['config'])
|
||||
|
||||
def start(self):
|
||||
self._start_task = schedule_task(self._start())
|
||||
|
@ -661,7 +668,7 @@ class FilesystemController(SubiquityController):
|
|||
}
|
||||
self.partition_disk_handler(disk, None, result)
|
||||
|
||||
def guided_lvm(self, disk, lvm_options):
|
||||
def guided_lvm(self, disk, lvm_options=None):
|
||||
self.reformat(disk)
|
||||
if DeviceAction.MAKE_BOOT in disk.supported_actions:
|
||||
self.make_boot_disk(disk)
|
||||
|
@ -677,7 +684,7 @@ class FilesystemController(SubiquityController):
|
|||
fstype=None,
|
||||
))
|
||||
spec = dict(name="ubuntu-vg", devices=set([part]))
|
||||
if lvm_options['encrypt']:
|
||||
if lvm_options and lvm_options['encrypt']:
|
||||
spec['password'] = lvm_options['luks_options']['password']
|
||||
# create volume group on partition
|
||||
vg = self.create_volgroup(spec)
|
||||
|
|
|
@ -43,9 +43,9 @@ class SSHController(SubiquityController):
|
|||
if data is None:
|
||||
return
|
||||
self.model.install_server = data.get('install_server', False)
|
||||
self.model.authorized_keys = self.autoinstall_data.get(
|
||||
self.model.authorized_keys = data.get(
|
||||
'authorized-keys', [])
|
||||
self.model.pwauth = self.autoinstall_data.get(
|
||||
self.model.pwauth = data.get(
|
||||
'allow-pw', not self.model.authorized_keys)
|
||||
|
||||
def start_ui(self):
|
||||
|
|
|
@ -1257,7 +1257,11 @@ class FilesystemModel(object):
|
|||
self._actions = []
|
||||
self.grub_install_device = None
|
||||
|
||||
def _actions_from_config(self, config, blockdevs):
|
||||
def apply_autoinstall_config(self, ai_config):
|
||||
self._actions = self._actions_from_config(
|
||||
ai_config, self._probe_data['blockdev'], is_autoinstall=True)
|
||||
|
||||
def _actions_from_config(self, config, blockdevs, is_autoinstall=False):
|
||||
"""Convert curtin storage config into action instances.
|
||||
|
||||
curtin represents storage "actions" as defined in
|
||||
|
@ -1284,7 +1288,7 @@ class FilesystemModel(object):
|
|||
exclusions = set()
|
||||
seen_multipaths = set()
|
||||
for action in config:
|
||||
if action['type'] == 'mount':
|
||||
if not is_autoinstall and action['type'] == 'mount':
|
||||
exclusions.add(byid[action['device']])
|
||||
continue
|
||||
c = _type_to_cls.get(action['type'], None)
|
||||
|
@ -1313,7 +1317,8 @@ class FilesystemModel(object):
|
|||
if kw['type'] == 'disk':
|
||||
path = kw['path']
|
||||
kw['info'] = StorageInfo({path: blockdevs[path]})
|
||||
kw['preserve'] = True
|
||||
if not is_autoinstall:
|
||||
kw['preserve'] = True
|
||||
obj = byid[action['id']] = c(m=self, **kw)
|
||||
multipath = kw.get('multipath')
|
||||
if multipath:
|
||||
|
|
Loading…
Reference in New Issue