From 8ce90f44b703d3cd3fb77bdac82821c553761376 Mon Sep 17 00:00:00 2001 From: RemiZOffAlex Date: Sat, 28 Sep 2024 20:17:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D1=87=D0=B8=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infector/__init__.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/infector/__init__.py b/infector/__init__.py index cfac702..da71d54 100644 --- a/infector/__init__.py +++ b/infector/__init__.py @@ -11,14 +11,6 @@ ndb = NDB() def network_config(ip, mask, gateway): - # ip = IPRoute() - # index = ip.link_lookup(ifname='em1')[0] - # ip.addr('add', index, address='192.168.0.1', mask=24) - # ip.close() - # ip = IPDB() - # with ip.interfaces.br0 as br0: - # em1.add_ip('{ip}/{mask}'.format(ip=ip, mask=mask)) - # ip.release() with ndb.interfaces['br0'] as br0: address = '{ip}/{mask}'.format(ip=ip, mask=mask) br0.add_ip(address).commit() @@ -27,14 +19,11 @@ def network_config(ip, mask, gateway): def TestApp(*args): - # These lines create the form and populate it with widgets. - # A fairly complex screen in only 8 or so lines of code - a line for each control. - NetworkView = npyscreen.ActionForm(name = "SaaS",) - ip = NetworkView.add(npyscreen.TitleText, name = "IP:",) - mask = NetworkView.add(npyscreen.TitleText, name = "Netmask:",) - gateway = NetworkView.add(npyscreen.TitleText, name = "Gateway:",) + NetworkView = npyscreen.ActionForm(name = "SaaS",) + ip = NetworkView.add(npyscreen.TitleText, name = "IP:",) + mask = NetworkView.add(npyscreen.TitleText, name = "Netmask:",) + gateway = NetworkView.add(npyscreen.TitleText, name = "Gateway:",) - # This lets the user interact with the Form. NetworkView.edit() data = {