Compare commits

...

2 Commits

Author SHA1 Message Date
sergey 13689ca6f4 Merge pull request 'delete debug' (#7) from dev into main
Reviewed-on: #7
2025-06-24 07:05:54 +00:00
s.mostryukov 30f04e0178 delete debug
fix mail send
upd docker-compose.yaml
2025-06-24 10:05:08 +03:00
5 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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")

View File

@ -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]
# Уровень логов в консоль

View File

@ -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__":

View File

@ -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