Lines 1764-1779
def create_network(schoolNr, network, iprange=None, defaultrouter=None, nameserv
|
Link Here
|
---|
|
1764 |
pass |
1764 |
pass |
1765 |
|
1765 |
|
1766 |
position.setDn("cn=%s,cn=dhcp,%s" % (schoolNr.lower(), getDN(schoolNr))) |
1766 |
position.setDn("cn=%s,cn=dhcp,%s" % (schoolNr.lower(), getDN(schoolNr))) |
1767 |
object = dhcp_service_module.object(co, lo, position=position, superordinate=superordinate) |
1767 |
dhcp_service_objects = univention.admin.modules.lookup( |
1768 |
object = dhcp_subnet_module.object(co, lo, position=position, superordinate=dhcp_subnet_module) |
1768 |
dhcp_service_module, co, lo, scope='sub', superordinate=superordinate, |
1769 |
object.open() |
1769 |
base=baseDN, filter=univention.admin.filter.expression('cn', schoolNr.lower())) |
1770 |
object['subnet'] = str(network.network) |
1770 |
if not dhcp_service_objects: |
1771 |
object['subnetmask'] = str(network.netmask) |
1771 |
print 'ERROR: DHCP service object for %r not found' % (schoolNr.lower(),) |
1772 |
object['broadcastaddress'] = str(network.broadcast) |
|
|
1773 |
try: |
1774 |
create_object(object, ignore_exists=True) |
1775 |
except: |
1776 |
success = False |
1772 |
success = False |
|
|
1773 |
else: |
1774 |
object = dhcp_subnet_module.object(co, lo, position=position, superordinate=dhcp_service_objects[0]) |
1775 |
object.open() |
1776 |
object['subnet'] = str(network.network) |
1777 |
object['subnetmask'] = str(network.netmask) |
1778 |
object['broadcastaddress'] = str(network.broadcast) |
1779 |
exists = create_object(object, ignore_exists=True) |
1780 |
if exists: |
1781 |
print '%r already existed - usually no problem' % (object.dn,) |
1777 |
|
1782 |
|
1778 |
position.setDn("cn=networks,%s" % (getDN(schoolNr), )) |
1783 |
position.setDn("cn=networks,%s" % (getDN(schoolNr), )) |
1779 |
object = network_module.object(co, lo, position=position, superordinate=superordinate) |
1784 |
object = network_module.object(co, lo, position=position, superordinate=superordinate) |