Merge pull request #81 from CanonicalLtd/drop_jinja2_use
Drop jinja2 use
This commit is contained in:
commit
d2f65e72b3
2
Makefile
2
Makefile
|
@ -37,7 +37,7 @@ install_deps_amd64:
|
||||||
sudo apt-get install grub-efi-amd64-signed
|
sudo apt-get install grub-efi-amd64-signed
|
||||||
|
|
||||||
install_deps: install_deps_$(ARCH)
|
install_deps: install_deps_$(ARCH)
|
||||||
sudo apt-get install python3-urwid python3-pyudev python3-netifaces python3-nose python3-flake8 python3-yaml git bzr ubuntu-cloudimage-keyring python3-jinja2 python3-coverage ovmf shim shim-signed
|
sudo apt-get install python3-urwid python3-pyudev python3-netifaces python3-nose python3-flake8 python3-yaml git bzr ubuntu-cloudimage-keyring python3-coverage ovmf shim shim-signed
|
||||||
|
|
||||||
dryrun: probert
|
dryrun: probert
|
||||||
$(MAKE) ui-view DRYRUN="--dry-run --uefi"
|
$(MAKE) ui-view DRYRUN="--dry-run --uefi"
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import jinja2
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -62,52 +61,6 @@ network:
|
||||||
version: 1
|
version: 1
|
||||||
config:
|
config:
|
||||||
"""
|
"""
|
||||||
CURTIN_STORAGE_CONFIG_TEMPLATE = """
|
|
||||||
# Autogenerated by SUbiquity: {{DATE}} UTC
|
|
||||||
reporter:
|
|
||||||
subiquity:
|
|
||||||
path: /tmp/curtin_progress_subiquity
|
|
||||||
progress: True
|
|
||||||
|
|
||||||
partitioning_commands:
|
|
||||||
builtin: curtin block-meta custom
|
|
||||||
|
|
||||||
storage:
|
|
||||||
version: 1
|
|
||||||
config:
|
|
||||||
- id: {{TARGET_DISK_NAME}}
|
|
||||||
type: disk
|
|
||||||
ptable: msdos
|
|
||||||
model: {{TARGET_DISK_MODEL}}
|
|
||||||
serial: {{TARGET_DISK_SERIAL}}
|
|
||||||
- id: {{TARGET_DISK_NAME}}1
|
|
||||||
type: partition
|
|
||||||
offset: 512MB
|
|
||||||
size: 8GB
|
|
||||||
device: {{TARGET_DISK_NAME}}
|
|
||||||
flag: boot
|
|
||||||
- id: {{TARGET_DISK_NAME}}2
|
|
||||||
type: partition
|
|
||||||
offset: 8512MB
|
|
||||||
size: 1GB
|
|
||||||
device: {{TARGET_DISK_NAME}}
|
|
||||||
- id: {{TARGET_DISK_NAME}}1_root
|
|
||||||
type: format
|
|
||||||
fstype: ext4
|
|
||||||
volume: {{TARGET_DISK_NAME}}1
|
|
||||||
- id: {{TARGET_DISK_NAME}}2_home
|
|
||||||
type: format
|
|
||||||
fstype: ext4
|
|
||||||
volume: {{TARGET_DISK_NAME}}2
|
|
||||||
- id: {{TARGET_DISK_NAME}}1_mount
|
|
||||||
type: mount
|
|
||||||
path: /
|
|
||||||
device: {{TARGET_DISK_NAME}}1_root
|
|
||||||
- id: {{TARGET_DISK_NAME}}2_mount
|
|
||||||
type: mount
|
|
||||||
path: /home
|
|
||||||
device: {{TARGET_DISK_NAME}}2_home
|
|
||||||
"""
|
|
||||||
|
|
||||||
# TODO, this should be moved to the in-target cloud-config seed so on first boot
|
# TODO, this should be moved to the in-target cloud-config seed so on first boot
|
||||||
# of the target, it reconfigures datasource_list to none for subsequent boots
|
# of the target, it reconfigures datasource_list to none for subsequent boots
|
||||||
|
@ -166,30 +119,6 @@ def curtin_write_network_actions(actions):
|
||||||
conf.close()
|
conf.close()
|
||||||
|
|
||||||
|
|
||||||
def curtin_write_storage_template(disk_name, disk_model, disk_serial):
|
|
||||||
''' write out the storage yaml template for curtin
|
|
||||||
params:
|
|
||||||
disk_name: kernel name of disk (/dev/sda)
|
|
||||||
disk_model: disk model name
|
|
||||||
disk_serial: serial of disk from probert storage output
|
|
||||||
'''
|
|
||||||
template = jinja2.Template(CURTIN_STORAGE_CONFIG_TEMPLATE,
|
|
||||||
undefined=jinja2.StrictUndefined)
|
|
||||||
|
|
||||||
ctxt = {
|
|
||||||
'DATE': str(datetime.datetime.utcnow()),
|
|
||||||
'TARGET_DISK_NAME': os.path.basename(disk_name),
|
|
||||||
'TARGET_DISK_MODEL': disk_model,
|
|
||||||
'TARGET_DISK_SERIAL': disk_serial,
|
|
||||||
}
|
|
||||||
curtin_config = template.render(ctxt)
|
|
||||||
with open(CURTIN_STORAGE_CONFIG_FILE, 'w') as conf:
|
|
||||||
conf.write(curtin_config)
|
|
||||||
conf.close()
|
|
||||||
|
|
||||||
return CURTIN_STORAGE_CONFIG_FILE
|
|
||||||
|
|
||||||
|
|
||||||
def curtin_write_preserved_actions(actions):
|
def curtin_write_preserved_actions(actions):
|
||||||
''' caller must use models.actions.preserve_action on
|
''' caller must use models.actions.preserve_action on
|
||||||
all elements of the actions'''
|
all elements of the actions'''
|
||||||
|
|
Loading…
Reference in New Issue