added output when running install process
This commit is contained in:
@@ -33,6 +33,7 @@ class testbenchMiner:
|
|||||||
MinerFactory().miners.remove(self.host)
|
MinerFactory().miners.remove(self.host)
|
||||||
|
|
||||||
async def wait_for_disconnect(self):
|
async def wait_for_disconnect(self):
|
||||||
|
await self.add_to_output("Waiting for disconnect...")
|
||||||
while await ping_miner(self.host):
|
while await ping_miner(self.host):
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
@@ -40,19 +41,25 @@ class testbenchMiner:
|
|||||||
if not await ping_miner(self.host):
|
if not await ping_miner(self.host):
|
||||||
return
|
return
|
||||||
await self.remove_from_cache()
|
await self.remove_from_cache()
|
||||||
miner = MinerFactory().get_miner(self.host)
|
miner = await MinerFactory().get_miner(self.host)
|
||||||
|
await self.add_to_output("Found miner: " + miner)
|
||||||
if isinstance(miner, BOSMinerS9):
|
if isinstance(miner, BOSMinerS9):
|
||||||
|
await self.add_to_output("Already running BraiinsOS, updating.")
|
||||||
self.state = UPDATE
|
self.state = UPDATE
|
||||||
return
|
return
|
||||||
if await ping_miner(self.host, 22):
|
if await ping_miner(self.host, 22):
|
||||||
|
await self.add_to_output("Miner is unlocked, installing.")
|
||||||
self.state = INSTALL
|
self.state = INSTALL
|
||||||
return
|
return
|
||||||
|
await self.add_to_output("Miner needs unlock, unlocking.")
|
||||||
self.state = UNLOCK
|
self.state = UNLOCK
|
||||||
|
|
||||||
async def install_unlock(self):
|
async def install_unlock(self):
|
||||||
if await self.ssh_unlock():
|
if await self.ssh_unlock():
|
||||||
|
await self.add_to_output("Unlocked miner, installing.")
|
||||||
self.state = INSTALL
|
self.state = INSTALL
|
||||||
return
|
return
|
||||||
|
await self.add_to_output("Failed to unlock miner, please pin reset.")
|
||||||
self.state = START
|
self.state = START
|
||||||
await self.wait_for_disconnect()
|
await self.wait_for_disconnect()
|
||||||
|
|
||||||
@@ -76,12 +83,14 @@ class testbenchMiner:
|
|||||||
# get stdout of the install
|
# get stdout of the install
|
||||||
while True:
|
while True:
|
||||||
stdout = await proc.stderr.readuntil(b"\r")
|
stdout = await proc.stderr.readuntil(b"\r")
|
||||||
|
await self.add_to_output(stdout)
|
||||||
if stdout == b"":
|
if stdout == b"":
|
||||||
break
|
break
|
||||||
await proc.wait()
|
await proc.wait()
|
||||||
while not await ping_miner(self.host):
|
while not await ping_miner(self.host):
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
|
await self.add_to_output("Install complete, configuring.")
|
||||||
self.state = REFERRAL
|
self.state = REFERRAL
|
||||||
|
|
||||||
async def install_update(self):
|
async def install_update(self):
|
||||||
@@ -91,8 +100,10 @@ class testbenchMiner:
|
|||||||
await miner.send_file(UPDATE_FILE_S9, "/tmp/firmware.tar")
|
await miner.send_file(UPDATE_FILE_S9, "/tmp/firmware.tar")
|
||||||
await miner.send_ssh_command("sysupgrade /tmp/firmware.tar")
|
await miner.send_ssh_command("sysupgrade /tmp/firmware.tar")
|
||||||
except:
|
except:
|
||||||
|
await self.add_to_output("Failed to update, restarting.")
|
||||||
self.state = START
|
self.state = START
|
||||||
return
|
return
|
||||||
|
await self.add_to_output("Update complete, configuring.")
|
||||||
self.state = REFERRAL
|
self.state = REFERRAL
|
||||||
|
|
||||||
async def install_referral(self):
|
async def install_referral(self):
|
||||||
@@ -106,17 +117,25 @@ class testbenchMiner:
|
|||||||
"opkg install /tmp/referral.ipk && /etc/init.d/bosminer restart"
|
"opkg install /tmp/referral.ipk && /etc/init.d/bosminer restart"
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
|
await self.add_to_output(
|
||||||
|
"Failed to add referral and configure, restarting."
|
||||||
|
)
|
||||||
self.state = START
|
self.state = START
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
await self.add_to_output(
|
||||||
|
"Failed to add referral and configure, restarting."
|
||||||
|
)
|
||||||
self.state = START
|
self.state = START
|
||||||
return
|
return
|
||||||
|
await self.add_to_output("Configuration complete.")
|
||||||
self.state = DONE
|
self.state = DONE
|
||||||
|
|
||||||
async def get_web_data(self):
|
async def get_web_data(self):
|
||||||
miner = await MinerFactory().get_miner(self.host)
|
miner = await MinerFactory().get_miner(self.host)
|
||||||
|
|
||||||
if not isinstance(miner, BOSMinerS9):
|
if not isinstance(miner, BOSMinerS9):
|
||||||
|
await self.add_to_output("Miner type changed, restarting.")
|
||||||
self.state = START
|
self.state = START
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user