fixed some bugs in getting ssh connections
This commit is contained in:
@@ -52,10 +52,15 @@ class BMMiner(BaseMiner):
|
|||||||
server_host_key_algs=['ssh-rsa'])
|
server_host_key_algs=['ssh-rsa'])
|
||||||
return conn
|
return conn
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print("Exception raised:", self.ip)
|
||||||
|
raise e
|
||||||
except OSError:
|
except OSError:
|
||||||
print(str(self.ip) + ": Connection refused.")
|
print(str(self.ip) + ": Connection refused.")
|
||||||
return None
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
print("Exception raised:", self.ip)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|
||||||
async def send_ssh_command(self, cmd):
|
async def send_ssh_command(self, cmd):
|
||||||
result = None
|
result = None
|
||||||
|
|||||||
@@ -20,8 +20,12 @@ class BOSMiner(BaseMiner):
|
|||||||
|
|
||||||
async def _get_ssh_connection(self) -> asyncssh.connect:
|
async def _get_ssh_connection(self) -> asyncssh.connect:
|
||||||
"""Create a new asyncssh connection"""
|
"""Create a new asyncssh connection"""
|
||||||
conn = await asyncssh.connect(str(self.ip), known_hosts=None, username=self.uname, password=self.pwd,
|
try:
|
||||||
server_host_key_algs=['ssh-rsa'])
|
conn = await asyncssh.connect(str(self.ip), known_hosts=None, username=self.uname, password=self.pwd,
|
||||||
|
server_host_key_algs=['ssh-rsa'])
|
||||||
|
except Exception as e:
|
||||||
|
print("Exception raised:", self.ip)
|
||||||
|
raise e
|
||||||
# return created connection
|
# return created connection
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class BTMiner(BaseMiner):
|
|||||||
except APIError:
|
except APIError:
|
||||||
return "?"
|
return "?"
|
||||||
|
|
||||||
|
|
||||||
async def get_board_info(self) -> dict:
|
async def get_board_info(self) -> dict:
|
||||||
"""Gets data on each board and chain in the miner."""
|
"""Gets data on each board and chain in the miner."""
|
||||||
devs = await self.api.devs()
|
devs = await self.api.devs()
|
||||||
@@ -56,4 +55,3 @@ class BTMiner(BaseMiner):
|
|||||||
else:
|
else:
|
||||||
print(board)
|
print(board)
|
||||||
return boards
|
return boards
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,14 @@ class CGMiner(BaseMiner):
|
|||||||
server_host_key_algs=['ssh-rsa'])
|
server_host_key_algs=['ssh-rsa'])
|
||||||
return conn
|
return conn
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print("Exception raised:", self.ip)
|
||||||
|
raise e
|
||||||
except OSError:
|
except OSError:
|
||||||
print(str(self.ip) + " Connection refused.")
|
print(str(self.ip) + " Connection refused.")
|
||||||
return None
|
return None
|
||||||
|
except Exception as e:
|
||||||
|
print("Exception raised:", self.ip)
|
||||||
|
raise e
|
||||||
|
|
||||||
async def send_ssh_command(self, cmd):
|
async def send_ssh_command(self, cmd):
|
||||||
result = None
|
result = None
|
||||||
|
|||||||
Reference in New Issue
Block a user