From 5e86cd5768b5ac85a189d9df856ee7c0b0f65c7d Mon Sep 17 00:00:00 2001 From: zsdc Date: Tue, 10 Oct 2023 12:38:38 +0300 Subject: vyos_install: T5220: Copy the whole config folder during installation In case a user needs to add more material to the configuration (keys, scripts, etc.) we need to be sure that this material will be copied to a persistent storage during installation. This commit replaces copying of only a `config.boot` file to copying the whole `config` folder, which should satisfy all types of configurations. --- cloudinit/config/cc_vyos_install.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloudinit/config/cc_vyos_install.py b/cloudinit/config/cc_vyos_install.py index 4e40b2d9..b41403c3 100644 --- a/cloudinit/config/cc_vyos_install.py +++ b/cloudinit/config/cc_vyos_install.py @@ -340,13 +340,13 @@ def handle(name: str, cfg: dict, cloud: Cloud, _: Logger, args: list) -> None: f'partiton {install_target}{part_prefix}2 mouted to {DIR_DST_ROOT}/boot/efi' ) + # copy config # a config dir. It is the deepest one, so the comand will # create all the rest in a single step - target_config_dir: str = f'{DIR_DST_ROOT}/boot/{image_name}/rw/opt/vyatta/etc/config/' + target_config_dir: str = f'{DIR_DST_ROOT}/boot/{image_name}/rw/opt/vyatta/etc/' Path(target_config_dir).mkdir(parents=True) - # copy config - copy('/opt/vyatta/etc/config/config.boot', target_config_dir) - Path(f'{target_config_dir}/.vyatta_config').touch() + # we must use Linux cp command, because Python cannot preserve ownership + run(['cp', '-pr', '/opt/vyatta/etc/config', target_config_dir]) LOG.info('configuration copied from running system') # create a persistence.conf -- cgit v1.2.3