Univention Bugzilla – Attachment 5666 Details for
Bug 33223
DHCP-Optionen broken, attach to all DHCP levels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix DHCP options + cleanup (splitup)
33223_dhcp-statement.diff (text/plain), 176.19 KB, created by
Philipp Hahn
on 2013-11-20 22:44:44 CET
(
hide
)
Description:
Fix DHCP options + cleanup (splitup)
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2013-11-20 22:44:44 CET
Size:
176.19 KB
patch
obsolete
>From 61c0f73c34e7d01be0b02604f9f1b395b60aedbd Mon Sep 17 00:00:00 2001 >Message-Id: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 17:39:20 +0100 >Subject: [PATCH 01/17] Bug #33223: udm/dhcp: Remove confusing pass >Organization: Univention GmbH, Bremen, Germany > >Remove several "pass" statements, which don't do anything and just make >reading the code harder. >--- > .../modules/univention/admin/handlers/__init__.py | 16 +++------------- > 1 file changed, 3 insertions(+), 13 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index 48dee48..8bbe02d 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -546,16 +546,13 @@ class simpleLdap(base): > self.exceptions=[] > > # remove all properties which do not belong to chosen options >- >- chosen_options = None >- descriptions = None >- > try: > # these might not be set by an inheriting module > chosen_options = self.options > descriptions = self.descriptions > except: >- pass >+ chosen_options = None >+ descriptions = None > > if chosen_options and descriptions: > for desc in descriptions: >@@ -1009,8 +1006,6 @@ class simpleLdap(base): > self.policyObjects[policy_type]=univention.admin.objects.get(policy_module, None, self.lo, policy_position) > self.policyObjects[policy_type].copyIdentifier(self) > self._init_ldap_search( self.policyObjects[ policy_type ] ) >- else: >- pass > > return self.policyObjects[policy_type] > >@@ -1519,7 +1514,7 @@ class simpleComputer( simpleLdap ): > modify(rdn, zone) > except univention.admin.uexceptions.noObject: > pass >- pass >+ > def __add_dns_reverse_object( self, name, zoneDn, ip ): > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should create a dns reverse object: zoneDn="%s", name="%s", ip="%s"' % ( zoneDn, name, ip ) ) > if name and zoneDn and ip: >@@ -1798,7 +1793,6 @@ class simpleComputer( simpleLdap ): > else: > # thow exeption, cNAMERecord is single value > raise univention.admin.uexceptions.dnsAliasAlreadyUsed, _('DNS alias is already in use.') >- pass > > def __remove_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias = None ): > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'remove a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) >@@ -1963,7 +1957,6 @@ class simpleComputer( simpleLdap ): > self.__update_groups_after_namechange() > self.__rename_dhcp_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) > self.__rename_dns_object( position = None, old_name = self.__changes[ 'name' ][ 0 ], new_name = self.__changes[ 'name' ][ 1 ] ) >- pass > > if self.ipRequest == 1 and self[ 'ip' ]: > for ipAddress in self[ 'ip' ]: >@@ -2545,9 +2538,6 @@ class simpleComputer( simpleLdap ): > self.__saved_dhcp_entry = network_object['dhcpEntryZone'] > > self.old_network=value >- else: >- pass >- > > elif key == 'ip': > self.ip_freshly_set = True >-- >1.8.4.rc3 > > >From 40d9794fe993ea215d8b20cc0404813aaf5891f8 Mon Sep 17 00:00:00 2001 >Message-Id: <40d9794fe993ea215d8b20cc0404813aaf5891f8.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 17:44:52 +0100 >Subject: [PATCH 02/17] Bug #33223: udm/dhcp: Simplify test logic >Organization: Univention GmbH, Bremen, Germany > >Use set logic to test for intersections instead of nested loops. > >Directly assign boolean value to variable instead of using a if >statement. >--- > .../modules/univention/admin/handlers/__init__.py | 28 +++++++--------------- > .../univention/admin/handlers/dhcp/service.py | 3 +-- > .../univention/admin/handlers/dhcp/sharedsubnet.py | 2 +- > .../univention/admin/handlers/dhcp/subnet.py | 4 ++-- > 4 files changed, 12 insertions(+), 25 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index 8bbe02d..e399ba4 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -558,19 +558,13 @@ class simpleLdap(base): > for desc in descriptions: > propoptions = descriptions[desc].options > >- if (propoptions==[]): >+ if not propoptions: > # property applies to all options > continue > >- shortcut = False >- >- for i in propoptions: >- if i in chosen_options: >- # this property applies to one of the chosen options, >- # jump to next option >- shortcut = True >- continue >- if shortcut: >+ if set(propoptions) & set(chosen_options): >+ # this property applies to one of the chosen options, >+ # jump to next option > continue > > # if we've come here, we found a property that does not apply >@@ -1840,8 +1834,7 @@ class simpleComputer( simpleLdap ): > > def _ldap_post_modify( self ): > >- if len ( self[ 'mac' ] ) > 1 or len( self[ 'ip' ] ) > 1: >- self.__multiip = True >+ self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1 > > for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]: > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'simpleComputer: dhcp check: removed: %s' % entry ) >@@ -2164,12 +2157,9 @@ class simpleComputer( simpleLdap ): > else: > raise univention.admin.uexceptions.invalidDNSAliasEntry, _('The DNS alias entry for this host should contain the zone name, the alias zone container LDAP-DN and the alias.') > >- if len ( self[ 'mac' ] ) < 2 and len( self[ 'ip' ] ) < 2: >- self.__multiip = False >- else: >- self.__multiip = True >+ self.__multiip = len(self['mac']) > 1 or len(self['ip']) > 1 > >- ml = ml + super( simpleComputer, self )._ldap_modlist( ) >+ ml += super(simpleComputer, self)._ldap_modlist() > > return ml > >@@ -2785,9 +2775,7 @@ class simplePolicy(simpleLdap): > if self.hasChanged(key): > univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'polinfo: key:%s hasChanged' % (key) ) > self.changes=1 >- return >- else: >- return >+ return > > # this object did not exist before > if not self.oldinfo: >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index 4d0d026..a526059 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -123,5 +123,4 @@ def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, > return res > > def identify(dn, attr): >- return 'dhcpService' in attr.get('objectClass', []) \ >- or 'univentionDhcpService' in attr.get('objectClass', []) >+ return bool(set(('dhcpService', 'univentionDhcpService')) & set(attr.get('objectClass', []))) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 9fa93da..3e2a06e 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -171,4 +171,4 @@ def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, > return res > > def identify(dn, attr): >- return 'univentionDhcpSubnet' in attr.get('objectClass', []) and 'univentionDhcpSharedSubnet' in attr.get('objectClass', []) >+ return set(('univentionDhcpSubnet', 'univentionDhcpSharedSubnet')) <= set(attr.get('objectClass', [])) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 687392e..2f3f14b 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -205,5 +205,5 @@ def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, > return res > > def identify(dn, attr): >- >- return 'univentionDhcpSubnet' in attr.get('objectClass', []) and not 'univentionDhcpSharedSubnet' in attr.get('objectClass', []) >+ ocs = set(attr.get('objectClass', [])) >+ return 'univentionDhcpSubnet' in ocs and not 'univentionDhcpSharedSubnet' in ocs >-- >1.8.4.rc3 > > >From b290022bb54998749b368aacee1fcbc6aa480b30 Mon Sep 17 00:00:00 2001 >Message-Id: <b290022bb54998749b368aacee1fcbc6aa480b30.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 17:52:56 +0100 >Subject: [PATCH 03/17] Bug #33223: udm/dhcp: Replace string.join/split >Organization: Univention GmbH, Bremen, Germany > >Replace string.join(_, str) with str.join(_). > >Replace string.split(_, str) with _.split(str) (and hope for _ not being >None) >--- > .../modules/univention/admin/handlers/__init__.py | 31 +++++++++++----------- > .../modules/univention/admin/handlers/dhcp/pool.py | 1 - > .../univention/admin/handlers/dhcp/sharedsubnet.py | 2 -- > .../univention/admin/handlers/dhcp/subnet.py | 4 +-- > 4 files changed, 16 insertions(+), 22 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index e399ba4..df36936 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -33,7 +33,6 @@ > import copy > import types > import re >-import string > import ldap > import ipaddr > >@@ -1111,7 +1110,7 @@ class simpleComputer( simpleLdap ): > zoneName.reverse( ) > relativeDomainName = relativeDomainName.split( '.' ) > relativeDomainName.reverse( ) >- return '%s.%s' % ( string.join( zoneName, '.' ) , string.join( relativeDomainName, '.' ) ) >+ return '.'.join(zoneName + relativeDomainName) > > def __ip_from_ptr_ipv6( self, zoneName, relativeDomainName ): > fullName = relativeDomainName + '.' + zoneName.replace('.ip6.arpa', '') >@@ -1200,7 +1199,7 @@ class simpleComputer( simpleLdap ): > poscomponents = univention.admin.uldap.explodeDn( dn,0 ) > poscomponents.pop( 0 ) > ip = self.__ip_from_ptr( attr[ 'zoneName' ][ 0 ], attr[ 'relativeDomainName' ][ 0 ] ) >- entry = [ string.join( poscomponents, ',' ), ip ] >+ entry = [','.join(poscomponents), ip] > if not entry in self[ 'dnsEntryZoneReverse' ]: > self[ 'dnsEntryZoneReverse' ].append( entry ) > except univention.admin.uexceptions.insufficientInformation, msg: >@@ -1218,7 +1217,7 @@ class simpleComputer( simpleLdap ): > self[ 'dnsAlias' ].append(dnsAlias) > poscomponents = univention.admin.uldap.explodeDn( dn,0 ) > poscomponents.pop( 0 ) >- dnsAliasZoneContainer = string.join( poscomponents,',' ) >+ dnsAliasZoneContainer = ','.join(poscomponents) > if attr[ 'cNAMERecord' ][0] == self[ 'name' ]: > dnsForwardZone = attr[ 'zoneName' ][0] > else: >@@ -1250,12 +1249,12 @@ class simpleComputer( simpleLdap ): > poscomponents.pop( 0 ) > if attr.has_key( 'univentionDhcpFixedAddress' ): > for ip in attr[ 'univentionDhcpFixedAddress' ]: >- entry = [ string.join( poscomponents,',' ), ip, macAddress ] >+ entry = [','.join(poscomponents), ip, macAddress] > if not entry in self[ 'dhcpEntryZone' ]: > self[ 'dhcpEntryZone' ].append( entry ) > > else: >- entry = [ string.join( poscomponents,',' ), macAddress ] >+ entry = [','.join(poscomponents), macAddress] > if not entry in self[ 'dhcpEntryZone' ]: > self[ 'dhcpEntryZone' ].append( entry ) > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'open: DHCP; self[ dhcpEntryZone ] = "%s"' % self[ 'dhcpEntryZone' ] ) >@@ -1499,7 +1498,7 @@ class simpleComputer( simpleLdap ): > results = self.lo.search( base = tmppos.getBase( ), scope = 'domain', attr = [ 'zoneDn' ], filter = '(&(objectClass=dNSZone)(|(pTRRecord=%s)(pTRRecord=%s.*)))' % ( name, name ), unique = 0 ) > for dn, attr in results: > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: dn: "%s"' % dn ) >- zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' ) >+ zone = ','.join(ldap.explode_dn(dn)[1:]) > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: zone: "%s"' % zone ) > rdn = self.calc_dns_reverse_entry_name( ip, zone ) > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'DEBUG: rdn: "%s"' % rdn ) >@@ -1539,13 +1538,13 @@ class simpleComputer( simpleLdap ): > else: > subnet = ldap.explode_dn( zoneDn, 1 )[ 0 ].replace( '.in-addr.arpa', '' ).split( '.' ) > subnet.reverse( ) >- subnet = string.join( subnet, '.' ) + '.' >+ subnet = '.'.join(subnet) + '.' > ipPart = ip.replace( subnet, '' ) > if ipPart == ip: > raise univention.admin.uexceptions.InvalidDNS_Information, _( 'Reverse zone and IP address are incompatible.' ) >- pointer = string.split( ipPart, '.' ) >+ pointer = ipPart.split('.') > pointer.reverse( ) >- ipPart = string.join( pointer, '.' ) >+ ipPart = '.'.join(pointer) > tmppos = univention.admin.uldap.position( self.position.getDomain( ) ) > # check in which forward zone the ip is set > hostname_list = [] >@@ -1601,7 +1600,7 @@ class simpleComputer( simpleLdap ): > # remove the object > self.lo.delete( dn ) > if not zoneDn: >- zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' ) >+ zone = ','.join(ldap.explode_dn(dn)[1:]) > else: > zone = zoneDn > >@@ -1616,7 +1615,7 @@ class simpleComputer( simpleLdap ): > self.lo.modify(dn, [(attrEdit, attr[attrEdit], new_ip_list, ), ]) > > if not zoneDn: >- zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' ) >+ zone = ','.join(ldap.explode_dn(dn)[1:]) > else: > zone = zoneDn > >@@ -1696,7 +1695,7 @@ class simpleComputer( simpleLdap ): > modlist.append( ('aRecord', old_aRecord, new_aRecord, ) ) > self.lo.modify(dn, modlist) > if not zoneDn: >- zone = string.join( ldap.explode_dn( dn )[ 1: ], ',' ) >+ zone = ','.join(ldap.explode_dn(dn)[1:]) > > if zoneDn: > zone = zoneDn >@@ -1919,7 +1918,7 @@ class simpleComputer( simpleLdap ): > if len (self[ 'mac' ] ) > 0: > dn = self.__remove_from_dhcp_object( None, self[ 'name' ], entry, self[ 'mac' ][ 0 ]) > try: >- dn = string.join(dn.split(',')[1:],',') >+ dn = ','.join(dn.split(',')[1:]) > self.__modify_dhcp_object( dn, self[ 'name' ], self.__changes[ 'ip' ][ 'add' ][ 0 ], self[ 'mac' ][ 0 ] ) > except: > pass >@@ -1967,13 +1966,13 @@ class simpleComputer( simpleLdap ): > > def __remove_associated_domain( self, entry ): > dn, ip = self.__split_dns_line( entry ) >- domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=') >+ domain = ldap.explode_rdn(dn)[0].split('=', 1)[1] > if self.info.get('domain', None) == domain: > self.info['domain'] = None > > def __set_associated_domain( self, entry ): > dn, ip = self.__split_dns_line( entry ) >- domain = string.join(ldap.explode_rdn(dn)[0].split('=')[1:], '=') >+ domain = ldap.explode_rdn(dn)[0].split('=', 1)[1] > if not self.info.get('domain', None): > self.info['domain'] = domain > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index f02c862..e298db4 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -31,7 +31,6 @@ > # <http://www.gnu.org/licenses/>. > > import copy >-import string > > from univention.admin.layout import Tab, Group > import univention.admin.filter >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 3e2a06e..d4545ec 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -30,8 +30,6 @@ > # /usr/share/common-licenses/AGPL-3; if not, see > # <http://www.gnu.org/licenses/>. > >-import string >- > from univention.admin.layout import Tab, Group > import univention.admin.filter > import univention.admin.handlers >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 2f3f14b..7b309c5 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -30,8 +30,6 @@ > # /usr/share/common-licenses/AGPL-3; if not, see > # <http://www.gnu.org/licenses/>. > >-import string >- > from univention.admin.layout import Tab, Group > import univention.admin.filter > import univention.admin.handlers >@@ -178,7 +176,7 @@ class object(univention.admin.handlers.simpleLdap): > raise univention.admin.uexceptions.rangeInBroadcastAddress, '%s-%s' % (i[0], i[1]) > > if ip_in_network: >- dhcpRange.append(string.join(i, ' ')) >+ dhcpRange.append(' '.join(i)) > else: > raise univention.admin.uexceptions.rangeNotInNetwork, '%s-%s' % (i[0], i[1]) > #univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'old Range: %s' % self.oldinfo['range']) >-- >1.8.4.rc3 > > >From dcaf29b6e486d549ed68e19e1d704f40cf3501d0 Mon Sep 17 00:00:00 2001 >Message-Id: <dcaf29b6e486d549ed68e19e1d704f40cf3501d0.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:33:26 +0100 >Subject: [PATCH 04/17] Bug #33223: udm/dhcp: Remove dead code >Organization: Univention GmbH, Bremen, Germany > >Unused imports. > >Commented out code. > >Remove double definitions of options={}. > >Useless override of method, which already does what the implementations >does again. >--- > .../modules/univention/admin/handlers/dhcp/__common.py | 9 +-------- > .../modules/univention/admin/handlers/dhcp/pool.py | 3 --- > .../modules/univention/admin/handlers/dhcp/shared.py | 7 ------- > .../modules/univention/admin/handlers/dhcp/sharedsubnet.py | 3 --- > .../modules/univention/admin/handlers/dhcp/subnet.py | 3 --- > 5 files changed, 1 insertion(+), 24 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index e8ded03..4146be3 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -33,7 +33,7 @@ > import copy > > import univention.admin.localization >-from univention.admin.layout import Tab, Group >+from univention.admin.layout import Tab > > translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' ) > _ = translation.translate >@@ -51,14 +51,7 @@ _properties = { > ), > } > >-# def optionMap( value ): >-# return map( lambda x: ' '.join( x ), value ) >- >-# def optionUnmap( value ): >-# return map( lambda x: x.split( ' ', 1 ), value ) >- > _mappings = ( >- # ( 'option', 'dhcpOption', optionMap, optionUnmap ), > ( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ), > ) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index e298db4..a8743c8 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -124,9 +124,6 @@ property_descriptions={ > ), > } > >-options={ >-} >- > layout = [ > Tab(_('General'), _('Basic settings'), layout = [ > Group( _( 'General' ), layout = [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index d1a068e..205db2f 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -60,8 +60,6 @@ property_descriptions={ > identifies=1 > ) > } >-options={ >-} > > layout = [ > Tab( _( 'General' ), _( 'Basic settings' ), layout = [ >@@ -91,11 +89,6 @@ class object(univention.admin.handlers.simpleLdap): > > univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) > >- def open(self): >- univention.admin.handlers.simpleLdap.open(self) >- >- self.save() >- > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn()) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index d4545ec..6bb6efe 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -91,9 +91,6 @@ property_descriptions={ > ), > } > >-options={ >-} >- > layout = [ > Tab(_('General'), _('Basic settings'), layout = [ > Group( _( 'General' ), layout = [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 7b309c5..85b217d 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -92,9 +92,6 @@ property_descriptions={ > ), > } > >-options={ >-} >- > layout = [ > Tab( _( 'General' ), _('Basic settings'), layout = [ > Group( _( 'General' ), layout = [ >-- >1.8.4.rc3 > > >From 12908004c8e32775a9b3e01419a6885660d7aea9 Mon Sep 17 00:00:00 2001 >Message-Id: <12908004c8e32775a9b3e01419a6885660d7aea9.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:39:45 +0100 >Subject: [PATCH 05/17] Bug #33223: udm/dhcp: Common rangeMap functions >Organization: Univention GmbH, Bremen, Germany > >Define function to map and unmap ranges once and import them in all >other users. >--- > .../modules/univention/admin/handlers/dhcp/__common.py | 9 +++++++++ > .../modules/univention/admin/handlers/dhcp/pool.py | 5 +---- > .../modules/univention/admin/handlers/dhcp/sharedsubnet.py | 5 +---- > .../modules/univention/admin/handlers/dhcp/subnet.py | 6 +----- > 4 files changed, 12 insertions(+), 13 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 4146be3..8c0d89e 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -51,6 +51,15 @@ _properties = { > ), > } > >+ >+def rangeMap(value): >+ return map(lambda x: ' '.join(x), value) >+ >+ >+def rangeUnmap(value): >+ return map(lambda x: x.split(), value) >+ >+ > _mappings = ( > ( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ), > ) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index a8743c8..1389f60 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -138,11 +138,8 @@ layout = [ > ] ) > ] > >-def rangeMap( value ): >- return map( lambda x: ' '.join( x ), value ) > >-def rangeUnmap( value ): >- return map( lambda x: x.split( ' ' ), value ) >+from .__common import rangeMap, rangeUnmap > > mapping=univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 6bb6efe..b538b5c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -101,11 +101,8 @@ layout = [ > ] ), > ] > >-def rangeMap( value ): >- return map( lambda x: ' '.join( x ), value ) or None > >-def rangeUnmap( value ): >- return map( lambda x: x.split( ' ' ), value ) >+from .__common import rangeMap, rangeUnmap > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 85b217d..b791503 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -102,11 +102,7 @@ layout = [ > ] ), > ] > >-def rangeMap( value ): >- return map( lambda x: ' '.join( x ), value ) >- >-def rangeUnmap( value ): >- return map( lambda x: x.split(), value ) >+from .__common import rangeUnmap > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) >-- >1.8.4.rc3 > > >From bd30fe035001e869c187d1479e6ecda2e3d5a206 Mon Sep 17 00:00:00 2001 >Message-Id: <bd30fe035001e869c187d1479e6ecda2e3d5a206.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:41:01 +0100 >Subject: [PATCH 06/17] Bug #33223: udm/dhcp: Fix multivalued dhcpOption unmap >Organization: Univention GmbH, Bremen, Germany > >The DHCP options property is multi-valued, so no unmap-function must be >used. >--- > .../modules/univention/admin/handlers/dhcp/__common.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 8c0d89e..a3e3575 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -61,8 +61,8 @@ def rangeUnmap(value): > > > _mappings = ( >- ( 'option', 'dhcpOption', None, univention.admin.mapping.ListToString ), >- ) >+ ('option', 'dhcpOption', None, None), >+) > > def add_dhcp_options( properties, mapping, layout ): > global _properties, _mappings >-- >1.8.4.rc3 > > >From 88fe42cf35b551efc5fc068ed31487cc38377cb6 Mon Sep 17 00:00:00 2001 >Message-Id: <88fe42cf35b551efc5fc068ed31487cc38377cb6.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:43:28 +0100 >Subject: [PATCH 07/17] Bug #33223: udm/dhcp: Remove useless global >Organization: Univention GmbH, Bremen, Germany > >The global declaration is only needed, if the variable is over-written. >As the code only uses it for referencing, the statements can be removed. >--- > .../modules/univention/admin/handlers/dhcp/__common.py | 2 -- > .../modules/univention/admin/handlers/dhcp/dhcp.py | 3 --- > .../modules/univention/admin/handlers/dhcp/host.py | 3 --- > .../modules/univention/admin/handlers/dhcp/pool.py | 3 --- > .../modules/univention/admin/handlers/dhcp/server.py | 3 --- > .../modules/univention/admin/handlers/dhcp/service.py | 3 --- > .../modules/univention/admin/handlers/dhcp/shared.py | 3 --- > .../modules/univention/admin/handlers/dhcp/sharedsubnet.py | 3 --- > .../modules/univention/admin/handlers/dhcp/subnet.py | 3 --- > 9 files changed, 26 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index a3e3575..4ccb8c5 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -65,8 +65,6 @@ _mappings = ( > ) > > def add_dhcp_options( properties, mapping, layout ): >- global _properties, _mappings >- > for name, prop in _properties.items(): > properties[ name ] = prop > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >index 82e00d0..c3aa8e4 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >@@ -93,9 +93,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.mapping=mapping > self.descriptions=property_descriptions > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index e7cc0d3..66c2c1d 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -118,9 +118,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.mapping=mapping > self.descriptions=property_descriptions > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 1389f60..84a78c8 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -150,9 +150,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.mapping=mapping > self.descriptions=property_descriptions > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index 98e43c0..961f4ff 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -81,9 +81,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.superordinate=superordinate > self.mapping=mapping > self.descriptions=property_descriptions >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index a526059..1858d01 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -79,9 +79,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.mapping=mapping > self.descriptions=property_descriptions > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index 205db2f..d22ee08 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -76,9 +76,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.mapping=mapping > self.descriptions=property_descriptions > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index b538b5c..0bc630e 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -118,9 +118,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.superordinate=superordinate > self.mapping=mapping > self.descriptions=property_descriptions >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index b791503..08dcede 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -117,9 +117,6 @@ class object(univention.admin.handlers.simpleLdap): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- global mapping >- global property_descriptions >- > self.superordinate=superordinate > self.mapping=mapping > self.descriptions=property_descriptions >-- >1.8.4.rc3 > > >From 2befaaaa1a6993b579793a89bda2f38dbe19e6dc Mon Sep 17 00:00:00 2001 >Message-Id: <2befaaaa1a6993b579793a89bda2f38dbe19e6dc.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:44:54 +0100 >Subject: [PATCH 08/17] Bug #33223: udm/dhcp: Add description for pool > properties >Organization: Univention GmbH, Bremen, Germany > >Add long_description for all the pool properties. >--- > .../modules/univention/admin/handlers/dhcp/pool.py | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 84a78c8..bde1aa6 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -53,7 +53,7 @@ options={ > property_descriptions={ > 'name': univention.admin.property( > short_description=_('Name'), >- long_description='', >+ long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'), > syntax=univention.admin.syntax.string, > multivalue=0, > include_in_default_search=1, >@@ -74,7 +74,7 @@ property_descriptions={ > ), > 'failover_peer': univention.admin.property( > short_description=_('Failover peer'), >- long_description='', >+ long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'), > syntax=univention.admin.syntax.string, > multivalue=0, > options=[], >@@ -83,8 +83,8 @@ property_descriptions={ > identifies=0, > ), > 'known_clients': univention.admin.property( >- short_description=_('Allow known clients'), >- long_description='', >+ short_description=_('Give IP to known clients'), >+ long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'), > syntax=univention.admin.syntax.AllowDeny, > multivalue=0, > options=[], >@@ -93,8 +93,8 @@ property_descriptions={ > identifies=0 > ), > 'unknown_clients': univention.admin.property( >- short_description=_('Allow unknown clients'), >- long_description='', >+ short_description=_('Give IP to unknown clients'), >+ long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'), > syntax=univention.admin.syntax.AllowDeny, > multivalue=0, > options=[], >@@ -103,8 +103,10 @@ property_descriptions={ > identifies=0 > ), > 'dynamic_bootp_clients': univention.admin.property( >- short_description=_('Allow dynamic BOOTP clients'), >- long_description='', >+ short_description=_('Give IP to dynamic BOOTP clients'), >+ long_description=_( >+ 'Give addresses to clients using the legacy BOOTP protocol.' >+ 'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'), > syntax=univention.admin.syntax.AllowDeny, > multivalue=0, > options=[], >@@ -113,8 +115,8 @@ property_descriptions={ > identifies=0 > ), > 'all_clients': univention.admin.property( >- short_description=_('All clients'), >- long_description='', >+ short_description=_('Give IP from this pool'), >+ long_description=_('Give addresses from this pool at all or not.'), > syntax=univention.admin.syntax.AllowDeny, > multivalue=0, > options=[], >-- >1.8.4.rc3 > > >From e93f15c6db76822991aa28c34dff0255a6f66b53 Mon Sep 17 00:00:00 2001 >Message-Id: <e93f15c6db76822991aa28c34dff0255a6f66b53.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 18:49:43 +0100 >Subject: [PATCH 09/17] Bug #33223: udm/dhcp: Prepare for common super class >Organization: Univention GmbH, Bremen, Germany > >Before introducing a intermediate class for common DHCP methods, convert >the existing code to use super() to reference the right super class. >--- > .../modules/univention/admin/handlers/dhcp/dhcp.py | 2 +- > .../modules/univention/admin/handlers/dhcp/host.py | 2 +- > .../modules/univention/admin/handlers/dhcp/pool.py | 7 +++---- > .../modules/univention/admin/handlers/dhcp/server.py | 2 +- > .../modules/univention/admin/handlers/dhcp/service.py | 2 +- > .../modules/univention/admin/handlers/dhcp/shared.py | 2 +- > .../modules/univention/admin/handlers/dhcp/sharedsubnet.py | 2 +- > .../modules/univention/admin/handlers/dhcp/subnet.py | 6 +++--- > 8 files changed, 12 insertions(+), 13 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >index c3aa8e4..45594d0 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >@@ -96,7 +96,7 @@ class object(univention.admin.handlers.simpleLdap): > self.mapping=mapping > self.descriptions=property_descriptions > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > > def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index 66c2c1d..0803961 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -126,7 +126,7 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index bde1aa6..2c5bf13 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -160,11 +160,10 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def open(self): >- >- univention.admin.handlers.simpleLdap.open(self) >+ super(object, self).open() > > for i in self.oldattr.get('dhcpPermitList', []): > pos=i.find(' ') >@@ -191,7 +190,7 @@ class object(univention.admin.handlers.simpleLdap): > ] > > def _ldap_modlist(self): >- ml=univention.admin.handlers.simpleLdap._ldap_modlist(self) >+ ml = super(object, self)._ldap_modlist() > if self.hasChanged(['known_clients', 'unknown_clients', 'dynamic_bootp_clients', 'all_clients']): > old=self.oldattr.get('dhcpPermitList', []) > new=copy.deepcopy(old) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index 961f4ff..d2d6a32 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -90,7 +90,7 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('server'), mapping.mapValue('server', self.info['server']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index 1858d01..dd157ee 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -85,7 +85,7 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index d22ee08..12a86a4 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -84,7 +84,7 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 0bc630e..b11b5f7 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -127,7 +127,7 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 08dcede..ab63db97 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -126,11 +126,11 @@ class object(univention.admin.handlers.simpleLdap): > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > >- univention.admin.handlers.simpleLdap.__init__(self, co, lo, position, dn, superordinate, attributes = attributes ) >+ super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > > def open(self): >- univention.admin.handlers.simpleLdap.open(self) >+ super(object, self).open() > self.info['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) ) > self.oldinfo['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) ) > >@@ -145,7 +145,7 @@ class object(univention.admin.handlers.simpleLdap): > > def _ldap_modlist(self): > >- ml=univention.admin.handlers.simpleLdap._ldap_modlist(self) >+ ml = super(object, self)._ldap_modlist() > > if self.hasChanged('range'): > dhcpRange=[] >-- >1.8.4.rc3 > > >From ba4ff0a1bb37f9c2f14d3e415f915599606f1ce4 Mon Sep 17 00:00:00 2001 >Message-Id: <ba4ff0a1bb37f9c2f14d3e415f915599606f1ce4.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:07:31 +0100 >Subject: [PATCH 10/17] Bug #33223: udm/dhcp: Handle lookup through common > super class >Organization: Univention GmbH, Bremen, Germany > >Implement searching as a common class-method reusing the speed-optimized >lookup_filter() function introduced for UCS-3.2. >--- > .../univention/admin/handlers/dhcp/__common.py | 17 ++++++++++++ > .../modules/univention/admin/handlers/dhcp/host.py | 27 +++++++++---------- > .../modules/univention/admin/handlers/dhcp/pool.py | 25 ++++++++--------- > .../univention/admin/handlers/dhcp/server.py | 25 ++++++++--------- > .../univention/admin/handlers/dhcp/service.py | 31 ++++++++++------------ > .../univention/admin/handlers/dhcp/shared.py | 27 ++++++++++--------- > .../univention/admin/handlers/dhcp/sharedsubnet.py | 27 +++++++++---------- > .../univention/admin/handlers/dhcp/subnet.py | 27 +++++++++---------- > 8 files changed, 106 insertions(+), 100 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 4ccb8c5..d59b6f7 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -34,6 +34,7 @@ import copy > > import univention.admin.localization > from univention.admin.layout import Tab >+from univention.admin.handlers import simpleLdap > > translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' ) > _ = translation.translate >@@ -74,6 +75,22 @@ def add_dhcp_options( properties, mapping, layout ): > # currently not visible > #layout.append( Tab( _( 'Advanced' ), _( 'Advanced DHCP options' ), layout = [ 'option' ] ) ) > >+ >+class SimpleDhcp(simpleLdap): >+ @classmethod >+ def lookup(cls, co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >+ filter_str = unicode(cls.lookup_filter(filter_s)) >+ res = [ >+ cls(co, lo, None, dn=dn, superordinate=superordinate, attributes=attrs) >+ for dn, attrs in lo.search(filter_str, base, scope, [], unique, required, timeout, sizelimit) >+ ] >+ return res >+ >+ >+class DhcpOptions(SimpleDhcp): >+ pass >+ >+ > def add_dhcp_objectclass( self, ml ): > oldOCs = self.oldattr.get( 'objectClass', [] ) > newOCs = copy.copy( oldOCs ) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index 0803961..17911c2 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -114,7 +114,10 @@ mapping.register('host', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress) > mapping.register('fixedaddress', 'univentionDhcpFixedAddress') > >-class object(univention.admin.handlers.simpleLdap): >+from .__common import DhcpOptions >+ >+ >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -136,21 +139,17 @@ class object(univention.admin.handlers.simpleLdap): > ('objectClass', ['top', 'univentionDhcpHost']), > ] > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >- >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'univentionDhcpHost') >- ]) >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'univentionDhcpHost') >+ ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res >+lookup_filter = object.lookup_filter >+lookup = object.lookup > > def identify(dn, attr): > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 2c5bf13..2833895 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -141,14 +141,14 @@ layout = [ > ] > > >-from .__common import rangeMap, rangeUnmap >+from .__common import rangeMap, rangeUnmap, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) > mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString) > >-class object(univention.admin.handlers.simpleLdap): >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -220,21 +220,18 @@ class object(univention.admin.handlers.simpleLdap): > raise univention.admin.uexceptions.bootpXORFailover > return ml > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'univentionDhcpPool') >+ ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj > >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'univentionDhcpPool') >- ]) > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+lookup_filter = object.lookup_filter >+lookup = object.lookup > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res > > def identify(dn, attr): > return 'univentionDhcpPool' in attr.get('objectClass', []) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index d2d6a32..ed96d34 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -112,23 +112,24 @@ class object(univention.admin.handlers.simpleLdap): > shadow_module, shadow_object=univention.admin.objects.shadow(self.lo, module, object, self.position) > self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)]) > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >- >- filter=univention.admin.filter.conjunction('&', [ >+def lookup_filter(filter_s=None, lo=None): >+ filter_obj=univention.admin.filter.conjunction('&', [ > univention.admin.filter.expression('objectClass', 'dhcpServer') > ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj > >- if superordinate: >- filter.expressions.append(univention.admin.filter.expression('dhcpServiceDN', superordinate.dn)) > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >+ filter_obj = lookup_filter(filter_s) >+ if superordinate: >+ filter_obj.expressions.append(univention.admin.filter.expression('dhcpServiceDN', superordinate.dn)) >+ filter_str = unicode(filter_obj) > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >+ res = [ >+ object(co, lo, None, dn=dn, superordinate=superordinate, attributes=attrs) >+ for dn, attrs in lo.search(filter_str, base, scope, [], unique, required, timeout, sizelimit) >+ ] > return res > > def identify(dn, attr): >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index dd157ee..93c399b 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -71,11 +71,11 @@ layout = [ > mapping=univention.admin.mapping.mapping() > mapping.register('service', 'cn', None, univention.admin.mapping.ListToString) > >-from .__common import add_dhcp_options, add_dhcp_objectclass >+from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions > > add_dhcp_options( property_descriptions, mapping, layout ) > >-class object(univention.admin.handlers.simpleLdap): >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -100,24 +100,21 @@ class object(univention.admin.handlers.simpleLdap): > > return add_dhcp_objectclass( self, ml ) > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >- >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.conjunction('|', [ >- univention.admin.filter.expression('objectClass', 'dhcpService'), >- univention.admin.filter.expression('objectClass', 'univentionDhcpService') >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.conjunction('|', [ >+ univention.admin.filter.expression('objectClass', 'dhcpService'), >+ univention.admin.filter.expression('objectClass', 'univentionDhcpService') >+ ]) > ]) >- ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj >+ > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+lookup_filter = object.lookup_filter >+lookup = object.lookup > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res > > def identify(dn, attr): > return bool(set(('dhcpService', 'univentionDhcpService')) & set(attr.get('objectClass', []))) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index 12a86a4..42a64fe 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -72,7 +72,10 @@ layout = [ > mapping=univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > >-class object(univention.admin.handlers.simpleLdap): >+from .__common import DhcpOptions >+ >+ >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -94,21 +97,19 @@ class object(univention.admin.handlers.simpleLdap): > ('objectClass', ['top', 'dhcpSharedNetwork']) > ] > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): > >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'dhcpSharedNetwork') >- ]) >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'dhcpSharedNetwork') >+ ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj >+ > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+lookup_filter = object.lookup_filter >+lookup = object.lookup > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res > > def identify(dn, attr): > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index b11b5f7..23d1af1 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -102,7 +102,7 @@ layout = [ > ] > > >-from .__common import rangeMap, rangeUnmap >+from .__common import rangeMap, rangeUnmap, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) >@@ -114,7 +114,7 @@ from .__common import add_dhcp_options, add_dhcp_objectclass > > add_dhcp_options( property_descriptions, mapping, layout ) > >-class object(univention.admin.handlers.simpleLdap): >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -142,22 +142,19 @@ class object(univention.admin.handlers.simpleLdap): > > return add_dhcp_objectclass( self, ml ) > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'), >+ univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet') >+ ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj > >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'), >- univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet') >- ]) > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+lookup_filter = object.lookup_filter >+lookup = object.lookup > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res > > def identify(dn, attr): > return set(('univentionDhcpSubnet', 'univentionDhcpSharedSubnet')) <= set(attr.get('objectClass', [])) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index ab63db97..60e539c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -102,7 +102,7 @@ layout = [ > ] ), > ] > >-from .__common import rangeUnmap >+from .__common import rangeUnmap, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) >@@ -113,7 +113,7 @@ from .__common import add_dhcp_options, add_dhcp_objectclass > > add_dhcp_options( property_descriptions, mapping, layout ) > >-class object(univention.admin.handlers.simpleLdap): >+class object(DhcpOptions): > module=module > > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >@@ -175,22 +175,19 @@ class object(univention.admin.handlers.simpleLdap): > ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange)) > return add_dhcp_objectclass( self, ml ) > >-def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >+ @staticmethod >+ def lookup_filter(filter_s=None, lo=None): >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'), >+ univention.admin.filter.conjunction('!', [univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')]) >+ ]) >+ filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) >+ return filter_obj > >- filter=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'univentionDhcpSubnet'), >- univention.admin.filter.conjunction('!', [univention.admin.filter.expression('objectClass', 'univentionDhcpSharedSubnet')]) >- ]) > >- if filter_s: >- filter_p=univention.admin.filter.parse(filter_s) >- univention.admin.filter.walk(filter_p, univention.admin.mapping.mapRewrite, arg=mapping) >- filter.expressions.append(filter_p) >+lookup_filter = object.lookup_filter >+lookup = object.lookup > >- res=[] >- for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): >- res.append((object(co, lo, None, dn=dn, superordinate=superordinate, attributes = attrs ))) >- return res > > def identify(dn, attr): > ocs = set(attr.get('objectClass', [])) >-- >1.8.4.rc3 > > >From 00fe1ae83f5310744a71369c17eee0e22e2b51ab Mon Sep 17 00:00:00 2001 >Message-Id: <00fe1ae83f5310744a71369c17eee0e22e2b51ab.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:20:53 +0100 >Subject: [PATCH 11/17] Bug #33223: udm/dhcp: Prepare for modifying dhcp > options >Organization: Univention GmbH, Bremen, Germany > >Get the module through sys.module[] instead of passing in all the >option/properties/mapping/layout instances of the module. > >This simplifies the up-coming implementation to also handle options and >layout correctly. >--- > .../modules/univention/admin/handlers/dhcp/__common.py | 10 +++++++--- > .../modules/univention/admin/handlers/dhcp/host.py | 3 ++- > .../modules/univention/admin/handlers/dhcp/pool.py | 5 ++++- > .../modules/univention/admin/handlers/dhcp/server.py | 2 +- > .../modules/univention/admin/handlers/dhcp/service.py | 2 +- > .../modules/univention/admin/handlers/dhcp/shared.py | 3 ++- > .../modules/univention/admin/handlers/dhcp/sharedsubnet.py | 7 ++++--- > .../modules/univention/admin/handlers/dhcp/subnet.py | 7 ++++--- > 8 files changed, 25 insertions(+), 14 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index d59b6f7..9c5611a 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -30,6 +30,7 @@ > # /usr/share/common-licenses/AGPL-3; if not, see > # <http://www.gnu.org/licenses/>. > >+import sys > import copy > > import univention.admin.localization >@@ -65,10 +66,13 @@ _mappings = ( > ('option', 'dhcpOption', None, None), > ) > >-def add_dhcp_options( properties, mapping, layout ): >- for name, prop in _properties.items(): >- properties[ name ] = prop >+def add_dhcp_options(module_name): >+ module = sys.modules[module_name] > >+ properties = getattr(module, "property_descriptions") >+ properties.update(_properties) >+ >+ mapping = getattr(module, "mapping") > for item in _mappings: > mapping.register( *item ) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index 17911c2..a2f1c2c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -114,7 +114,8 @@ mapping.register('host', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress) > mapping.register('fixedaddress', 'univentionDhcpFixedAddress') > >-from .__common import DhcpOptions >+from .__common import add_dhcp_options, DhcpOptions >+add_dhcp_options(__name__) > > > class object(DhcpOptions): >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 2833895..3a5faad 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -141,13 +141,16 @@ layout = [ > ] > > >-from .__common import rangeMap, rangeUnmap, DhcpOptions >+from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) > mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString) > >+add_dhcp_options(__name__) >+ >+ > class object(DhcpOptions): > module=module > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index ed96d34..2c30ce3 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -74,8 +74,8 @@ mapping=univention.admin.mapping.mapping() > mapping.register('server', 'cn', None, univention.admin.mapping.ListToString) > > from .__common import add_dhcp_options >+add_dhcp_options(__name__) > >-add_dhcp_options( property_descriptions, mapping, layout ) > > class object(univention.admin.handlers.simpleLdap): > module=module >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index 93c399b..50cc0fc 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -72,8 +72,8 @@ mapping=univention.admin.mapping.mapping() > mapping.register('service', 'cn', None, univention.admin.mapping.ListToString) > > from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions >+add_dhcp_options(__name__) > >-add_dhcp_options( property_descriptions, mapping, layout ) > > class object(DhcpOptions): > module=module >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index 42a64fe..5acc9f0 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -72,7 +72,8 @@ layout = [ > mapping=univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > >-from .__common import DhcpOptions >+from .__common import add_dhcp_options, DhcpOptions >+add_dhcp_options(__name__) > > > class object(DhcpOptions): >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 23d1af1..d6067bd 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -102,7 +102,7 @@ layout = [ > ] > > >-from .__common import rangeMap, rangeUnmap, DhcpOptions >+from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) >@@ -110,9 +110,10 @@ mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) > mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString) > mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString) > >-from .__common import add_dhcp_options, add_dhcp_objectclass >+add_dhcp_options(__name__) >+ >+from .__common import add_dhcp_objectclass > >-add_dhcp_options( property_descriptions, mapping, layout ) > > class object(DhcpOptions): > module=module >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 60e539c..70bd5a2 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -102,16 +102,17 @@ layout = [ > ] ), > ] > >-from .__common import rangeUnmap, DhcpOptions >+from .__common import rangeUnmap, add_dhcp_options, DhcpOptions > > mapping=univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString) > mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString) > >-from .__common import add_dhcp_options, add_dhcp_objectclass >+add_dhcp_options(__name__) >+ >+from .__common import add_dhcp_objectclass > >-add_dhcp_options( property_descriptions, mapping, layout ) > > class object(DhcpOptions): > module=module >-- >1.8.4.rc3 > > >From 349abb2bb21d4d4eedb0a84e4e2e5512f2f64070 Mon Sep 17 00:00:00 2001 >Message-Id: <349abb2bb21d4d4eedb0a84e4e2e5512f2f64070.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:24:23 +0100 >Subject: [PATCH 12/17] Bug #33223: udm/dhcp: Handle options through common > super class >Organization: Univention GmbH, Bremen, Germany > >Implement option handling once and correctly: >1. On load determine the state of the option by checking the >objectClasses. >2. On option de-selection, force-remove the than invalid LDAP >attributes. >3. On save make sure the objectClass is added. > >Hide the option on the advanced tab, since adding invalid DHCP options >renders the DHCP daemon unstartable. >--- > .../univention/admin/handlers/dhcp/__common.py | 71 +++++++++++++++++----- > .../modules/univention/admin/handlers/dhcp/host.py | 1 + > .../modules/univention/admin/handlers/dhcp/pool.py | 1 + > .../univention/admin/handlers/dhcp/service.py | 10 +-- > .../univention/admin/handlers/dhcp/shared.py | 1 + > .../univention/admin/handlers/dhcp/sharedsubnet.py | 10 +-- > .../univention/admin/handlers/dhcp/subnet.py | 7 +-- > 7 files changed, 66 insertions(+), 35 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 9c5611a..0a7f714 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -31,8 +31,6 @@ > # <http://www.gnu.org/licenses/>. > > import sys >-import copy >- > import univention.admin.localization > from univention.admin.layout import Tab > from univention.admin.handlers import simpleLdap >@@ -40,13 +38,25 @@ from univention.admin.handlers import simpleLdap > translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' ) > _ = translation.translate > >+ >+_options = { >+ 'options': univention.admin.option( >+ short_description=_('Allow custom DHCP options'), >+ long_description=_("Allow adding custom DHCP options. Experts only!"), >+ default=False, >+ editable=True, >+ objectClasses=['dhcpOptions'], >+ ), >+} >+ >+ > _properties = { > 'option': univention.admin.property( > short_description = _( 'DHCP options' ), > long_description = _( 'Defines DHCP options for the subnet.' ), > syntax = univention.admin.syntax.string, > multivalue = True, >- options = [], >+ options = ["options"], > required = 0, > may_change = True, > identifies = 0 >@@ -66,9 +76,13 @@ _mappings = ( > ('option', 'dhcpOption', None, None), > ) > >+ > def add_dhcp_options(module_name): > module = sys.modules[module_name] > >+ options = getattr(module, "options") >+ options.update(_options) >+ > properties = getattr(module, "property_descriptions") > properties.update(_properties) > >@@ -76,8 +90,13 @@ def add_dhcp_options(module_name): > for item in _mappings: > mapping.register( *item ) > >- # currently not visible >- #layout.append( Tab( _( 'Advanced' ), _( 'Advanced DHCP options' ), layout = [ 'option' ] ) ) >+ layout = getattr(module, "layout") >+ layout.append(Tab( >+ _('DHCP options'), >+ _('Custom DHCP options'), >+ advanced=True, >+ layout=['option'] >+ )) > > > class SimpleDhcp(simpleLdap): >@@ -92,14 +111,34 @@ class SimpleDhcp(simpleLdap): > > > class DhcpOptions(SimpleDhcp): >- pass >- >- >-def add_dhcp_objectclass( self, ml ): >- oldOCs = self.oldattr.get( 'objectClass', [] ) >- newOCs = copy.copy( oldOCs ) >- if self.info.get( 'option', [] ) and not 'dhcpOptions' in oldOCs: >- newOCs.append( 'dhcpOptions' ) >- ml.append( ( 'objectClass', oldOCs, newOCs ) ) >- >- return ml >+ def setup_options(self, options): >+ self.options = [] >+ self._define_options(options) >+ >+ def open(self): >+ super(DhcpOptions, self).open() >+ try: >+ ocs = self.oldattr['objectClass'] >+ if "dhcpOptions" in ocs: >+ self.options.append("options") >+ except LookupError: >+ pass >+ self.old_options = list(self.options) >+ >+ def _ldap_modlist(self): >+ if "options" not in self.options: >+ del self.info.get('option', [])[:] >+ >+ mod_list = super(DhcpOptions, self)._ldap_modlist() >+ >+ old_ocs = self.oldattr.get('objectClass', []) >+ if self.info.get('option', []): >+ if 'dhcpOptions' not in old_ocs: >+ new_ocs = old_ocs + ['dhcpOptions'] >+ mod_list.append(('objectClass', old_ocs, new_ocs)) >+ elif "options" not in self.options and 'dhcpOptions' in old_ocs: >+ new_ocs = list(old_ocs) >+ new_ocs.remove("dhcpOptions") >+ mod_list.append(('objectClass', old_ocs, new_ocs)) >+ >+ return mod_list >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index a2f1c2c..22deada 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -131,6 +131,7 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >+ self.setup_options(options) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 3a5faad..f06959b 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -164,6 +164,7 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >+ self.setup_options(options) > > def open(self): > super(object, self).open() >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index 50cc0fc..8e37357 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -71,7 +71,7 @@ layout = [ > mapping=univention.admin.mapping.mapping() > mapping.register('service', 'cn', None, univention.admin.mapping.ListToString) > >-from .__common import add_dhcp_options, add_dhcp_objectclass, DhcpOptions >+from .__common import add_dhcp_options, DhcpOptions > add_dhcp_options(__name__) > > >@@ -86,20 +86,16 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >+ self.setup_options(options) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn()) > > def _ldap_addlist(self): > return [ >- ('objectClass', [ 'top', 'univentionDhcpService', 'dhcpOptions' ] ), >+ ('objectClass', ['top', 'univentionDhcpService']), > ] > >- def _ldap_modlist(self): >- ml = univention.admin.handlers.simpleLdap._ldap_modlist( self ) >- >- return add_dhcp_objectclass( self, ml ) >- > @staticmethod > def lookup_filter(filter_s=None, lo=None): > filter_obj = univention.admin.filter.conjunction('&', [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index 5acc9f0..ed68cfd 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -89,6 +89,7 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >+ self.setup_options(options) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn()) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index d6067bd..7d79e74 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -112,8 +112,6 @@ mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, uni > > add_dhcp_options(__name__) > >-from .__common import add_dhcp_objectclass >- > > class object(DhcpOptions): > module=module >@@ -129,20 +127,16 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >+ self.setup_options(options) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn()) > > def _ldap_addlist(self): > return [ >- ('objectClass', ['top', 'univentionDhcpSubnet', 'univentionDhcpSharedSubnet', 'dhcpOptions' ]), >+ ('objectClass', ['top', 'univentionDhcpSubnet', 'univentionDhcpSharedSubnet']), > ] > >- def _ldap_modlist(self): >- ml = univention.admin.handlers.simpleLdap._ldap_modlist( self ) >- >- return add_dhcp_objectclass( self, ml ) >- > @staticmethod > def lookup_filter(filter_s=None, lo=None): > filter_obj = univention.admin.filter.conjunction('&', [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 70bd5a2..35ae5a2 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -111,8 +111,6 @@ mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, uni > > add_dhcp_options(__name__) > >-from .__common import add_dhcp_objectclass >- > > class object(DhcpOptions): > module=module >@@ -128,7 +126,7 @@ class object(DhcpOptions): > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) >- >+ self.setup_options(options) > > def open(self): > super(object, self).open() >@@ -174,7 +172,8 @@ class object(DhcpOptions): > if '' in dhcpRange: > dhcpRange.remove('') > ml.append(('dhcpRange', self.oldattr.get('dhcpRange', []), dhcpRange)) >- return add_dhcp_objectclass( self, ml ) >+ >+ return ml > > @staticmethod > def lookup_filter(filter_s=None, lo=None): >-- >1.8.4.rc3 > > >From 4142d6bbf6ca7af7c3b6c3c6d2e727ace5785227 Mon Sep 17 00:00:00 2001 >Message-Id: <4142d6bbf6ca7af7c3b6c3c6d2e727ace5785227.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:25:00 +0100 >Subject: [PATCH 13/17] Bug #33223: udm/dhcp/pool: Simplify allow/deny >Organization: Univention GmbH, Bremen, Germany > >Use loop instead of unrolled implementation to handle all allow/deny >variants the same. >--- > .../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++------------- > 1 file changed, 24 insertions(+), 34 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index f06959b..315c33e 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -154,6 +154,14 @@ add_dhcp_options(__name__) > class object(DhcpOptions): > module=module > >+ permits_udm2dhcp = { >+ 'known_clients': "known clients", >+ 'unknown_clients': "unknown clients", >+ 'dynamic_bootp_clients': "dynamic bootp clients", >+ 'all_clients': "all clients", >+ } >+ permits_dhcp2udm = dict((value, key) for (key, value) in permits_udm2dhcp.items()) >+ > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): > self.mapping=mapping > self.descriptions=property_descriptions >@@ -170,17 +178,9 @@ class object(DhcpOptions): > super(object, self).open() > > for i in self.oldattr.get('dhcpPermitList', []): >- pos=i.find(' ') >- permit=i[:pos] >- name=i[pos+1:] >- if name == 'known clients': >- self['known_clients']=permit >- elif name == 'unknown clients': >- self['unknown_clients']=permit >- elif name == 'dynamic bootp clients': >- self['dynamic_bootp_clients']=permit >- elif name == 'all clients': >- self['all_clients']=permit >+ permit, name = i.split(' ', 1) >+ prop = self.permits_dhcp2udm[name] >+ self[prop] = permit > > self.save() > >@@ -192,33 +192,23 @@ class object(DhcpOptions): > return [ > ('objectClass', ['top', 'univentionDhcpPool']), > ] >- >+ > def _ldap_modlist(self): > ml = super(object, self)._ldap_modlist() >- if self.hasChanged(['known_clients', 'unknown_clients', 'dynamic_bootp_clients', 'all_clients']): >+ if self.hasChanged(self.permits_udm2dhcp.keys()): > old=self.oldattr.get('dhcpPermitList', []) > new=copy.deepcopy(old) >- >- if self.oldinfo.has_key('known_clients') and self.oldinfo['known_clients']: >- new.remove(self.oldinfo['known_clients']+' known clients') >- if self.info.has_key('known_clients') and self.info['known_clients']: >- new.append(self.info['known_clients']+' known clients') >- >- if self.oldinfo.has_key('unknown_clients') and self.oldinfo['unknown_clients']: >- new.remove(self.oldinfo['unknown_clients']+' unknown clients') >- if self.info.has_key('unknown_clients') and self.info['unknown_clients']: >- new.append(self.info['unknown_clients']+' unknown clients') >- >- if self.oldinfo.has_key('dynamic_bootp_clients') and self.oldinfo['dynamic_bootp_clients']: >- new.remove(self.oldinfo['dynamic_bootp_clients']+' dynamic bootp clients') >- if self.info.has_key('dynamic_bootp_clients') and self.info['dynamic_bootp_clients']: >- new.append(self.info['dynamic_bootp_clients']+' dynamic bootp clients') >- >- if self.oldinfo.has_key('all_clients') and self.oldinfo['all_clients']: >- new.remove(self.oldinfo['all_clients']+' all clients') >- if self.info.has_key('all_clients') and self.info['all_clients']: >- new.append(self.info['all_clients']+' all clients') >- >+ for prop, value in self.permits_udm2dhcp.items(): >+ try: >+ permit = self.oldinfo[prop] >+ new.remove("%s %s" % (permit, value)) >+ except LookupError: >+ pass >+ try: >+ permit = self.info[prop] >+ new.append("%s %s" % (permit, value)) >+ except LookupError: >+ pass > ml.append(('dhcpPermitList', old, new)) > if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny': > raise univention.admin.uexceptions.bootpXORFailover >-- >1.8.4.rc3 > > >From 29354d0216a040684c7985738204bc7df3c57af7 Mon Sep 17 00:00:00 2001 >Message-Id: <29354d0216a040684c7985738204bc7df3c57af7.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:25:28 +0100 >Subject: [PATCH 14/17] Bug #33223: udm/dhcp/subnet: code cleanup >Organization: Univention GmbH, Bremen, Germany > >Use True/False instead of 1/0. > >Calculate once and assign twice. >--- > .../modules/univention/admin/handlers/dhcp/subnet.py | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 35ae5a2..cbaf7b8 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -130,9 +130,7 @@ class object(DhcpOptions): > > def open(self): > super(object, self).open() >- self.info['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) ) >- self.oldinfo['range'] = rangeUnmap( self.oldattr.get('dhcpRange', []) ) >- >+ self.info['range'] = self.oldinfo['range'] = rangeUnmap(self.oldattr.get('dhcpRange', [])) > > def _ldap_pre_create(self): > self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn()) >@@ -153,10 +151,10 @@ class object(DhcpOptions): > if i != j and univention.admin.ipaddress.is_range_overlapping(i, j): > raise univention.admin.uexceptions.rangesOverlapping, '%s-%s; %s-%s' % (i[0], i[1], j[0], j[1]) > >- ip_in_network=1 >+ ip_in_network = True > for j in i: > if not univention.admin.ipaddress.ip_is_in_network(self['subnet'], self['subnetmask'], j): >- ip_in_network=0 >+ ip_in_network = False > > if univention.admin.ipaddress.ip_is_network_address(self['subnet'], self['subnetmask'], j): > raise univention.admin.uexceptions.rangeInNetworkAddress, '%s-%s' % (i[0], i[1]) >-- >1.8.4.rc3 > > >From 38d0ed7d88b0605a7c27270c67ee20b89dcd5f73 Mon Sep 17 00:00:00 2001 >Message-Id: <38d0ed7d88b0605a7c27270c67ee20b89dcd5f73.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:25:28 +0100 >Subject: [PATCH 15/17] Bug #33223: udm/dhcp/host: univention.debug >Organization: Univention GmbH, Bremen, Germany > >Shorten univention.debug to ud. >--- > .../modules/univention/admin/handlers/dhcp/host.py | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index 22deada..fa66aa6 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -34,7 +34,7 @@ from univention.admin.layout import Tab, Group > import univention.admin.filter > import univention.admin.handlers > import univention.admin.localization >-import univention.debug >+import univention.debug as ud > > translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') > _=translation.translate >@@ -94,13 +94,13 @@ layout=[ > ] > > def unmapHWAddress(old): >- univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'host.py: unmapHWAddress: old: %s' % old) >+ ud.debug(ud.ADMIN, ud.INFO, 'host.py: unmapHWAddress: old: %s' % old) > if not old: > return ['', ''] > return old[0].split(' ') > > def mapHWAddress(old): >- univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'host.py: mapHWAddress: old: %s' % old) >+ ud.debug(ud.ADMIN, ud.INFO, 'host.py: mapHWAddress: old: %s' % old) > if not old[0]: > return '' > else: >-- >1.8.4.rc3 > > >From 3f71e19574ee6d26b3014b0c5f1c73c217f83dcd Mon Sep 17 00:00:00 2001 >Message-Id: <3f71e19574ee6d26b3014b0c5f1c73c217f83dcd.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:25:28 +0100 >Subject: [PATCH 16/17] Bug #33223: udm/dhcp: white space changes >Organization: Univention GmbH, Bremen, Germany > >pep8 >--- > .../modules/univention/admin/handlers/__init__.py | 47 ++--- > .../univention/admin/handlers/dhcp/__common.py | 18 +- > .../modules/univention/admin/handlers/dhcp/dhcp.py | 114 ++++++------ > .../modules/univention/admin/handlers/dhcp/host.py | 122 +++++++------ > .../modules/univention/admin/handlers/dhcp/pool.py | 193 +++++++++++---------- > .../univention/admin/handlers/dhcp/server.py | 89 +++++----- > .../univention/admin/handlers/dhcp/service.py | 68 ++++---- > .../univention/admin/handlers/dhcp/shared.py | 70 ++++---- > .../univention/admin/handlers/dhcp/sharedsubnet.py | 126 +++++++------- > .../univention/admin/handlers/dhcp/subnet.py | 133 +++++++------- > 10 files changed, 510 insertions(+), 470 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index df36936..b534cf2 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -63,6 +63,7 @@ s4connector_search = False > # FIXME: What is the use of the following line? > # __path__.append("users") > >+ > # manages properties > class base(object): > def __init__(self, co, lo, position, dn='', superordinate = None ): >@@ -298,7 +299,6 @@ class base(object): > return self.descriptions.keys() > > def items(self): >- > # this returns emtpy strings resp. empty lists for attributes not set > r=[] > for key in self.keys(): >@@ -455,7 +455,6 @@ class base(object): > > > class simpleLdap(base): >- > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): > global s4connector_present > global s4connector_search >@@ -527,7 +526,7 @@ class simpleLdap(base): > def description(self): > if self.dn: > rdn = self.lo.explodeDn(self.dn)[0] >- return rdn[rdn.find('=')+1:] >+ return rdn[rdn.find('=') + 1:] > else: > return 'none' > >@@ -584,7 +583,6 @@ class simpleLdap(base): > ml.append(('objectClass', self.oldattr.get('objectClass', []), self.oldattr.get('objectClass', [])+['univentionPolicyReference'])) > ml.append(('univentionPolicyReference', self.oldpolicies, self.policies)) > >- > return ml > > def _create(self): >@@ -709,7 +707,7 @@ class simpleLdap(base): > self.save() > return self.dn > >-#+++# MODIFY #+++# >+ #+++# MODIFY #+++# > def _modify(self, modify_childs=1, ignore_license=0): > self.exceptions=[] > >@@ -734,7 +732,7 @@ class simpleLdap(base): > # iterate over all properties and call checkLdap() of corresponding syntax > self._call_checkLdap_on_all_property_syntaxes() > >-#+++# MODLIST #+++# >+ #+++# MODLIST #+++# > ml=self._ldap_modlist() > # custom attributes > m=univention.admin.modules.get(self.module) >@@ -771,7 +769,6 @@ class simpleLdap(base): > ml.remove(i) > ml.extend( addlist ) > >- > else: > if deleteObjectClass == '1' and not self.info.has_key(pname): > # value is empty, should delete objectClass and Values >@@ -819,7 +816,6 @@ class simpleLdap(base): > ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) ) > > else: >- > if prop.syntax == 'boolean' and self.info.has_key(prop.name) and self.info[prop.name] == '0': > # syntax is boolean and value == 0 ==> remove > dellist = [] >@@ -1396,13 +1392,12 @@ class simpleComputer( simpleLdap ): > object[ 'host' ] = object[ 'host' ].replace( old_name, new_name ) > object.modify( ) > >- > def __remove_from_dhcp_object( self, position = None, name = None, oldname = None, mac = None, ip = None ): > # if we got the mac addres, then we remove the object > # if we only got the ip addres, we remove the ip address > > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dhcp object: position="%s", name="%s", oldname="%s", mac="%s", ip="%s"' % ( position, name, oldname, mac, ip ) ) >- >+ > dn = None > > tmppos = univention.admin.uldap.position( self.position.getDomain( ) ) >@@ -1482,11 +1477,10 @@ class simpleComputer( simpleLdap ): > for dn2, attributes2 in self.lo.search(scope='domain', attr=[ 'zoneName' ], filter='(&(relativeDomainName=%s)(objectClass=dNSZone))' % name, unique=0 ): > self.lo.modify( dn, [('pTRRecord', '%s.%s.' % (name, attributes2['zoneName'][0]), '')] ) > >- zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN) >+ zone = univention.admin.handlers.dns.reverse_zone.object( self.co, self.lo, self.position, zoneDN) > zone.open() > zone.modify() > >- > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'we should remove a dns reverse object: dnsEntryZoneReverse="%s", name="%s", ip="%s"' % ( dnsEntryZoneReverse, name, ip ) ) > if dnsEntryZoneReverse: > rdn = self.calc_dns_reverse_entry_name( ip, dnsEntryZoneReverse ) >@@ -1632,8 +1626,6 @@ class simpleComputer( simpleLdap ): > for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): > self.lo.modify(dn, [('pTRRecord', '', ptrrecord)]) > >- >- > def __remove_related_ptrrecords(self, zoneDN, ip): > ptrrecord = '%s.%s.' % (self.info['name'], zoneDN.split('=')[1].split(',')[0]) > ip_split = ip.split('.') >@@ -1643,7 +1635,6 @@ class simpleComputer( simpleLdap ): > for dn, attributes in self.lo.search(base=zoneDN, scope='domain', attr=['pTRRecord'], filter=search_filter): > if ptrrecord in attributes['pTRRecord']: > self.lo.modify(dn, [('pTRRecord', ptrrecord, '')]) >- > > def check_common_name_length(self): > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'check_common_name_length with self["ip"] = %r and self["dnsEntryZoneForward"] = %r' % (self['ip'], self['dnsEntryZoneForward'], )) >@@ -1767,7 +1758,6 @@ class simpleComputer( simpleLdap ): > else: > self.lo.modify( dn, [ ( 'aRecord', '' , ip ) ] ) > >- > def __add_dns_alias_object( self, name, dnsForwardZone, dnsAliasZoneContainer, alias ): > univention.debug.debug( univention.debug.ADMIN, univention.debug.INFO, 'add a dns alias object: name="%s", dnsForwardZone="%s", dnsAliasZoneContainer="%s", alias="%s"' % ( name, dnsForwardZone, dnsAliasZoneContainer, alias ) ) > if name and dnsForwardZone and dnsAliasZoneContainer and alias: >@@ -1832,7 +1822,6 @@ class simpleComputer( simpleLdap ): > pass > > def _ldap_post_modify( self ): >- > self.__multiip |= len(self['mac']) > 1 or len(self['ip']) > 1 > > for entry in self.__changes[ 'dhcpEntryZone' ][ 'remove' ]: >@@ -1886,7 +1875,6 @@ class simpleComputer( simpleLdap ): > else: > self.__add_dns_reverse_object( self[ 'name' ], dn, ip ) > >- > for entry in self.__changes[ 'dnsEntryZoneAlias' ][ 'remove' ]: > dnsForwardZone, dnsAliasZoneContainer, alias = entry > if not alias: >@@ -1976,7 +1964,6 @@ class simpleComputer( simpleLdap ): > if not self.info.get('domain', None): > self.info['domain'] = domain > >- > def _ldap_modlist( self ): > self.__changes = { 'mac': {'remove': [ ], 'add': [ ]}, 'ip': {'remove': [ ], 'add': [ ]}, 'name': None, > 'dnsEntryZoneForward': { 'remove': [ ], 'add': [ ] }, >@@ -2014,13 +2001,13 @@ class simpleComputer( simpleLdap ): > newAaaaRecord = [] > if oldAddresses != newAddresses: > if oldAddresses: >- for address in oldAddresses: >+ for address in oldAddresses: > if ':' in address: # IPv6 > oldAaaaRecord.append(address) > else: > oldARecord.append(address) > if newAddresses: >- for address in newAddresses: >+ for address in newAddresses: > if ':' in address: # IPv6 > newAaaaRecord.append(ipaddr.IPv6Address(address).exploded) > else: >@@ -2060,19 +2047,17 @@ class simpleComputer( simpleLdap ): > continue > self.__changes[ 'ip' ][ 'remove' ].append( ipAddress ) > >- > if self.hasChanged( 'name' ): > ml.append( ( 'sn', self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) ) > self.__changes[ 'name' ] = ( self.oldattr.get( 'sn', [ None ] )[ 0 ], self[ 'name' ] ) > > if self.hasChanged('ip') or self.hasChanged('mac'): >- > if len(self.info.get('ip', [])) == 1 and len(self.info.get('mac', [])) == 1 and len(self.info.get('dhcpEntryZone', [])): > # In this special case, we assume the mapping between ip/mac address to be > # unique. The dhcp entry needs to contain the mac address (as sepcified by >- # the ldap search for dhcp entries), the ip address may not correspond to >- # the ip address associated with the computer ldap object, but this would >- # be erroneous anyway. We therefore update the dhcp entry to correspond to >+ # the ldap search for dhcp entries), the ip address may not correspond to >+ # the ip address associated with the computer ldap object, but this would >+ # be erroneous anyway. We therefore update the dhcp entry to correspond to > # the current ip and mac address. (Bug #20315) > dn, ip, mac = self.__split_dhcp_line( self.info['dhcpEntryZone'][0] ) > >@@ -2173,6 +2158,7 @@ class simpleComputer( simpleLdap ): > subnet=ldap.explode_dn(reverseDN, 1)[0].replace('.in-addr.arpa','').split('.') > ip=sip.split('.') > return self.calc_dns_reverse_entry_name_do(4, subnet, ip) >+ > def calc_dns_reverse_entry_name_do(self, maxLength, zoneNet, ip): > zoneNet.reverse() > if not ip[:len(zoneNet)] == zoneNet: >@@ -2204,7 +2190,6 @@ class simpleComputer( simpleLdap ): > else: > self.__modify_dhcp_object( dn, self[ 'name' ], ip, mac ) > >- > for entry in self.__changes[ 'dnsEntryZoneForward' ][ 'remove' ]: > dn, ip = self.__split_dns_line( entry ) > if not ip and not self.__multiip: >@@ -2296,7 +2281,6 @@ class simpleComputer( simpleLdap ): > groupObject = univention.admin.objects.get(univention.admin.modules.get('groups/group'), self.co, self.lo, self.position, group) > groupObject.fast_member_remove( [ self.dn ], self.oldattr.get('uid',[]), ignore_license=1 ) > >- > def __update_groups_after_namechange(self): > oldname = self.oldinfo.get('name') > newname = self.info.get('name') >@@ -2338,7 +2322,6 @@ class simpleComputer( simpleLdap ): > > self.lo.modify(group, [('uniqueMember', oldUniqueMembers, newUniqueMembers), ('memberUid', oldMemberUids, newMemberUids)]) > >- > def update_groups(self): > if not self.hasChanged('groups') and \ > not ('oldPrimaryGroupDn' in self.__dict__ and self.oldPrimaryGroupDn) and \ >@@ -2382,7 +2365,6 @@ class simpleComputer( simpleLdap ): > groupObject['hosts'].remove(self.dn) > groupObject.modify(ignore_license=1) > >- > def primary_group(self): > if not self.hasChanged('primaryGroup'): > return >@@ -2560,8 +2542,8 @@ class simpleComputer( simpleLdap ): > if raise_after: > raise raise_after > >-class simpleLdapSub(simpleLdap): > >+class simpleLdapSub(simpleLdap): > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): > base.__init__(self, co, lo, position, dn, superordinate ) > >@@ -2580,9 +2562,9 @@ class simpleLdapSub(simpleLdap): > if hasattr(self,"_ldap_post_remove"): > self._ldap_post_remove() > >+ > class simplePolicy(simpleLdap): > def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- > self.resultmode=0 > self.dn=dn > >@@ -2765,7 +2747,6 @@ class simplePolicy(simpleLdap): > self.policy_result() > > if self.polinfo.has_key(key): >- > if self.polinfo[key] != newvalue or self.polinfo_more[key]['policy'] == self.cloned or ( self.info.has_key( key ) and self.info[ key ] != newvalue ): > if self.polinfo_more[key]['fixed'] and self.polinfo_more[key]['policy'] != self.cloned: > raise univention.admin.uexceptions.policyFixedAttribute, key >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 0a7f714..60f1a7b 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -35,7 +35,7 @@ import univention.admin.localization > from univention.admin.layout import Tab > from univention.admin.handlers import simpleLdap > >-translation = univention.admin.localization.translation( 'univention.admin.handlers.dhcp' ) >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') > _ = translation.translate > > >@@ -52,15 +52,15 @@ _options = { > > _properties = { > 'option': univention.admin.property( >- short_description = _( 'DHCP options' ), >- long_description = _( 'Defines DHCP options for the subnet.' ), >- syntax = univention.admin.syntax.string, >- multivalue = True, >- options = ["options"], >+ short_description=_('DHCP options'), >+ long_description=_('Defines additional DHCP options.'), >+ syntax=univention.admin.syntax.string, >+ multivalue=True, >+ options=["options"], > required = 0, >- may_change = True, >+ may_change=True, > identifies = 0 >- ), >+ ), > } > > >@@ -88,7 +88,7 @@ def add_dhcp_options(module_name): > > mapping = getattr(module, "mapping") > for item in _mappings: >- mapping.register( *item ) >+ mapping.register(*item) > > layout = getattr(module, "layout") > layout.append(Tab( >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >index 45594d0..0eae5c5 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >@@ -44,75 +44,87 @@ import univention.admin.handlers.dhcp.sharedsubnet > import univention.admin.handlers.dhcp.subnet > > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >- >-module='dhcp/dhcp' >- >-childs=0 >-short_description=_('DHCP') >-long_description='' >-operations=['search'] >-usewizard=1 >-wizardmenustring=_("DHCP") >-wizarddescription=_("Add, edit and delete DHCP objects") >-wizardoperations={"add":[_("Add"), _("Add DHCP object")],"find":[_("Search"), _("Search DHCP object(s)")]} >-wizardpath="univentionDhcpObject" >-wizardsuperordinates = ( 'None', 'dhcp/service', 'dhcp/shared' ) >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+ >+module = 'dhcp/dhcp' >+ >+childs = 0 >+short_description = _('DHCP') >+long_description = '' >+operations = ['search'] >+usewizard = 1 >+wizardmenustring = _("DHCP") >+wizarddescription = _("Add, edit and delete DHCP objects") >+wizardoperations = { >+ "add": [_("Add"), _("Add DHCP object")], >+ "find": [_("Search"), _("Search DHCP object(s)")], >+} >+wizardpath = "univentionDhcpObject" >+wizardsuperordinates = ('None', 'dhcp/service', 'dhcp/shared') > wizardtypesforsuper = { >- 'None' : ( 'dhcp/service', ), >- 'dhcp/service' : ( 'dhcp/host', 'dhcp/server', 'dhcp/shared', 'dhcp/subnet' ), >- 'dhcp/shared' : ( 'dhcp/sharedsubnet', ) >- } >- >-childmodules=["dhcp/host","dhcp/pool","dhcp/server","dhcp/service","dhcp/shared","dhcp/sharedsubnet","dhcp/subnet"] >-virtual=1 >-options={ >+ 'None': ('dhcp/service',), >+ 'dhcp/service': ('dhcp/host', 'dhcp/server', 'dhcp/shared', 'dhcp/subnet'), >+ 'dhcp/shared': ('dhcp/sharedsubnet',) >+} >+ >+childmodules = [ >+ "dhcp/host", >+ "dhcp/pool", >+ "dhcp/server", >+ "dhcp/service", >+ "dhcp/shared", >+ "dhcp/sharedsubnet", >+ "dhcp/subnet", >+] >+virtual = 1 >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'name': univention.admin.property( >- short_description=_('Name'), >- long_description='', >- syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=1, >- identifies=1 >- ) >+ short_description=_('Name'), >+ long_description='', >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=1 >+ ) > } > >-layout = [ Tab( _( 'General' ), _( 'Basic settings' ), layout = [ "name" ] ) ] >+layout = [Tab(_('General'), _('Basic settings'), layout=["name"])] > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > > > class object(univention.admin.handlers.simpleLdap): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > > def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, required=0, timeout=-1, sizelimit=0): >- ret=[] >+ ret = [] > if superordinate: >- ret+= univention.admin.handlers.dhcp.host.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >- ret+= univention.admin.handlers.dhcp.pool.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >- ret+=univention.admin.handlers.dhcp.server.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >- ret+= univention.admin.handlers.dhcp.shared.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >- ret+= univention.admin.handlers.dhcp.sharedsubnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >- ret+= univention.admin.handlers.dhcp.subnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.host.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.pool.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.server.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.shared.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.sharedsubnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.subnet.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) > else: >- ret+= univention.admin.handlers.dhcp.service.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) >+ ret += univention.admin.handlers.dhcp.service.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) > return ret > >+ > def identify(dn, attr, canonical=0): > pass >- >- >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index fa66aa6..c57a1f3 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -36,80 +36,88 @@ import univention.admin.handlers > import univention.admin.localization > import univention.debug as ud > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/host' >-operations=['add','edit','remove','search'] >-superordinate='dhcp/service' >-childs=0 >-usewizard=1 >-short_description=_('DHCP: Host') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/host' >+operations = ['add', 'edit', 'remove', 'search'] >+superordinate = 'dhcp/service' >+childs = 0 >+usewizard = 1 >+short_description = _('DHCP: Host') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'host': univention.admin.property( >- short_description=_('Hostname'), >- long_description='', >- syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=1, >- identifies=1 >- ), >+ short_description=_('Hostname'), >+ long_description='', >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=1 >+ ), > 'hwaddress': univention.admin.property( >- short_description=_('Hardware address'), >- long_description=_('Currently, only the ethernet and token-ring types are recognized. \ >-The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'), >- syntax=univention.admin.syntax.DHCP_HardwareAddress, >- multivalue=0, >- options=[], >- required=1, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Hardware address'), >+ long_description=_( >+ 'Currently, only the ethernet and token-ring types are recognized.' >+ 'The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'), >+ syntax=univention.admin.syntax.DHCP_HardwareAddress, >+ multivalue=0, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=0 >+ ), > 'fixedaddress': univention.admin.property( >- short_description=_('Fixed IP addresses'), >- long_description=_('Assign one or more fixed IP addresses. \ >-Each address should be either an IP address or a domain name that resolves to one or more IP addresses'), >- syntax=univention.admin.syntax.string, >- multivalue=1, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Fixed IP addresses'), >+ long_description=_( >+ 'Assign one or more fixed IP addresses.' >+ 'Each address should be either an IP address or a domain name that resolves to one or more IP addresses'), >+ syntax=univention.admin.syntax.string, >+ multivalue=1, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > } >-layout=[ >- Tab( _('General'), _('Basic settings'), layout = [ >- Group( _( 'General' ), layout = [ >+ >+layout = [ >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ > 'host', > 'hwaddress', > 'fixedaddress' >- ] ), >- ] ) >+ ]), >+ ]) > ] > >+ > def unmapHWAddress(old): > ud.debug(ud.ADMIN, ud.INFO, 'host.py: unmapHWAddress: old: %s' % old) > if not old: > return ['', ''] > return old[0].split(' ') > >+ > def mapHWAddress(old): > ud.debug(ud.ADMIN, ud.INFO, 'host.py: mapHWAddress: old: %s' % old) > if not old[0]: > return '' > else: >- if len (old) > 1: >+ if len(old) > 1: > return '%s %s' % (old[0], old[1]) > else: > return old > >-mapping=univention.admin.mapping.mapping() >+ >+mapping = univention.admin.mapping.mapping() > mapping.register('host', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('hwaddress', 'dhcpHWAddress', mapHWAddress, unmapHWAddress) > mapping.register('fixedaddress', 'univentionDhcpFixedAddress') >@@ -119,11 +127,11 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -134,7 +142,11 @@ class object(DhcpOptions): > self.setup_options(options) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('host'), mapping.mapValue('host', self.info['host']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('host'), >+ mapping.mapValue('host', self.info['host']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): > return [ >@@ -153,6 +165,6 @@ class object(DhcpOptions): > lookup_filter = object.lookup_filter > lookup = object.lookup > >-def identify(dn, attr): > >+def identify(dn, attr): > return 'univentionDhcpHost' in attr.get('objectClass', []) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 315c33e..86dccaa 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -38,112 +38,114 @@ import univention.admin.handlers > import univention.admin.localization > import univention.admin.uexceptions > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate > >-module='dhcp/pool' >-operations=['add','edit','remove','search'] >+module = 'dhcp/pool' >+operations = ['add', 'edit', 'remove', 'search'] > superordinate = 'dhcp/subnet' >-childs=0 >-usewizard=1 >-short_description=_('DHCP: Pool') >-long_description='' >-options={ >+childs = 0 >+usewizard = 1 >+short_description = _('DHCP: Pool') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'name': univention.admin.property( >- short_description=_('Name'), >- long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'), >- syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=0, >- identifies=1 >- ), >+ short_description=_('Name'), >+ long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'), >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=0, >+ identifies=1 >+ ), > 'range': univention.admin.property( >- short_description=_('IP range for dynamic assignment'), >- long_description='', >- syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >- options=[], >- required=1, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('IP range for dynamic assignment'), >+ long_description='', >+ syntax=univention.admin.syntax.IPv4_AddressRange, >+ multivalue=1, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=0 >+ ), > 'failover_peer': univention.admin.property( >- short_description=_('Failover peer'), >- long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'), >- syntax=univention.admin.syntax.string, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0, >- ), >+ short_description=_('Failover peer'), >+ long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'), >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0, >+ ), > 'known_clients': univention.admin.property( >- short_description=_('Give IP to known clients'), >- long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'), >- syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Give IP to known clients'), >+ long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'), >+ syntax=univention.admin.syntax.AllowDeny, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > 'unknown_clients': univention.admin.property( >- short_description=_('Give IP to unknown clients'), >- long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'), >- syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Give IP to unknown clients'), >+ long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'), >+ syntax=univention.admin.syntax.AllowDeny, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > 'dynamic_bootp_clients': univention.admin.property( >- short_description=_('Give IP to dynamic BOOTP clients'), >- long_description=_( >- 'Give addresses to clients using the legacy BOOTP protocol.' >- 'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'), >- syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Give IP to dynamic BOOTP clients'), >+ long_description=_( >+ 'Give addresses to clients using the legacy BOOTP protocol.' >+ 'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'), >+ syntax=univention.admin.syntax.AllowDeny, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > 'all_clients': univention.admin.property( >- short_description=_('Give IP from this pool'), >- long_description=_('Give addresses from this pool at all or not.'), >- syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Give IP from this pool'), >+ long_description=_('Give addresses from this pool at all or not.'), >+ syntax=univention.admin.syntax.AllowDeny, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > } > > layout = [ >- Tab(_('General'), _('Basic settings'), layout = [ >- Group( _( 'General' ), layout = [ >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ > 'name', > 'range' >- ] ), >- ] ), >- Tab( _( 'Advanced' ), _('Advanced DHCP pool options'), advanced = True, layout = [ >+ ]), >+ ]), >+ Tab(_('Advanced'), _('Advanced DHCP pool options'), advanced=True, layout=[ > 'failover_peer', >- [ 'known_clients', 'unknown_clients' ], >- [ 'dynamic_bootp_clients', 'all_clients' ] >- ] ) >+ ['known_clients', 'unknown_clients'], >+ ['dynamic_bootp_clients', 'all_clients'] >+ ]) > ] > > > from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) > mapping.register('failover_peer', 'univentionDhcpFailoverPeer', None, univention.admin.mapping.ListToString) >@@ -152,7 +154,7 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > > permits_udm2dhcp = { > 'known_clients': "known clients", >@@ -162,9 +164,9 @@ class object(DhcpOptions): > } > permits_dhcp2udm = dict((value, key) for (key, value) in permits_udm2dhcp.items()) > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -184,9 +186,12 @@ class object(DhcpOptions): > > self.save() > >- > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('name'), >+ mapping.mapValue('name', self.info['name']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): > return [ >@@ -196,8 +201,8 @@ class object(DhcpOptions): > def _ldap_modlist(self): > ml = super(object, self)._ldap_modlist() > if self.hasChanged(self.permits_udm2dhcp.keys()): >- old=self.oldattr.get('dhcpPermitList', []) >- new=copy.deepcopy(old) >+ old = self.oldattr.get('dhcpPermitList', []) >+ new = copy.deepcopy(old) > for prop, value in self.permits_udm2dhcp.items(): > try: > permit = self.oldinfo[prop] >@@ -210,8 +215,10 @@ class object(DhcpOptions): > except LookupError: > pass > ml.append(('dhcpPermitList', old, new)) >+ > if self.info.get('failover_peer', None) and not self.info.get('dynamic_bootp_clients', None) == 'deny': > raise univention.admin.uexceptions.bootpXORFailover >+ > return ml > > @staticmethod >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index 2c30ce3..a58c47c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -35,42 +35,43 @@ import univention.admin.filter > import univention.admin.handlers > import univention.admin.localization > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/server' >-operations=['add','edit','remove','search'] >-superordinate='dhcp/service' >-childs=0 >-usewizard=1 >-short_description=_('DHCP: Server') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/server' >+operations = ['add', 'edit', 'remove', 'search'] >+superordinate = 'dhcp/service' >+childs = 0 >+usewizard = 1 >+short_description = _('DHCP: Server') >+long_description = '' >+ >+options = { > } > >-property_descriptions={ >+property_descriptions = { > 'server': univention.admin.property( >- short_description=_('Server name'), >- long_description='', >- syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=1, >- identifies=1 >- ), >+ short_description=_('Server name'), >+ long_description='', >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=1 >+ ), > } > > layout = [ >- Tab( _( 'General' ), _('General settings'), layout = [ >- Group( _( 'General' ), layout = [ >+ Tab(_('General'), _('General settings'), layout=[ >+ Group(_('General'), layout=[ > 'server' >- ] ), >- ] ) >+ ]), >+ ]) > ] > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('server', 'cn', None, univention.admin.mapping.ListToString) > > from .__common import add_dhcp_options >@@ -78,12 +79,12 @@ add_dhcp_options(__name__) > > > class object(univention.admin.handlers.simpleLdap): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.superordinate=superordinate >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.superordinate = superordinate >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -93,10 +94,14 @@ class object(univention.admin.handlers.simpleLdap): > super(object, self).__init__(co, lo, position, dn, superordinate, attributes=attributes) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('server'), mapping.mapValue('server', self.info['server']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('server'), >+ mapping.mapValue('server', self.info['server']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): >- searchBase=self.position.getDomain() >+ searchBase = self.position.getDomain() > if self.lo.searchDn(base=searchBase, filter='(&(objectClass=dhcpServer)(cn=%s))' % (self.info['server'])): > raise univention.admin.uexceptions.dhcpServerAlreadyUsed, self.info['server'] > >@@ -104,17 +109,19 @@ class object(univention.admin.handlers.simpleLdap): > ('objectClass', ['top', 'dhcpServer']), > ('dhcpServiceDN', self.superordinate.dn), > ] >+ > def _ldap_post_move(self, olddn): > '''edit dhcpServiceDN''' >- oldServiceDN=self.lo.getAttr(self.dn, 'dhcpServiceDN') >- module=univention.admin.modules.identifyOne(self.position.getDn(), self.lo.get(self.position.getDn())) >- object=univention.admin.objects.get(module, None, self.lo, self.position, dn=self.position.getDn()) >- shadow_module, shadow_object=univention.admin.objects.shadow(self.lo, module, object, self.position) >+ oldServiceDN = self.lo.getAttr(self.dn, 'dhcpServiceDN') >+ module = univention.admin.modules.identifyOne(self.position.getDn(), self.lo.get(self.position.getDn())) >+ object = univention.admin.objects.get(module, None, self.lo, self.position, dn=self.position.getDn()) >+ shadow_module, shadow_object = univention.admin.objects.shadow(self.lo, module, object, self.position) > self.lo.modify(self.dn, [('dhcpServiceDN', oldServiceDN[0], shadow_object.dn)]) > >+ > def lookup_filter(filter_s=None, lo=None): >- filter_obj=univention.admin.filter.conjunction('&', [ >- univention.admin.filter.expression('objectClass', 'dhcpServer') >+ filter_obj = univention.admin.filter.conjunction('&', [ >+ univention.admin.filter.expression('objectClass', 'dhcpServer') > ]) > filter_obj.append_unmapped_filter_string(filter_s, univention.admin.mapping.mapRewrite, mapping) > return filter_obj >@@ -132,6 +139,6 @@ def lookup(co, lo, filter_s, base='', superordinate=None, scope='sub', unique=0, > ] > return res > >-def identify(dn, attr): > >+def identify(dn, attr): > return 'dhcpServer' in attr.get('objectClass', []) >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index 8e37357..a89f867 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -35,40 +35,42 @@ import univention.admin.filter > import univention.admin.handlers > import univention.admin.localization > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/service' >-operations=['add','edit','remove','search'] >-childs=1 >-usewizard=1 >-short_description=_('DHCP: Service') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/service' >+operations = ['add', 'edit', 'remove', 'search'] >+childs = 1 >+usewizard = 1 >+short_description = _('DHCP: Service') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'service': univention.admin.property( >- short_description=_('Service name'), >- long_description='', >- syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=0, >- identifies=1 >- ), >+ short_description=_('Service name'), >+ long_description='', >+ syntax=univention.admin.syntax.string, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=0, >+ identifies=1 >+ ), > } > > layout = [ >- Tab( _( 'General' ), _( 'Basic settings' ), layout = [ >- Group( _( 'General' ), layout = [ >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ > 'service', >- ] ), >- ] ), >+ ]), >+ ]), > ] > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('service', 'cn', None, univention.admin.mapping.ListToString) > > from .__common import add_dhcp_options, DhcpOptions >@@ -76,11 +78,11 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not dn and not position: > raise univention.admin.uexceptions.insufficientInformation, 'neither dn nor position present' >@@ -89,7 +91,11 @@ class object(DhcpOptions): > self.setup_options(options) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('service'), mapping.mapValue('service', self.info['service']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('service'), >+ mapping.mapValue('service', self.info['service']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): > return [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index ed68cfd..3900332 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -36,40 +36,42 @@ import univention.admin.handlers > import univention.admin.ipaddress > import univention.admin.localization > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/shared' >-operations=['add','edit','remove','search'] >-superordinate='dhcp/service' >-childs=1 >-short_description=_('DHCP: Shared network') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/shared' >+operations = ['add', 'edit', 'remove', 'search'] >+superordinate = 'dhcp/service' >+childs = 1 >+short_description = _('DHCP: Shared network') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'name': univention.admin.property( >- short_description=_('Shared network name'), >- long_description='', >- syntax=univention.admin.syntax.uid, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=0, >- identifies=1 >- ) >+ short_description=_('Shared network name'), >+ long_description='', >+ syntax=univention.admin.syntax.uid, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=0, >+ identifies=1 >+ ) > } > > layout = [ >- Tab( _( 'General' ), _( 'Basic settings' ), layout = [ >- Group( _( 'General' ), layout = [ >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ > 'name' >- ] ), >- ] ), >+ ]), >+ ]), > ] > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('name', 'cn', None, univention.admin.mapping.ListToString) > > from .__common import add_dhcp_options, DhcpOptions >@@ -77,11 +79,11 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -92,7 +94,11 @@ class object(DhcpOptions): > self.setup_options(options) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('name'), mapping.mapValue('name', self.info['name']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('name'), >+ mapping.mapValue('name', self.info['name']), >+ self.position.getDn(), >+ ) > > def _ldap_addlist(self): > return [ >@@ -114,6 +120,4 @@ lookup = object.lookup > > > def identify(dn, attr): >- > return 'dhcpSharedNetwork' in attr.get('objectClass', []) >- >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index 7d79e74..ccd824c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -36,75 +36,77 @@ import univention.admin.handlers > import univention.admin.ipaddress > import univention.admin.localization > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/sharedsubnet' >-operations=['add','edit','remove','search'] >-superordinate='dhcp/shared' >-childs=1 >-short_description=_('DHCP: Shared subnet') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/sharedsubnet' >+operations = ['add', 'edit', 'remove', 'search'] >+superordinate = 'dhcp/shared' >+childs = 1 >+short_description = _('DHCP: Shared subnet') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'subnet': univention.admin.property( >- short_description=_('Subnet address'), >- long_description='', >- syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=0, >- identifies=1 >- ), >+ short_description=_('Subnet address'), >+ long_description='', >+ syntax=univention.admin.syntax.ipv4Address, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=0, >+ identifies=1 >+ ), > 'subnetmask': univention.admin.property( >- short_description=_('Netmask'), >- long_description='', >- syntax=univention.admin.syntax.v4netmask, >- multivalue=0, >- options=[], >- required=1, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Netmask'), >+ long_description='', >+ syntax=univention.admin.syntax.v4netmask, >+ multivalue=0, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=0 >+ ), > 'broadcastaddress': univention.admin.property( >- short_description=_('Broadcast address'), >- long_description='', >- syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Broadcast address'), >+ long_description='', >+ syntax=univention.admin.syntax.ipv4Address, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > 'range': univention.admin.property( >- short_description=_('Dynamic address assignment'), >- long_description=_( 'Define a pool of addresses available for dynamic address assignment.'), >- syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Dynamic address assignment'), >+ long_description=_('Define a pool of addresses available for dynamic address assignment.'), >+ syntax=univention.admin.syntax.IPv4_AddressRange, >+ multivalue=1, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > } > > layout = [ >- Tab(_('General'), _('Basic settings'), layout = [ >- Group( _( 'General' ), layout = [ >- [ 'subnet', 'subnetmask' ], >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ >+ ['subnet', 'subnetmask'], > 'broadcastaddress', > 'range' >- ] ), >- ] ), >+ ]), >+ ]), > ] > > > from .__common import rangeMap, rangeUnmap, add_dhcp_options, DhcpOptions > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('range', 'dhcpRange', rangeMap, rangeUnmap) > mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString) >@@ -114,12 +116,12 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.superordinate=superordinate >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.superordinate = superordinate >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -130,7 +132,11 @@ class object(DhcpOptions): > self.setup_options(options) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('subnet'), >+ mapping.mapValue('subnet', self.info['subnet']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): > return [ >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index cbaf7b8..0313ddd 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -36,75 +36,77 @@ import univention.admin.handlers > import univention.admin.ipaddress > import univention.admin.localization > >-translation=univention.admin.localization.translation('univention.admin.handlers.dhcp') >-_=translation.translate >- >-module='dhcp/subnet' >-operations=['add','edit','remove','search'] >-superordinate='dhcp/service' >-childs=1 >-usewizard=1 >-short_description=_('DHCP: Subnet') >-long_description='' >-options={ >+translation = univention.admin.localization.translation('univention.admin.handlers.dhcp') >+_ = translation.translate >+ >+module = 'dhcp/subnet' >+operations = ['add', 'edit', 'remove', 'search'] >+superordinate = 'dhcp/service' >+childs = 1 >+usewizard = 1 >+short_description = _('DHCP: Subnet') >+long_description = '' >+ >+options = { > } >-property_descriptions={ >+ >+property_descriptions = { > 'subnet': univention.admin.property( >- short_description=_('Subnet address'), >- long_description='', >- syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- include_in_default_search=1, >- options=[], >- required=1, >- may_change=0, >- identifies=1 >- ), >+ short_description=_('Subnet address'), >+ long_description='', >+ syntax=univention.admin.syntax.ipv4Address, >+ multivalue=0, >+ include_in_default_search=1, >+ options=[], >+ required=1, >+ may_change=0, >+ identifies=1 >+ ), > 'subnetmask': univention.admin.property( >- short_description=_('Netmask'), >- long_description='', >- syntax=univention.admin.syntax.v4netmask, >- multivalue=0, >- options=[], >- required=1, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Netmask'), >+ long_description='', >+ syntax=univention.admin.syntax.v4netmask, >+ multivalue=0, >+ options=[], >+ required=1, >+ may_change=1, >+ identifies=0 >+ ), > 'broadcastaddress': univention.admin.property( >- short_description=_('Broadcast address'), >- long_description='', >- syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Broadcast address'), >+ long_description='', >+ syntax=univention.admin.syntax.ipv4Address, >+ multivalue=0, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > 'range': univention.admin.property( >- short_description=_('Dynamic address assignment'), >- long_description=_( 'Define a pool of addresses available for dynamic address assignment.' ), >- syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >- options=[], >- required=0, >- may_change=1, >- identifies=0 >- ), >+ short_description=_('Dynamic address assignment'), >+ long_description=_('Define a pool of addresses available for dynamic address assignment.'), >+ syntax=univention.admin.syntax.IPv4_AddressRange, >+ multivalue=1, >+ options=[], >+ required=0, >+ may_change=1, >+ identifies=0 >+ ), > } > > layout = [ >- Tab( _( 'General' ), _('Basic settings'), layout = [ >- Group( _( 'General' ), layout = [ >- [ 'subnet', 'subnetmask' ], >+ Tab(_('General'), _('Basic settings'), layout=[ >+ Group(_('General'), layout=[ >+ ['subnet', 'subnetmask'], > 'broadcastaddress', > 'range' >- ] ), >- ] ), >+ ]), >+ ]), > ] > > from .__common import rangeUnmap, add_dhcp_options, DhcpOptions > >-mapping=univention.admin.mapping.mapping() >+mapping = univention.admin.mapping.mapping() > mapping.register('subnet', 'cn', None, univention.admin.mapping.ListToString) > mapping.register('subnetmask', 'dhcpNetMask', None, univention.admin.mapping.ListToString) > mapping.register('broadcastaddress', 'univentionDhcpBroadcastAddress', None, univention.admin.mapping.ListToString) >@@ -113,12 +115,12 @@ add_dhcp_options(__name__) > > > class object(DhcpOptions): >- module=module >+ module = module > >- def __init__(self, co, lo, position, dn='', superordinate=None, attributes = [] ): >- self.superordinate=superordinate >- self.mapping=mapping >- self.descriptions=property_descriptions >+ def __init__(self, co, lo, position, dn='', superordinate=None, attributes=[]): >+ self.superordinate = superordinate >+ self.mapping = mapping >+ self.descriptions = property_descriptions > > if not superordinate: > raise univention.admin.uexceptions.insufficientInformation, 'superordinate object not present' >@@ -133,19 +135,22 @@ class object(DhcpOptions): > self.info['range'] = self.oldinfo['range'] = rangeUnmap(self.oldattr.get('dhcpRange', [])) > > def _ldap_pre_create(self): >- self.dn='%s=%s,%s' % (mapping.mapName('subnet'), mapping.mapValue('subnet', self.info['subnet']), self.position.getDn()) >+ self.dn = '%s=%s,%s' % ( >+ mapping.mapName('subnet'), >+ mapping.mapValue('subnet', self.info['subnet']), >+ self.position.getDn() >+ ) > > def _ldap_addlist(self): > return [ >- ( 'objectClass', [ 'top', 'univentionDhcpSubnet' ] ), >+ ('objectClass', ['top', 'univentionDhcpSubnet']), > ] > > def _ldap_modlist(self): >- > ml = super(object, self)._ldap_modlist() > > if self.hasChanged('range'): >- dhcpRange=[] >+ dhcpRange = [] > for i in self['range']: > for j in self['range']: > if i != j and univention.admin.ipaddress.is_range_overlapping(i, j): >-- >1.8.4.rc3 > > >From 6fcda96ad04e971bb07ed8f382c704d1e9c15f99 Mon Sep 17 00:00:00 2001 >Message-Id: <6fcda96ad04e971bb07ed8f382c704d1e9c15f99.1384983678.git.hahn@univention.de> >In-Reply-To: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >References: <61c0f73c34e7d01be0b02604f9f1b395b60aedbd.1384983678.git.hahn@univention.de> >From: Philipp Hahn <hahn@univention.de> >Date: Wed, 20 Nov 2013 19:25:28 +0100 >Subject: [PATCH 17/17] Bug #33223: udm/dhcp: True/False >Organization: Univention GmbH, Bremen, Germany > >Use True/False instead of 1/0. >--- > .../univention/admin/handlers/dhcp/__common.py | 4 +- > .../modules/univention/admin/handlers/dhcp/dhcp.py | 10 ++-- > .../modules/univention/admin/handlers/dhcp/host.py | 26 +++++----- > .../modules/univention/admin/handlers/dhcp/pool.py | 58 +++++++++++----------- > .../univention/admin/handlers/dhcp/server.py | 10 ++-- > .../univention/admin/handlers/dhcp/service.py | 10 ++-- > .../univention/admin/handlers/dhcp/shared.py | 10 ++-- > .../univention/admin/handlers/dhcp/sharedsubnet.py | 34 ++++++------- > .../univention/admin/handlers/dhcp/subnet.py | 34 ++++++------- > 9 files changed, 98 insertions(+), 98 deletions(-) > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >index 60f1a7b..6ad97a3 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/__common.py >@@ -57,9 +57,9 @@ _properties = { > syntax=univention.admin.syntax.string, > multivalue=True, > options=["options"], >- required = 0, >+ required=False, > may_change=True, >- identifies = 0 >+ identifies=False, > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >index 0eae5c5..f812041 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/dhcp.py >@@ -88,12 +88,12 @@ property_descriptions = { > short_description=_('Name'), > long_description='', > syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=1, >- identifies=1 >+ required=True, >+ may_change=True, >+ identifies=True > ) > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >index c57a1f3..11b36d2 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/host.py >@@ -55,12 +55,12 @@ property_descriptions = { > short_description=_('Hostname'), > long_description='', > syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=1, >- identifies=1 >+ required=True, >+ may_change=True, >+ identifies=True > ), > 'hwaddress': univention.admin.property( > short_description=_('Hardware address'), >@@ -68,11 +68,11 @@ property_descriptions = { > 'Currently, only the ethernet and token-ring types are recognized.' > 'The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons.'), > syntax=univention.admin.syntax.DHCP_HardwareAddress, >- multivalue=0, >+ multivalue=False, > options=[], >- required=1, >- may_change=1, >- identifies=0 >+ required=True, >+ may_change=True, >+ identifies=False > ), > 'fixedaddress': univention.admin.property( > short_description=_('Fixed IP addresses'), >@@ -80,11 +80,11 @@ property_descriptions = { > 'Assign one or more fixed IP addresses.' > 'Each address should be either an IP address or a domain name that resolves to one or more IP addresses'), > syntax=univention.admin.syntax.string, >- multivalue=1, >+ multivalue=True, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >index 86dccaa..0a3e37c 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/pool.py >@@ -57,52 +57,52 @@ property_descriptions = { > short_description=_('Name'), > long_description=_('A unique name used to identify this pool, e.g. "known" or "guests"'), > syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=0, >- identifies=1 >+ required=True, >+ may_change=False, >+ identifies=True > ), > 'range': univention.admin.property( > short_description=_('IP range for dynamic assignment'), > long_description='', > syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >+ multivalue=True, > options=[], >- required=1, >- may_change=1, >- identifies=0 >+ required=True, >+ may_change=True, >+ identifies=False > ), > 'failover_peer': univention.admin.property( > short_description=_('Failover peer'), > long_description=_('The name of a failover configuration manually configured in /etc/dhcp/local.conf.'), > syntax=univention.admin.syntax.string, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0, >+ required=False, >+ may_change=True, >+ identifies=False, > ), > 'known_clients': univention.admin.property( > short_description=_('Give IP to known clients'), > long_description=_('Addresses are allocated for client, which have a host entry matching their MAC address.'), > syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > 'unknown_clients': univention.admin.property( > short_description=_('Give IP to unknown clients'), > long_description=_('Addresses are allocated for clients, which do not have a host entry mating their MAC address.'), > syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > 'dynamic_bootp_clients': univention.admin.property( > short_description=_('Give IP to dynamic BOOTP clients'), >@@ -110,21 +110,21 @@ property_descriptions = { > 'Give addresses to clients using the legacy BOOTP protocol.' > 'Since BOOTP does not support an expiry date or a release mechanism, addresses are allocated indefinitely!'), > syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > 'all_clients': univention.admin.property( > short_description=_('Give IP from this pool'), > long_description=_('Give addresses from this pool at all or not.'), > syntax=univention.admin.syntax.AllowDeny, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >index a58c47c..55b6d78 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/server.py >@@ -54,12 +54,12 @@ property_descriptions = { > short_description=_('Server name'), > long_description='', > syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=1, >- identifies=1 >+ required=True, >+ may_change=True, >+ identifies=True > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >index a89f867..19c0061 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/service.py >@@ -53,12 +53,12 @@ property_descriptions = { > short_description=_('Service name'), > long_description='', > syntax=univention.admin.syntax.string, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=0, >- identifies=1 >+ required=True, >+ may_change=False, >+ identifies=True > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >index 3900332..5018118 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/shared.py >@@ -54,12 +54,12 @@ property_descriptions = { > short_description=_('Shared network name'), > long_description='', > syntax=univention.admin.syntax.uid, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=0, >- identifies=1 >+ required=True, >+ may_change=False, >+ identifies=True > ) > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >index ccd824c..b8598f9 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/sharedsubnet.py >@@ -54,42 +54,42 @@ property_descriptions = { > short_description=_('Subnet address'), > long_description='', > syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=0, >- identifies=1 >+ required=True, >+ may_change=False, >+ identifies=True > ), > 'subnetmask': univention.admin.property( > short_description=_('Netmask'), > long_description='', > syntax=univention.admin.syntax.v4netmask, >- multivalue=0, >+ multivalue=False, > options=[], >- required=1, >- may_change=1, >- identifies=0 >+ required=True, >+ may_change=True, >+ identifies=False > ), > 'broadcastaddress': univention.admin.property( > short_description=_('Broadcast address'), > long_description='', > syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > 'range': univention.admin.property( > short_description=_('Dynamic address assignment'), > long_description=_('Define a pool of addresses available for dynamic address assignment.'), > syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >+ multivalue=True, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > } > >diff --git a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >index 0313ddd..8a5ca6b 100644 >--- a/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >+++ b/branches/ucs-3.2/ucs-3.2-0/management/univention-directory-manager-modules/modules/univention/admin/handlers/dhcp/subnet.py >@@ -55,42 +55,42 @@ property_descriptions = { > short_description=_('Subnet address'), > long_description='', > syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >- include_in_default_search=1, >+ multivalue=False, >+ include_in_default_search=True, > options=[], >- required=1, >- may_change=0, >- identifies=1 >+ required=True, >+ may_change=False, >+ identifies=True > ), > 'subnetmask': univention.admin.property( > short_description=_('Netmask'), > long_description='', > syntax=univention.admin.syntax.v4netmask, >- multivalue=0, >+ multivalue=False, > options=[], >- required=1, >- may_change=1, >- identifies=0 >+ required=True, >+ may_change=True, >+ identifies=False > ), > 'broadcastaddress': univention.admin.property( > short_description=_('Broadcast address'), > long_description='', > syntax=univention.admin.syntax.ipv4Address, >- multivalue=0, >+ multivalue=False, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > 'range': univention.admin.property( > short_description=_('Dynamic address assignment'), > long_description=_('Define a pool of addresses available for dynamic address assignment.'), > syntax=univention.admin.syntax.IPv4_AddressRange, >- multivalue=1, >+ multivalue=True, > options=[], >- required=0, >- may_change=1, >- identifies=0 >+ required=False, >+ may_change=True, >+ identifies=False > ), > } > >-- >1.8.4.rc3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 33223
:
5596
| 5666