Refactor upgrade_firmware to maintain bool return type
This commit is contained in:
@@ -147,25 +147,21 @@ class LUXMiner(LuxOSFirmware):
|
|||||||
async def get_config(self) -> MinerConfig:
|
async def get_config(self) -> MinerConfig:
|
||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
async def upgrade_firmware(self) -> tuple[bool, str]:
|
async def upgrade_firmware(self) -> bool:
|
||||||
"""
|
"""
|
||||||
Upgrade the firmware on a LuxOS miner by calling the 'updaterun' API command.
|
Upgrade the firmware on a LuxOS miner by calling the 'updaterun' API command.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
tuple[bool, str]: A tuple containing:
|
|
||||||
bool: True if the firmware upgrade was successfully initiated, False otherwise.
|
bool: True if the firmware upgrade was successfully initiated, False otherwise.
|
||||||
str: A status message describing the result of the operation.
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
await self.rpc.upgraderun()
|
await self.rpc.upgraderun()
|
||||||
status = f"{self.ip}: Firmware upgrade initiated successfully."
|
logging.info(f"{self.ip}: Firmware upgrade initiated successfully.")
|
||||||
logging.info(status)
|
return True
|
||||||
return True, status
|
|
||||||
|
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
status = f"{self.ip}: Firmware upgrade failed: {e}"
|
logging.error(f"{self.ip}: Firmware upgrade failed: {e}")
|
||||||
logging.error(status)
|
|
||||||
return False, status
|
return False
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
||||||
|
|||||||
Reference in New Issue
Block a user