attempt to fix a bug in testbench
This commit is contained in:
@@ -15,8 +15,8 @@ class BaseMiner:
|
|||||||
api: BMMinerAPI or BOSMinerAPI or CGMinerAPI or BTMinerAPI or UnknownAPI,
|
api: BMMinerAPI or BOSMinerAPI or CGMinerAPI or BTMinerAPI or UnknownAPI,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.ip = ipaddress.ip_address(ip)
|
self.ip = ipaddress.ip_address(ip)
|
||||||
self.uname = None
|
self.uname = "root"
|
||||||
self.pwd = None
|
self.pwd = "admin"
|
||||||
self.api = api
|
self.api = api
|
||||||
self.api_type = None
|
self.api_type = None
|
||||||
self.model = None
|
self.model = None
|
||||||
@@ -40,7 +40,7 @@ class BaseMiner:
|
|||||||
conn = await asyncssh.connect(
|
conn = await asyncssh.connect(
|
||||||
str(self.ip),
|
str(self.ip),
|
||||||
known_hosts=None,
|
known_hosts=None,
|
||||||
username="admin",
|
username="root",
|
||||||
password="admin",
|
password="admin",
|
||||||
server_host_key_algs=["ssh-rsa"],
|
server_host_key_algs=["ssh-rsa"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -202,6 +202,10 @@ class BOSMiner(BaseMiner):
|
|||||||
offset = devs[0]["ID"]
|
offset = devs[0]["ID"]
|
||||||
for board in devs:
|
for board in devs:
|
||||||
boards[board["ID"] - offset] = []
|
boards[board["ID"] - offset] = []
|
||||||
|
if not board["Chips"] == self.nominal_chips:
|
||||||
|
nominal = False
|
||||||
|
else:
|
||||||
|
nominal = True
|
||||||
if not board["Chips"] == self.nominal_chips:
|
if not board["Chips"] == self.nominal_chips:
|
||||||
nominal = False
|
nominal = False
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import datetime
|
|||||||
from network import ping_miner
|
from network import ping_miner
|
||||||
from miners.miner_factory import MinerFactory
|
from miners.miner_factory import MinerFactory
|
||||||
from miners.antminer.S9.bosminer import BOSMinerS9
|
from miners.antminer.S9.bosminer import BOSMinerS9
|
||||||
|
from miners.unknown import UnknownMiner
|
||||||
from tools.web_testbench.connections import ConnectionManager
|
from tools.web_testbench.connections import ConnectionManager
|
||||||
from tools.web_testbench.feeds import get_local_versions
|
from tools.web_testbench.feeds import get_local_versions
|
||||||
from settings import NETWORK_PING_TIMEOUT as PING_TIMEOUT
|
from settings import NETWORK_PING_TIMEOUT as PING_TIMEOUT
|
||||||
@@ -90,6 +91,21 @@ class TestbenchMiner:
|
|||||||
await self.add_to_output("Already running BraiinsOS, updating.")
|
await self.add_to_output("Already running BraiinsOS, updating.")
|
||||||
self.state = UPDATE
|
self.state = UPDATE
|
||||||
return
|
return
|
||||||
|
elif isinstance(miner, UnknownMiner):
|
||||||
|
await self.add_to_output("Unknown Miner found, attempting to fix.")
|
||||||
|
try:
|
||||||
|
async with (await miner._get_ssh_connection()) as conn:
|
||||||
|
result = await conn.run("miner factory_reset")
|
||||||
|
except:
|
||||||
|
await self.add_to_output("Fix failed, please manually reset miner.")
|
||||||
|
self.state = ERROR
|
||||||
|
return
|
||||||
|
if result:
|
||||||
|
await self.add_to_output("Fix may have worked, retrying.")
|
||||||
|
await asyncio.sleep(10)
|
||||||
|
self.state = START
|
||||||
|
return
|
||||||
|
|
||||||
if await ping_miner(self.host, 22):
|
if await ping_miner(self.host, 22):
|
||||||
await self.add_to_output("Miner is unlocked, installing.")
|
await self.add_to_output("Miner is unlocked, installing.")
|
||||||
self.state = INSTALL
|
self.state = INSTALL
|
||||||
|
|||||||
Reference in New Issue
Block a user