diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-06-29 17:40:42 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-06-29 17:40:42 +0200 |
commit | 1d7c13b3a4c52278641bd8d20017bef12130fab5 (patch) | |
tree | 5f9957dba6f542d259167ef3003668936869336c /roles/installer/ubuntu/autoinstall/files/early-command.py | |
parent | add ubuntu insaller fetch and base (diff) |
add autoinstall role for ubuntu/installer
Diffstat (limited to 'roles/installer/ubuntu/autoinstall/files/early-command.py')
-rw-r--r-- | roles/installer/ubuntu/autoinstall/files/early-command.py | 25 |
1 files changed, 25 insertions, 0 deletions
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 |