Fix for issue#199. Also removed check for daynaport in attach_image() since that branch will never be reached in the current webui implementation. (#206)

This commit is contained in:
Daniel Markstedt 2021-08-23 01:30:14 -07:00 committed by GitHub
parent 66342dc18a
commit 795286f4c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -64,14 +64,12 @@ def get_type(scsi_id):
return list_devices()[int(scsi_id)]["type"]
def attach_image(scsi_id, image, device_type):
if device_type == "SCCD" and get_type(scsi_id) == "SCCD":
def attach_image(scsi_id, image, image_type):
if image_type == "SCCD" and get_type(scsi_id) == "SCCD":
return insert(scsi_id, image)
elif device_type == "SCDP":
attach_daynaport(scsi_id)
else:
return subprocess.run(
["rasctl", "-c", "attach", "-t", device_type, "-i", scsi_id, "-f", image],
["rasctl", "-c", "attach", "-t", image_type, "-i", scsi_id, "-f", image],
capture_output=True,
)

View File

@ -137,9 +137,9 @@ def attach():
print("valid_file_types: ", valid_file_types)
if re.match(valid_file_types, file_name):
if file_name.lower().endswith((".iso", ".cdr", ".toast", ".img")):
image_type = "cd"
image_type = "SCCD"
else:
image_type = "hd"
image_type = "SCHD"
else:
flash(f"Unknown file type. Valid files are: {', '.join(valid_file_suffix)}", "error")
return redirect(url_for("index"))