Univention Bugzilla – Bug 27815
squid config überarbeiten
Last modified: 2012-12-12 21:08:25 CET
Im aktuellen squid.conf template werden UCR variablen mit var == 'yes' ausgewertet. Da sollte ucr.is_true verwendet werden. $ grep -n "'yes'" squid.conf 44:if configRegistry.get( 'squid/cache', 'yes' ).lower() in ( 'no', 'false' ): 50:if 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]: 59: if configRegistry.get('squid/transparentproxy','no').lower() in ['yes', 'true']: 82:if configRegistry['squid/ntlmauth'] == 'yes': 93:if configRegistry['squid/basicauth'] == 'yes': 155: if not 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]: zusätzlich werden Ports ab und zu als strings behandelt (%s → %d + defaultwerttyp sollte int sein) $ grep -n configRegistry squid.conf | grep port 53: squidport = int(configRegistry.get('squid/httpport', '3128'))+1 61: print "http_port %s %s" % ( configRegistry.get('squid/httpport', '3128'), transparent ) 65:for port in configRegistry.get('squid/webports', '80 443 21').split(" "): 98: auth += ' -p ' + configRegistry.get("ldap/server/port", '7389') 122: ldapGroup += ' -p ' + configRegistry.get("ldap/server/port", "7389") 214: print 'cache_peer '+configRegistry['squid/parent/host']+' parent '+configRegistry.get( 'squid/parent/port', '3128' ) +' 0 '+configRegistry.get( 'squid/parent/options', 'default' ) Außerdem werden im postinst nur 3 variablen gesetzt. Meiner Meinung nach sollten da alle defaultwerte gesetzt werden, damit es einfacher ist nach squid-Variablen zu suchen.
UCS 3.1 will be the next release.
Die squid.conf wurde aufgeräumt: * Benutzung von ucr.is_true/is_false * Behandlung von Ports als int * kleinigkeiten: string interpolation univention-squid (6.0.0-1) unstable; urgency=low * cleaned up the squid.conf template (Bug #27815)
Die Konvertierung von if ucr.get() in ["no"] etc. muss nochmal geprüft werden, ich habe jetzt 2 Stellen, wo sich das neue anders verhält. import univention.config_registry configRegistry = univention.config_registry.ConfigRegistry() configRegistry.load() print configRegistry.get('squid/virusscan') print configRegistry.get('squid/krb5auth/keepalive') # old if not 'yes' in [ configRegistry.get('squid/virusscan', ''), configRegistry.get('squid/contentscan', '') ]: print "old if virus" # new -> vermutlich besser is_true OR is_true if configRegistry.is_false('squid/virusscan') and configRegistry.is_false('squid/contentscan'): print "new if virus" # old if not configRegistry.get('squid/krb5auth/keepalive', '').lower() in ['no', 'false']: print "old if krb5auth/keepalive" # new -> vermutlich .is_true(... default=True) if configRegistry.is_true('squid/krb5auth/keepalive'): print "new if krb5auth/keepalive" -> python ... None None old if virus old if krb5auth/keepalive
(In reply to comment #3) > Die Konvertierung von if ucr.get() in ["no"] etc. muss nochmal geprüft werden, > ich habe jetzt 2 Stellen, wo sich das neue anders verhält. Das lag an ungesetzen UCR variablen und wurde korrigiert.
root@master:~# ucr commit /etc/squid3/squid.conf File: /etc/squid3/squid.conf Traceback (most recent call last): File "<stdin>", line 66, in <module> File "/usr/lib/pymodules/python2.6/univention/config_registry/backend.py", line 227, in is_true if key in self: File "/usr/lib/pymodules/python2.6/univention/config_registry/backend.py", line 147, in __contains__ if key in registry: vermutlich durch -> if configRegistry.is_true(['squid/basicauth']): ---------- Bitte noch if configRegistry.is_false('squid/virusscan', True) and configRegistry.is_false('squid/contentscan', True) -------------- Warum das? - if configRegistry.is_true("squid/ntlmauth/keepalive"): + if configRegistry.is_true("squid/ntlmauth/keepalive", True): das ist ja eine Verhaltensänderung, ohne squid/ntlmauth/keepalive wurde das bisher nicht gesetzt, jetzt schon, ich denke das True sollte weg
(In reply to comment #5) > vermutlich durch -> if configRegistry.is_true(['squid/basicauth']): Ja > ---------- > > Bitte noch > > > if configRegistry.is_false('squid/virusscan', True) and > configRegistry.is_false('squid/contentscan', True) > > -------------- Das war doch schon. > Warum das? > > - if configRegistry.is_true("squid/ntlmauth/keepalive"): > + if configRegistry.is_true("squid/ntlmauth/keepalive", True): > > das ist ja eine Verhaltensänderung, ohne squid/ntlmauth/keepalive wurde das > bisher nicht gesetzt, jetzt schon, ich denke das True sollte weg Ja, wurde revertet. univention-squid 6.0.2-1
OK, das Template funktioniert. Changelog Eintrag vorhanden.
UCS 3.1-0 has been released: http://forum.univention.de/viewtopic.php?f=54&t=2125 If this error occurs again, please use "Clone This Bug".