summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/dsinstance.py
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-11-17 12:25:01 -0500
committerAdam Young <ayoung@redhat.com>2010-11-22 12:42:16 -0500
commit733dc89f753629d47a89340e8efa3647bf55e5bb (patch)
tree3479f100ef4db064b95eb7c312449dacf85c16bc /ipaserver/install/dsinstance.py
parent6a5c4763afad6fec2b49ffadbca9628a7ed162d5 (diff)
downloadfreeipa-733dc89f753629d47a89340e8efa3647bf55e5bb.zip
freeipa-733dc89f753629d47a89340e8efa3647bf55e5bb.tar.gz
freeipa-733dc89f753629d47a89340e8efa3647bf55e5bb.tar.xz
Save and restore on uninstall ds related config files
Diffstat (limited to 'ipaserver/install/dsinstance.py')
-rw-r--r--ipaserver/install/dsinstance.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 830228d..761bae6 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()