Skip to content

Commit

Permalink
Improve information provided when uploading invalid appliance image. F…
Browse files Browse the repository at this point in the history
…ixes #3637
  • Loading branch information
grossmj committed Sep 26, 2024
1 parent be2b5ee commit f21a530
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions gns3/dialogs/appliance_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,19 @@ def _importPushButtonClickedSlot(self, *args):
image = Image(self._appliance.template_type(), path, filename=disk["filename"])
try:
if "md5sum" in disk and image.md5sum != disk["md5sum"]:
reply = QtWidgets.QMessageBox.question(self, "Add appliance",
"This is not the correct file. The MD5 sum is {} and should be {}.\nDo you want to accept it at your own risks?".format(image.md5sum, disk["md5sum"]),
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
reply = QtWidgets.QMessageBox.question(
self,
"Add appliance",
"This is not the correct file.\n\n"
"MD5 checksum\n"
f"actual:\t{image.md5sum}\n"
f"expected:\t{disk["md5sum"]}\n\n"
"File size\n"
f"actual:\t{image.filesize} bytes\n"
f"expected:\t{disk["filesize"]} bytes\n\n"
"Do you want to accept it at your own risks?",
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
)
if reply == QtWidgets.QMessageBox.No:
return
except OSError as e:
Expand Down

1 comment on commit f21a530

@Raizo62
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

With Python 3.11.2 (Debian stable backport), I have this error message :

Traceback (most recent call last):
  File "/usr/bin/gns3", line 5, in <module>
    from gns3.main import main
  File "/usr/local/lib/python3.11/dist-packages/gns3/main.py", line 45, in <module>
    from gns3.main_window import MainWindow
  File "/usr/local/lib/python3.11/dist-packages/gns3/main_window.py", line 52, in <module>
    from .dialogs.appliance_wizard import ApplianceWizard
  File "/usr/local/lib/python3.11/dist-packages/gns3/dialogs/appliance_wizard.py", line 552
    f"expected:\t{disk["md5sum"]}\n\n"
                        ^^^^^^
SyntaxError: f-string: unmatched '['

Please sign in to comment.