From 791b5f6c9a542d4798bbd77f267bbd165c273989 Mon Sep 17 00:00:00 2001 From: bashmak Date: Fri, 18 Aug 2017 17:24:45 +0300 Subject: [PATCH 1/3] =?UTF-8?q?FIXBUG:=20=D0=B2=20=D0=BF=D0=B8=D0=BD=D0=B3?= =?UTF-8?q?=20=D0=B0=D0=B4=D1=80=D0=B5=D1=81=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=B0=D1=91=D0=BC=20=D0=B2=20=D1=82=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=BE=D0=BC=20=D0=B2=D0=B8=D0=B4=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/core.py b/agent/core.py index 4478149..8299755 100644 --- a/agent/core.py +++ b/agent/core.py @@ -97,7 +97,7 @@ class BaseTransmitter(metaclass=ABCMeta): """ @abstractmethod - @check_input_type(TariffStruct) + @check_input_type(str) def ping(self, host, count=10): """ :param host: ip адрес в текстовом виде, например '192.168.0.1' From 1a063ba66114b1f338f9624b2ab08332411af51b Mon Sep 17 00:00:00 2001 From: bashmak Date: Fri, 18 Aug 2017 17:26:05 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=20=D0=B5=D1=81?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BD=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D1=91=D0=BC=20=D0=B2=20=D0=BF=D0=B8=D0=BD=D0=B3=20ip=20?= =?UTF-8?q?=D0=B0=D0=B4=D1=80=D0=B5=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abonapp/locale/ru/LC_MESSAGES/django.po | 3 +++ abonapp/views.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/abonapp/locale/ru/LC_MESSAGES/django.po b/abonapp/locale/ru/LC_MESSAGES/django.po index 63f19d5..7e81d54 100644 --- a/abonapp/locale/ru/LC_MESSAGES/django.po +++ b/abonapp/locale/ru/LC_MESSAGES/django.po @@ -948,3 +948,6 @@ msgstr "Привязать услуги к этой группе" msgid "User that is no staff can not buy admin services" msgstr "Пользователь, который не является персоналом не может покупать услуги для внутренних нужд" + +msgid "Ip not passed" +msgstr "Ip адрес не передан" diff --git a/abonapp/views.py b/abonapp/views.py index a08d9ea..b47f23d 100644 --- a/abonapp/views.py +++ b/abonapp/views.py @@ -738,6 +738,8 @@ def abon_ping(request): status = False text = ' %s' % _('no ping') try: + if ip is None: + raise mydefs.LogicError(_('Ip not passed')) tm = Transmitter() ping_result = tm.ping(ip) if ping_result is None: @@ -756,7 +758,7 @@ def abon_ping(request): text = ' %s' % _('ping ok') + ' ' + str(ping_result) status = True - except NasFailedResult as e: + except (NasFailedResult, mydefs.LogicError) as e: messages.error(request, e) except NasNetworkError as e: messages.warning(request, e) From 88c7b73a3cedcd6322da1299369ec6f5a5d07cb9 Mon Sep 17 00:00:00 2001 From: bashmak Date: Fri, 18 Aug 2017 17:26:42 +0300 Subject: [PATCH 3/3] =?UTF-8?q?FIXBUG:=20=D0=B7=D0=B0=D1=82=D1=83=D0=BF?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B8=20=D0=BD=D0=B5=20=D0=B8=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BD=D0=B0=D0=B7=D0=B0=D0=B4=20?= =?UTF-8?q?=D0=B4=D0=B5=D0=B1=D0=B0=D0=B6=D0=BD=D1=83=D1=8E=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/mod_mikrotik.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/mod_mikrotik.py b/agent/mod_mikrotik.py index 440a5b4..1924b14 100644 --- a/agent/mod_mikrotik.py +++ b/agent/mod_mikrotik.py @@ -162,7 +162,7 @@ class TransmitterManager(BaseTransmitter, metaclass=ABCMeta): def _exec_cmd(self, cmd): assert isinstance(cmd, list) - result_iter = ''#self.ar.talk_iter(cmd) + result_iter = self.ar.talk_iter(cmd) res = [] for rt in result_iter: if rt[0] == '!trap': @@ -172,7 +172,7 @@ class TransmitterManager(BaseTransmitter, metaclass=ABCMeta): def _exec_cmd_iter(self, cmd): assert isinstance(cmd, list) - result_iter = ''#self.ar.talk_iter(cmd) + result_iter = self.ar.talk_iter(cmd) for rt in result_iter: if len(rt) < 2: continue