summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-10-26 12:54:38 +0100
committerStephen Gallagher <sgallagh@redhat.com>2009-10-26 08:21:36 -0400
commitda99fdfa21f70f5d2f1524eff20a034e9e1d6b71 (patch)
treeb1d50e9b1bde5d619781fa00f33138d046e5fdb6
parent28f5f91623e3d420ec8b8c81c165e1ff530b170a (diff)
downloadsssd-da99fdfa21f70f5d2f1524eff20a034e9e1d6b71.tar.gz
sssd-da99fdfa21f70f5d2f1524eff20a034e9e1d6b71.tar.bz2
sssd-da99fdfa21f70f5d2f1524eff20a034e9e1d6b71.zip
Fix migration script for pre-0.5 local domains
Configuration files before 0.5.0 did not enforce provider= in local domains it did special-case by domain name (LOCAL). Our script was relying on provider= value, this patch adds the special-casing in case the domain was called LOCAL.
-rw-r--r--server/upgrade/upgrade_config.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/upgrade/upgrade_config.py b/server/upgrade/upgrade_config.py
index 87e3990d..fe208112 100644
--- a/server/upgrade/upgrade_config.py
+++ b/server/upgrade/upgrade_config.py
@@ -25,6 +25,7 @@ import sys
import shutil
import traceback
from ConfigParser import RawConfigParser
+from ConfigParser import NoOptionError
from optparse import OptionParser
class SSSDConfigParser(RawConfigParser):
@@ -211,11 +212,19 @@ class SSSDConfigFile(object):
self._migrate_kw(new_domsec, old_domsec, ldap_kw)
self._migrate_kw(new_domsec, old_domsec, krb5_kw)
+ # configuration files before 0.5.0 did not enforce provider= in local domains
+ # it did special-case by domain name (LOCAL)
+ try:
+ prv = self._new_config.get(new_domsec, 'id_provider')
+ except NoOptionError:
+ if old_domsec == 'domains/LOCAL':
+ prv = 'local'
+ self._new_config.set(new_domsec, 'id_provider', prv)
+
# if domain was local, update with parameters from [user_defaults]
- if self._new_config.get(new_domsec, 'id_provider') == 'local':
+ if prv == 'local':
self._migrate_kw(new_domsec, 'user_defaults', user_defaults_kw)
-
def _migrate_domains(self):
for domain in [ s.replace('domains/','') for s in self._config.sections() if s.startswith("domains/") ]:
domain = domain.strip()