summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-10-10 12:38:38 +0300
committerzsdc <taras@vyos.io>2023-10-11 17:02:00 +0300
commit5e86cd5768b5ac85a189d9df856ee7c0b0f65c7d (patch)
tree1d37d131185f2cd1f3bf5b85ce69d4ae4e9e49af /cloudinit
parentdac6d08b6ba40f9b39622e00a32974532cf03de4 (diff)
downloadvyos-cloud-init-5e86cd5768b5ac85a189d9df856ee7c0b0f65c7d.tar.gz
vyos-cloud-init-5e86cd5768b5ac85a189d9df856ee7c0b0f65c7d.zip
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.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_vyos_install.py8
1 files 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