From 1d7c13b3a4c52278641bd8d20017bef12130fab5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 29 Jun 2021 17:40:42 +0200 Subject: add autoinstall role for ubuntu/installer --- .../ubuntu/autoinstall/files/early-command.py | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 roles/installer/ubuntu/autoinstall/files/early-command.py (limited to 'roles/installer/ubuntu/autoinstall/files') diff --git a/roles/installer/ubuntu/autoinstall/files/early-command.py b/roles/installer/ubuntu/autoinstall/files/early-command.py new file mode 100644 index 00000000..93d72b2d --- /dev/null +++ b/roles/installer/ubuntu/autoinstall/files/early-command.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +import os +from shutil import copyfile +import yaml + +os.umask(0o077) +copyfile('/autoinstall.yaml', '/autoinstall.yaml_before-early-command') + +config = {} +with open('/autoinstall.yaml', 'r') as file: + config = yaml.safe_load(file) + +try: + for c in config['storage']['config']: + if 'type' not in c or c['type'] != 'disk' or 'path' not in c: + continue + + c['path'] = os.path.realpath(c['path']) + + with open('/autoinstall.yaml', 'w') as file: + yaml.dump(config, file, default_flow_style=False) + +except KeyError: + pass -- cgit v1.2.3