Merge pull request 'delete debug' (#7) from dev into main

Reviewed-on: #7
This commit is contained in:
sergey 2025-06-24 07:05:54 +00:00
commit 13689ca6f4
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: def send_command(connection: ConnectHandler, command: str) -> str:
log.info("send command") log.info("send command")
try: 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') log.info('command send success')
except exceptions.NetmikoTimeoutException: except exceptions.NetmikoTimeoutException:
result = "NetmikoTimeoutException" result = "NetmikoTimeoutException"

View File

@ -68,7 +68,6 @@ class ConfigNetDev:
pwd: str = os.getenv("NET_DEV_PWD") pwd: str = os.getenv("NET_DEV_PWD")
ssh_port: int = config["net_dev"].getint("ssh_port") ssh_port: int = config["net_dev"].getint("ssh_port")
read_timeout: int = config["net_dev"].getint("read_timeout") 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") debug: bool = config["net_dev"].getboolean("debug")

View File

@ -16,7 +16,7 @@ subject: Warning in backup network device
# Конфиг гит репозитория # Конфиг гит репозитория
[git] [git]
# False \ True - включение\отключение отправки файлов в удалённый репозиторий # False \ True - включение\отключение отправки файлов в удалённый репозиторий
push: True push: False
# Пользователь в локальном гите # Пользователь в локальном гите
user: net-bcp user: net-bcp
mail: net-bcp@example.com mail: net-bcp@example.com
@ -41,7 +41,6 @@ debug: False
# Порт на который подключаться по ssh # Порт на который подключаться по ssh
ssh_port: 22 ssh_port: 22
read_timeout: 30 read_timeout: 30
delay_factor: 2
[log] [log]
# Уровень логов в консоль # Уровень логов в консоль

View File

@ -52,8 +52,10 @@ def main():
if os.path.isfile(log_file): if os.path.isfile(log_file):
with open(log_file, 'r', encoding='utf-8') as file: with open(log_file, 'r', encoding='utf-8') as file:
text = file.read() text = file.read()
if text != '':
send_mail(text) send_mail(text)
else:
log.info("log file is empty. All backups saved")
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,7 +1,7 @@
version: '3.3' version: '3.3'
services: services:
net-backup: net-backup:
image: git.sm8255082.ru/osnova/net-backup:1.1.0 image: git.sm8255082.ru/osnova/net-backup:1.1.6
restart: "no" restart: "no"
volumes: volumes:
- ./logs:/app/logs - ./logs:/app/logs