diff options
-rw-r--r-- | ipaserver/install/dsinstance.py | 14 | ||||
-rw-r--r-- | ipaserver/install/krbinstance.py | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py index 830228da..761bae69 100644 --- a/ipaserver/install/dsinstance.py +++ b/ipaserver/install/dsinstance.py @@ -30,6 +30,7 @@ import time import tempfile from ipapython import ipautil +from ipapython import sysrestore import service import installutils @@ -184,6 +185,12 @@ class DsInstance(service.Service): else: self.suffix = None + if fstore: + self.fstore = fstore + else: + self.fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore') + + def create_instance(self, ds_user, realm_name, fqdn, domain_name, dm_password, pkcs12_info=None, self_signed_ca=False, idstart=1100, idmax=999999, subject_base=None, @@ -282,6 +289,7 @@ class DsInstance(service.Service): def __create_instance(self): self.backup_state("running", is_ds_running()) self.backup_state("serverid", self.serverid) + self.fstore.backup_file("/etc/sysconfig/dirsrv") self.sub_dict['BASEDC'] = self.realm_name.split('.')[0].lower() base_txt = ipautil.template_str(BASE_TEMPLATE, self.sub_dict) @@ -523,6 +531,12 @@ class DsInstance(service.Service): if not running is None: self.stop() + try: + self.fstore.restore_file("/etc/sysconfig/dirsrv") + except ValueError, error: + logging.debug(error) + pass + if not enabled is None and not enabled: self.chkconfig_off() diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py index e0d040dc..41c68789 100644 --- a/ipaserver/install/krbinstance.py +++ b/ipaserver/install/krbinstance.py @@ -514,7 +514,6 @@ class KrbInstance(service.Service): self.fstore.backup_file("/etc/dirsrv/ds.keytab") installutils.create_keytab("/etc/dirsrv/ds.keytab", ldap_principal) - self.fstore.backup_file("/etc/sysconfig/dirsrv") update_key_val_in_file("/etc/sysconfig/dirsrv", "export KRB5_KTNAME", "/etc/dirsrv/ds.keytab") pent = pwd.getpwnam(self.ds_user) os.chown("/etc/dirsrv/ds.keytab", pent.pw_uid, pent.pw_gid) |