Compare commits
2 Commits
7c397e4245
...
581e59f074
| Author | SHA1 | Date | |
|---|---|---|---|
| 581e59f074 | |||
| 8ce90f44b7 |
@ -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:",)
|
||||
|
||||
# This lets the user interact with the Form.
|
||||
NetworkView.edit()
|
||||
|
||||
data = {
|
||||
|
||||
2
infector/views/__init__.py
Normal file
2
infector/views/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
17
infector/views/network.py
Normal file
17
infector/views/network.py
Normal file
@ -0,0 +1,17 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
|
||||
import npyscreen
|
||||
|
||||
|
||||
class NetworkView(npyscreen.ActionForm):
|
||||
def create(self):
|
||||
self.ip = self.add(npyscreen.TitleText, name = "IP:",)
|
||||
self.mask = self.add(npyscreen.TitleText, name = "Netmask:",)
|
||||
self.gateway = self.add(npyscreen.TitleText, name = "Gateway:",)
|
||||
|
||||
def on_cancel(self):
|
||||
pass
|
||||
|
||||
def on_ok(self):
|
||||
pass
|
||||
Loading…
Reference in New Issue
Block a user