Skip to content

Commit

Permalink
Create images directory for openstack image download if it doesn't ex…
Browse files Browse the repository at this point in the history
…ists

Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
  • Loading branch information
Frawless committed May 20, 2024
1 parent c809a37 commit 881eb00
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions osia/installer/downloader/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,13 @@ def download_image(image_url: str, image_file: str):
"""Main entrypoint for image download, function
extracts url to rhcos image, downloads and extracts it
to specified target"""
directory = Path(image_file).parent
# Check if the directory exists
if not directory.exists():
# If the directory does not exist, create it
directory.mkdir(parents=True)
logging.debug("Creating %s directory for download images", directory)
else:
logging.debug("Directory %s for images already exists", directory)
res_file = get_data(image_url, image_file, _extract_gzip)
return res_file

0 comments on commit 881eb00

Please sign in to comment.