Univention Bugzilla – Attachment 9137 Details for
Bug 39539
timeout for univention-dnsedit - maximum recursion depth exceeded - join hangs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
39539.patch (text/plain), 9.58 KB, created by
Florian Best
on 2017-08-22 17:02:45 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2017-08-22 17:02:45 CEST
Size:
9.58 KB
patch
obsolete
>commit f87c08779e4ac0b48fe88b7c95f450325ade5199 >Author: Florian Best <best@univention.de> >Date: Tue Aug 22 17:00:54 2017 +0200 > > fix 39539 > >diff --git a/management/univention-directory-manager-modules/univention-dnsedit b/management/univention-directory-manager-modules/univention-dnsedit >index 1e4cb52..292bde4 100755 >--- a/management/univention-directory-manager-modules/univention-dnsedit >+++ b/management/univention-directory-manager-modules/univention-dnsedit >@@ -121,11 +121,12 @@ def parse(): > return options, zone_name, command, typ, arguments[3:] > > >-def bind(): >+def bind(timeout=None): > """Bind to LDAP service.""" > ucr = univention.config_registry.ConfigRegistry() > ucr.load() >- timeout = time.time() + 120 # 2 minutes from now >+ >+ timeout = timeout or time.time() + 120 # 2 minutes from now > if time.time() > timeout: > err = '%s: LDAP server %s unreachable, aborting' % (sys.argv[0], ucr['ldap/master']) > ud.debug(ud.ADMIN, ud.WARN, err) > >commit 2079443d6b9a79a50b42bcb265b0eb2e64a4b28a >Author: Florian Best <best@univention.de> >Date: Tue Aug 22 17:00:17 2017 +0200 > > pep8 > >diff --git a/management/univention-directory-manager-modules/univention-dnsedit b/management/univention-directory-manager-modules/univention-dnsedit >index 71d878c..1e4cb52 100755 >--- a/management/univention-directory-manager-modules/univention-dnsedit >+++ b/management/univention-directory-manager-modules/univention-dnsedit >@@ -35,6 +35,7 @@ > > import sys > import time >+import ldap > from optparse import OptionParser > import univention.debug as ud > ud.init('/var/log/univention/directory-manager-cmd.log', ud.FLUSH, ud.FUNCTION) >@@ -69,30 +70,38 @@ def parse(): > ''' # FIXME: OptionParser reformats this > global parser > parser = OptionParser(usage=usage, description=description) >- parser.add_option('--ignore-missing-zone', >- action='store_true', dest='ignore_missing_zone', >- help='Skip if zone does not exist') >- parser.add_option('--ignore-exists', >- action='store_true', dest='ignore_exists', >- help='Skip if entry already exists') >- parser.add_option('--quiet', >- action='store_true', dest='quiet', >- help='Turn off verbose messages') # not implemented >- parser.add_option('--reverse', >- action='store_true', dest='reverse', >- help='Modify revers zone instead of forward zone') >- parser.add_option('--overwrite', >- action='store_true', dest='overwrite', >- help='Overwrite exising record') >- parser.add_option('--stoptls', >- action='store_true', dest='stoptls', >- help='Disable TLS') >- parser.add_option('--binddn', >- action='store', dest='binddn', >- help='bind DN') >- parser.add_option('--bindpwd', >- action='store', dest='bindpwd', >- help='bind password') >+ parser.add_option( >+ '--ignore-missing-zone', >+ action='store_true', dest='ignore_missing_zone', >+ help='Skip if zone does not exist') >+ parser.add_option( >+ '--ignore-exists', >+ action='store_true', dest='ignore_exists', >+ help='Skip if entry already exists') >+ parser.add_option( >+ '--quiet', >+ action='store_true', dest='quiet', >+ help='Turn off verbose messages') # not implemented >+ parser.add_option( >+ '--reverse', >+ action='store_true', dest='reverse', >+ help='Modify revers zone instead of forward zone') >+ parser.add_option( >+ '--overwrite', >+ action='store_true', dest='overwrite', >+ help='Overwrite exising record') >+ parser.add_option( >+ '--stoptls', >+ action='store_true', dest='stoptls', >+ help='Disable TLS') >+ parser.add_option( >+ '--binddn', >+ action='store', dest='binddn', >+ help='bind DN') >+ parser.add_option( >+ '--bindpwd', >+ action='store', dest='bindpwd', >+ help='bind password') > > options, arguments = parser.parse_args() > msg = None >@@ -118,15 +127,12 @@ def bind(): > ucr.load() > timeout = time.time() + 120 # 2 minutes from now > if time.time() > timeout: >- err = '%s: LDAP server %s unreachable, aborting' % \ >- (sys.argv[0], ucr['ldap/master']) >+ err = '%s: LDAP server %s unreachable, aborting' % (sys.argv[0], ucr['ldap/master']) > ud.debug(ud.ADMIN, ud.WARN, err) > print >> sys.stderr, err > sys.exit(1) >- if options.stoptls: >- start_tls = 0 >- else: >- start_tls = 2 >+ >+ start_tls = 0 if options.stoptls else 2 > try: > if options.binddn and options.bindpwd: > lo = uldap.access( >@@ -145,24 +151,20 @@ def bind(): > ud.debug(ud.ADMIN, ud.WARN, msg) > print >> sys.stderr, msg > sys.exit(1) >- except (univention.admin.uexceptions.ldapError, >- uldap.ldap.LDAPError): >- msg = '%s: timeout while trying to contact LDAP server %s' % \ >- (sys.argv[0], ucr['ldap/master']) >+ except (univention.admin.uexceptions.ldapError, ldap.LDAPError): >+ msg = '%s: timeout while trying to contact LDAP server %s' % (sys.argv[0], ucr['ldap/master']) > ud.debug(ud.ADMIN, ud.WARN, msg) > print >> sys.stderr, msg > time.sleep(10) >- return bind() # recursion >+ return bind(timeout) # recursion > > > def lookup_zone(zone_name): > """Lookup zone and return UDM object.""" > if not options.reverse: >- zones = forward_zone.lookup(co, lo, '(zone=%s)' % (zone_name,), >- scope='domain', base=position.getDomain(), unique=True) >+ zones = forward_zone.lookup(co, lo, '(zone=%s)' % (zone_name,), scope='domain', base=position.getDomain(), unique=True) > else: >- zones = reverse_zone.lookup(co, lo, '(subnet=%s)' % (zone_name,), >- scope='domain', base=position.getDomain(), unique=True) >+ zones = reverse_zone.lookup(co, lo, '(subnet=%s)' % (zone_name,), scope='domain', base=position.getDomain(), unique=True) > if not zones: > if options.ignore_missing_zone: > sys.exit(0) >@@ -178,8 +180,7 @@ def add_srv_record(service, protocol, priority, weight, port, host): > location = [priority, weight, port, host] > filt = univention.admin.filter.expression('name', name) > >- records = srv_record.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = srv_record.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: >@@ -204,8 +205,7 @@ def remove_srv_record(service, protocol, priority, weight, port, host): > location = [priority, weight, port, host] > filt = univention.admin.filter.expression('name', name) > >- records = srv_record.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = srv_record.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: >@@ -225,8 +225,7 @@ def remove_srv_record(service, protocol, priority, weight, port, host): > def add_txt_record(name, text): > """Add DNS text record.""" > filt = univention.admin.filter.expression('name', name) >- records = txt_record.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = txt_record.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: >@@ -249,8 +248,7 @@ def add_txt_record(name, text): > def add_a_record(name, *adresses): > """Add DNS IPv4 address records.""" > filt = univention.admin.filter.expression('name', name) >- records = host_record.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = host_record.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: >@@ -273,8 +271,7 @@ def add_a_record(name, *adresses): > def add_cname_record(name, cname): > """Add DNS canonical name record.""" > filt = univention.admin.filter.expression('name', name) >- records = alias.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = alias.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: >@@ -282,8 +279,7 @@ def add_cname_record(name, cname): > record['name'] = name > record['zonettl'] = ['80600'] > >- if record['cname'] and not (record['cname'] == cname or >- options.overwrite or options.ignore_exists): >+ if record['cname'] and not (record['cname'] == cname or options.overwrite or options.ignore_exists): > print >> sys.stderr, 'E: Record exists and points to different address' > sys.exit(1) > if record['cname'] == cname: >@@ -299,16 +295,14 @@ def add_cname_record(name, cname): > def add_ptr_record(address, ptr): > """Add DNS pointer record.""" > filt = univention.admin.filter.expression('address', address) >- records = ptr_record.lookup(co, lo, filt, scope='domain', >- base=position.getDomain(), superordinate=zone, unique=True) >+ records = ptr_record.lookup(co, lo, filt, scope='domain', base=position.getDomain(), superordinate=zone, unique=True) > if records: > record = records[0] > else: > record = ptr_record.object(co, lo, position, superordinate=zone) > record['address'] = address > >- if record['ptr_record'] and not (record['ptr_record'] == ptr or ptr in record['ptr_record'] or >- options.overwrite): >+ if record['ptr_record'] and not (record['ptr_record'] == ptr or ptr in record['ptr_record'] or options.overwrite): > print >> sys.stderr, 'E: Record exists and points to different address' > sys.exit(1) > if record['ptr_record'] == ptr: >@@ -391,9 +385,7 @@ def main(): > print >> sys.stderr, 'E: Object "%s" exists' % (ex,) > raise > sys.exit(1) >- except (ValueError, TypeError, >- univention.admin.uexceptions.valueInvalidSyntax, >- univention.admin.uexceptions.valueRequired) as ex: >+ except (ValueError, TypeError, univention.admin.uexceptions.valueInvalidSyntax, univention.admin.uexceptions.valueRequired) as ex: > print >> sys.stderr, 'E: failed %s' % (ex,) > raise > sys.exit(1)
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 39539
: 9137