mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Minor optimizations to logic
This commit is contained in:
1 parent
99e3529c93
commit
afeb6a3196
3 files changed
+29
-18
No files matched your search
@@ -289,7 +289,7 @@ def _export_local_image(image, zstream):
|
||||
# Some modules don't have images
|
||||
continue
|
||||
|
||||
directory = os.path.split(images_directory)[-1:][0]
|
||||
directory = os.path.basename(images_directory)
|
||||
if os.path.exists(image):
|
||||
path = image
|
||||
else:
|
||||
@@ -309,7 +309,7 @@ async def _export_remote_images(project, compute_id, image_type, image, project_
|
||||
|
||||
log.debug(f"Downloading image '{image}' from compute '{compute_id}'")
|
||||
try:
|
||||
compute = [compute for compute in project.computes if compute.id == compute_id][0]
|
||||
compute = next(c for c in project.computes if c.id == compute_id)
|
||||
except IndexError:
|
||||
raise ControllerNotFoundError(f"Cannot export image from '{compute_id}' compute. Compute doesn't exist.")
|
||||
|
||||
|
||||
Reference in new issue
Block a user