summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-06 10:56:17 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:11 -0600
commite2a7c953be727ca8578511c39212fa4c73222a0c (patch)
tree8e8e70864a666a39ecd3091862657e6550a4a2b0 /python
parentfca9620ee221576c980cea238aadbe26a551ac30 (diff)
downloadvyos-1x-e2a7c953be727ca8578511c39212fa4c73222a0c.tar.gz
vyos-1x-e2a7c953be727ca8578511c39212fa4c73222a0c.zip
image-tools: T5758: restore saving previous data on install
Restore scanning previous installations for config data and ssh host keys on install. (cherry picked from commit 32551842bb0f710f590e8c030395a3a7902aa1df)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/system/disk.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/vyos/system/disk.py b/python/vyos/system/disk.py
index 49e6b5c5e..f8e0fd1bf 100644
--- a/python/vyos/system/disk.py
+++ b/python/vyos/system/disk.py
@@ -150,7 +150,7 @@ def filesystem_create(partition: str, fstype: str) -> None:
def partition_mount(partition: str,
path: str,
fsype: str = '',
- overlay_params: dict[str, str] = {}) -> None:
+ overlay_params: dict[str, str] = {}) -> bool:
"""Mount a partition into a path
Args:
@@ -159,6 +159,9 @@ def partition_mount(partition: str,
fsype (str): optionally, set fstype ('squashfs', 'overlay', 'iso9660')
overlay_params (dict): optionally, set overlay parameters.
Defaults to None.
+
+ Returns:
+ bool: True on success
"""
if fsype in ['squashfs', 'iso9660']:
command: str = f'mount -o loop,ro -t {fsype} {partition} {path}'
@@ -171,7 +174,11 @@ def partition_mount(partition: str,
else:
command = f'mount {partition} {path}'
- run(command)
+ rc = run(command)
+ if rc == 0:
+ return True
+
+ return False
def partition_umount(partition: str = '', path: str = '') -> None: