Commit 44f62b9e authored by Alberts S's avatar Alberts S
Browse files

Add SSH backoff

parent c4fbcf88
......@@ -3,6 +3,7 @@ import logging
import sys
import asyncssh
import backoff
import yaml
......@@ -31,6 +32,7 @@ class CapybaraNetty(metaclass=MetaCapybaraNetty):
self.config = self.config | yaml.safe_load(f)
return self.config
@backoff.on_exception(backoff.constant, asyncio.exceptions.TimeoutError, interval=1, max_tries=3, max_time=10)
async def ssh_exec(self, ip, username, command, check=True):
self.__logger.debug(f"{self.log_format_ip(ip)} CMD: {command}")
async with asyncssh.connect(host=ip, username=username, known_hosts=None, connect_timeout=10) as conn:
......
......@@ -3,6 +3,7 @@ asttokens==2.0.5
asyncssh==2.10.0
autoflake==1.4
backcall==0.2.0
backoff==2.0.1
black==22.3.0
certifi==2021.10.8
cffi==1.15.0
......@@ -53,7 +54,7 @@ Pygments==2.11.2
pyparsing==3.0.7
python-dateutil==2.8.2
pytz==2022.1
pyvis @ git+https://github.com/WestHealth/pyvis.git@v0.2.1
pyvis @ git+https://github.com/WestHealth/pyvis.git@6438912630dca9f488a49c6a8c55a897baeb29c3
PyYAML==6.0
requests==2.27.1
scipy==1.8.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment