From c673fe031bc19d022c8cc548c98fcd7c19342130 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 1 Sep 2017 16:12:10 +0300 Subject: [PATCH] fixbug --- agent/core.py | 4 ++-- cron.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/agent/core.py b/agent/core.py index 8299755..afcb9d8 100644 --- a/agent/core.py +++ b/agent/core.py @@ -32,12 +32,12 @@ def check_input_type(*types): # Общается с NAS'ом class BaseTransmitter(metaclass=ABCMeta): @abstractmethod - @check_input_type(AbonStruct) + @check_input_type(set) def add_user_range(self, user_list): """добавляем список абонентов в NAS""" @abstractmethod - @check_input_type(AbonStruct) + @check_input_type(set) def remove_user_range(self, users): """удаляем список абонентов""" diff --git a/cron.py b/cron.py index 1369392..221b2d6 100755 --- a/cron.py +++ b/cron.py @@ -10,8 +10,6 @@ from mydefs import LogicError def main(): - tm = None - users = Abon.objects.all() for user in users: try: @@ -34,15 +32,17 @@ def main(): continue # обновляем абонента если он статический. Иначе его обновит dhcp - if user.opt82 is None: - if tm is None: - tm = Transmitter() - tm.update_user(ab) + #if tm is None: + # tm = Transmitter() + #tm.update_user(ab) except (NasNetworkError, NasFailedResult) as er: print("Error:", er) except LogicError as er: print("Notice:", er) + tm = Transmitter() + users = Abon.objects.filter(is_dynamic_ip=False) + tm.sync_nas(users) if __name__ == "__main__":