Skip to content

Commit

Permalink
installer: T7102: download upgrade images to a random path in the roo…
Browse files Browse the repository at this point in the history
…t filesystem
  • Loading branch information
dmbaturin committed Feb 3, 2025
1 parent 6912eb2 commit d7b09bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/op_mode/image_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
DIR_DST_ROOT: str = f'{DIR_INSTALLATION}/disk_dst'
DIR_KERNEL_SRC: str = '/boot/'
FILE_ROOTFS_SRC: str = '/usr/lib/live/mount/medium/live/filesystem.squashfs'
ISO_DOWNLOAD_PATH: str = '/tmp/vyos_installation.iso'
ISO_DOWNLOAD_PATH: str = ''

external_download_script = '/usr/libexec/vyos/simple-download.py'
external_latest_image_url_script = '/usr/libexec/vyos/latest-image-url.py'
Expand Down Expand Up @@ -552,6 +552,11 @@ def image_fetch(image_path: str, vrf: str = None,
Returns:
Path: a path to a local file
"""
import os.path
from uuid import uuid4

global ISO_DOWNLOAD_PATH

# Latest version gets url from configured "system update-check url"
if image_path == 'latest':
command = external_latest_image_url_script
Expand All @@ -568,6 +573,7 @@ def image_fetch(image_path: str, vrf: str = None,
# check a type of path
if urlparse(image_path).scheme:
# download an image
ISO_DOWNLOAD_PATH = os.path.join(os.path.expanduser("~"), '{0}.iso'.format(uuid4()))
download_file(ISO_DOWNLOAD_PATH, image_path, vrf,
username, password,
progressbar=True, check_space=True)
Expand Down

0 comments on commit d7b09bb

Please sign in to comment.