added changing model when configuring for BOS S9s

This commit is contained in:
UpstreamData
2022-03-25 08:58:02 -06:00
parent 02581e917d
commit c3b23313ba
6 changed files with 45 additions and 24 deletions

View File

@@ -1,4 +1,8 @@
import logging
import toml
from miners.bosminer import BOSMiner
from config.bos import general_config_convert_bos
class BOSMinerS9(BOSMiner):
@@ -9,3 +13,18 @@ class BOSMinerS9(BOSMiner):
def __repr__(self) -> str:
return f"BOSminerS9: {str(self.ip)}"
async def send_config(self, yaml_config) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.")
conf = await general_config_convert_bos(yaml_config)
toml_conf = toml.dumps(conf)
conf["format"]["model"] = "Antminer S9"
async with (await self._get_ssh_connection()) as conn:
logging.debug(f"{self}: Opening SFTP connection.")
async with conn.start_sftp_client() as sftp:
logging.debug(f"{self}: Opening config file.")
async with sftp.open('/etc/bosminer.toml', 'w+') as file:
await file.write(toml_conf)
logging.debug(f"{self}: Restarting BOSMiner")
await conn.run("/etc/init.d/bosminer restart")

View File

@@ -107,7 +107,7 @@ class BOSMiner(BaseMiner):
async def send_config(self, yaml_config) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.")
toml_conf = await general_config_convert_bos(yaml_config)
toml_conf = toml.dumps(await general_config_convert_bos(yaml_config))
async with (await self._get_ssh_connection()) as conn:
logging.debug(f"{self}: Opening SFTP connection.")
async with conn.start_sftp_client() as sftp: