Fix some minor issues
This commit is contained in:
@@ -132,7 +132,7 @@ class AntminerModern(BMMiner):
|
||||
|
||||
Args:
|
||||
file (Path): Path to the firmware file.
|
||||
keep_settings (bool): Whether to keep current settings after the upgrade. Defaults to True.
|
||||
keep_settings (bool): Whether to keep the current settings after the update.
|
||||
|
||||
Returns:
|
||||
str: Result of the upgrade process.
|
||||
@@ -145,9 +145,10 @@ class AntminerModern(BMMiner):
|
||||
|
||||
if 'Success' in result:
|
||||
logging.info("Firmware upgrade process completed successfully for Antminer.")
|
||||
return "Firmware upgrade completed successfully."
|
||||
else:
|
||||
logging.error(f"Firmware upgrade failed. Response: {result}")
|
||||
raise
|
||||
return f"Firmware upgrade failed. Response: {result}"
|
||||
except Exception as e:
|
||||
logging.error(f"An error occurred during the firmware upgrade process: {e}", exc_info=True)
|
||||
raise
|
||||
|
||||
@@ -66,8 +66,9 @@ class AntminerModernWebAPI(BaseWebAPI):
|
||||
keep_settings = parameters.get("keep_settings", True)
|
||||
if file:
|
||||
upload_url = f"http://{self.ip}:{self.port}/cgi-bin/firmware_upload.cgi"
|
||||
with open(file, "rb") as firmware:
|
||||
files = {"file": (file.name, firmware, "application/octet-stream")}
|
||||
async with aiofiles.open(file, "rb") as firmware:
|
||||
file_content = await firmware.read()
|
||||
files = {"file": (file.name, file_content, "application/octet-stream")}
|
||||
upload_response = await client.post(
|
||||
upload_url,
|
||||
auth=auth,
|
||||
|
||||
Reference in New Issue
Block a user