added the option to append the last octet of the IP address to the username when configuring
This commit is contained in:
@@ -13,18 +13,3 @@ 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")
|
||||
|
||||
@@ -154,10 +154,16 @@ class BOSMiner(BaseMiner):
|
||||
logging.warning(f"Failed to get model for miner: {self}")
|
||||
return None
|
||||
|
||||
async def send_config(self, yaml_config) -> None:
|
||||
async def send_config(self, yaml_config, ip_user: bool = False) -> None:
|
||||
"""Configures miner with yaml config."""
|
||||
logging.debug(f"{self}: Sending config.")
|
||||
toml_conf = toml.dumps(await general_config_convert_bos(yaml_config))
|
||||
if ip_user:
|
||||
suffix = str(self.ip).split(".")[-1]
|
||||
toml_conf = toml.dumps(
|
||||
await general_config_convert_bos(yaml_config, user_suffix=suffix)
|
||||
)
|
||||
else:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user