==== DHCP-/DNS-Admin ====
def read(self, vlaninheader):
print("read(): <-", self._full_fn)
with open(self._full_fn) as file:
# self._lines = file.read().splitlines()
# self._lines = file.readlines() # behält '\n'
self._lines = file.readlines()
vlaninheader = None
if vlaninheader in self._full_fn:
print("das VLAN '{vlaninheader}' wurde in '{self._full_fn}' gefunden".format(vlaninheader, self._full_fn) )
if not self._lines:
raise OSError("'{}' ist leer!".format(self._full_fn))
if __name__ == "__main__":
''' zum TESTEN der Klasse '''
from glob import glob
from DnsHeader import DnsHeader
from VLAN import VLAN
l_headers = glob("headers/*")
for hfile in l_headers:
dnsheader = DnsHeader(hfile)
print(dnsheader.name)
dnsheader.read()
dnsheader.update_serial()
dnsheader.print_lines()
print()
vlaninheader = "vlan0100.in"
vlan = VLAN(vlaninheader)
vlan.read()
if __name__ == "__main__":
''' zum TESTEN der Klasse '''
from glob import glob
from VLAN import VLAN
l_headers = glob("headers/*")
for hfile in l_headers:
dnsheader = DnsHeader(hfile)
print(dnsheader.name)
dnsheader.read() # lines[] belegt
dnsheader.update_serial()
#dnsheader.write()
#dnsheader.print_lines()
dnsheader.print_vlansinheader()
print()
l_vlansinheader = dnsheader.vlansinheader
print(l_vlansinheader)
for vlansinheader in l_vlansinheader:
vlan = VLAN(vlansinheader)
vlan.read()
elif sys.argv[1] == "-update":
print ("dda wurde mit der Option -update aufgerufen")
for vlan in vlan_objs:
vlan.read()
vlan.print_lines()
for hfile in l_headers:
dnsheader = DnsHeader(hfile)
dnsheader.read()
dnsheader.update_serial()
dnsheader.write()
for hfile in l_headers:
dnsheader = DnsHeader(hfile)
print(dnsheader.name)
dnsheader.read() # lines[] belegt
dnsheader.update_serial()
#dnsheader.write()
#dnsheader.print_lines()
dnsheader.print_vlansinheader()
print()
l_vlansinheader = dnsheader.vlansinheader
print(l_vlansinheader)
vsinheader = [s.rstrip() for s in l_vlansinheader]
print(vsinheader)
for vlaninheader in vsinheader:
vlan = VLAN(vlaninheader)
vlan.read()
sys.exit(0)