Mercurial > kallithea
comparison rhodecode/lib/db_manage.py @ 1510:90062009bb1e beta
added default ldap option into migration
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 04 Oct 2011 22:43:26 +0200 |
parents | b02aa5f2f066 |
children | bf263968da47 2c0d35e336b5 |
comparison
equal
deleted
inserted
replaced
1509:da886cc79907 | 1510:90062009bb1e |
---|---|
158 self.klass.create_ui_settings() | 158 self.klass.create_ui_settings() |
159 | 159 |
160 def step_3(self): | 160 def step_3(self): |
161 print ('Adding additional settings into RhodeCode db') | 161 print ('Adding additional settings into RhodeCode db') |
162 self.klass.fix_settings() | 162 self.klass.fix_settings() |
163 | 163 print ('Adding ldap defaults') |
164 self.klass.create_ldap_options(skip_existing=True) | |
165 | |
164 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) | 166 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1) |
165 | 167 |
166 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE | 168 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE |
167 for step in upgrade_steps: | 169 for step in upgrade_steps: |
168 print ('performing upgrade step %s' % step) | 170 print ('performing upgrade step %s' % step) |
305 self.sa.commit() | 307 self.sa.commit() |
306 except: | 308 except: |
307 self.sa.rollback() | 309 self.sa.rollback() |
308 raise | 310 raise |
309 | 311 |
310 def create_ldap_options(self): | 312 def create_ldap_options(self,skip_existing=False): |
311 """Creates ldap settings""" | 313 """Creates ldap settings""" |
312 | 314 |
313 try: | 315 try: |
314 for k, v in [('ldap_active', 'false'), ('ldap_host', ''), | 316 for k, v in [('ldap_active', 'false'), ('ldap_host', ''), |
315 ('ldap_port', '389'), ('ldap_tls_kind', 'PLAIN'), | 317 ('ldap_port', '389'), ('ldap_tls_kind', 'PLAIN'), |
317 ('ldap_dn_pass', ''), ('ldap_base_dn', ''), | 319 ('ldap_dn_pass', ''), ('ldap_base_dn', ''), |
318 ('ldap_filter', ''), ('ldap_search_scope', ''), | 320 ('ldap_filter', ''), ('ldap_search_scope', ''), |
319 ('ldap_attr_login', ''), ('ldap_attr_firstname', ''), | 321 ('ldap_attr_login', ''), ('ldap_attr_firstname', ''), |
320 ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]: | 322 ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]: |
321 | 323 |
324 if skip_existing and RhodeCodeSettings.get_by_name(k) != None: | |
325 log.debug('Skipping option %s' % k) | |
326 continue | |
322 setting = RhodeCodeSettings(k, v) | 327 setting = RhodeCodeSettings(k, v) |
323 self.sa.add(setting) | 328 self.sa.add(setting) |
324 self.sa.commit() | 329 self.sa.commit() |
325 except: | 330 except: |
326 self.sa.rollback() | 331 self.sa.rollback() |