read timeout in config
This commit is contained in:
parent
e80821e6da
commit
49e62892c8
|
@ -73,7 +73,7 @@ def connect_to_device(vendor: str, host: str, name: str="") -> ConnectHandler:
|
|||
|
||||
def send_command(connection: ConnectHandler, command: str) -> str:
|
||||
try:
|
||||
result: str = connection.send_command(command, read_timeout=30)
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout)
|
||||
except exceptions.NetmikoTimeoutException:
|
||||
result = "NetmikoTimeoutException"
|
||||
except exceptions.ReadTimeout:
|
||||
|
|
|
@ -67,6 +67,7 @@ class ConfigNetDev:
|
|||
domain: str = os.getenv("NET_DEV_DOMAIN")
|
||||
pwd: str = os.getenv("NET_DEV_PWD")
|
||||
ssh_port: int = config["net_dev"].getint("ssh_port")
|
||||
read_timeout: int = config["net_dev"].getint("read_timeout")
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
@ -39,6 +39,7 @@ start_at: 18:59
|
|||
[net_dev]
|
||||
# Порт на который подключаться по ssh
|
||||
ssh_port: 22
|
||||
read_timeout: 30
|
||||
|
||||
[log]
|
||||
# Уровень логов в консоль
|
||||
|
|
Loading…
Reference in New Issue