Compare commits
2 Commits
05a45774f1
...
13689ca6f4
Author | SHA1 | Date |
---|---|---|
|
13689ca6f4 | |
|
30f04e0178 |
|
@ -78,7 +78,7 @@ def connect_to_device(vendor: str, host: str, name: str="") -> ConnectHandler:
|
|||
def send_command(connection: ConnectHandler, command: str) -> str:
|
||||
log.info("send command")
|
||||
try:
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout, delay_factor=cfg.net_dev.delay_factor)
|
||||
result: str = connection.send_command(command, read_timeout=cfg.net_dev.read_timeout)
|
||||
log.info('command send success')
|
||||
except exceptions.NetmikoTimeoutException:
|
||||
result = "NetmikoTimeoutException"
|
||||
|
|
|
@ -68,7 +68,6 @@ class ConfigNetDev:
|
|||
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")
|
||||
delay_factor: int = config["net_dev"].getint("delay_factor")
|
||||
debug: bool = config["net_dev"].getboolean("debug")
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ subject: Warning in backup network device
|
|||
# Конфиг гит репозитория
|
||||
[git]
|
||||
# False \ True - включение\отключение отправки файлов в удалённый репозиторий
|
||||
push: True
|
||||
push: False
|
||||
# Пользователь в локальном гите
|
||||
user: net-bcp
|
||||
mail: net-bcp@example.com
|
||||
|
@ -41,7 +41,6 @@ debug: False
|
|||
# Порт на который подключаться по ssh
|
||||
ssh_port: 22
|
||||
read_timeout: 30
|
||||
delay_factor: 2
|
||||
|
||||
[log]
|
||||
# Уровень логов в консоль
|
||||
|
|
|
@ -52,8 +52,10 @@ def main():
|
|||
if os.path.isfile(log_file):
|
||||
with open(log_file, 'r', encoding='utf-8') as file:
|
||||
text = file.read()
|
||||
send_mail(text)
|
||||
|
||||
if text != '':
|
||||
send_mail(text)
|
||||
else:
|
||||
log.info("log file is empty. All backups saved")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
version: '3.3'
|
||||
services:
|
||||
net-backup:
|
||||
image: git.sm8255082.ru/osnova/net-backup:1.1.0
|
||||
image: git.sm8255082.ru/osnova/net-backup:1.1.6
|
||||
restart: "no"
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
|
|
Loading…
Reference in New Issue