summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-07-18 09:33:57 +0200
committerMartin Kosek <mkosek@redhat.com>2011-07-18 09:36:43 +0200
commit50a2c45760d51e7a13888702e1a047a113bc1f5e (patch)
tree26445179b4e7a072800072f78a1cf5cf1a5740e1 /ipaserver
parent5f0adc3fbe5b193a57b05eed70b9f59463d9d9da (diff)
downloadfreeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.zip
freeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.tar.gz
freeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.tar.xz
Check IPA configuration in install tools
Install tools may fail with unexpected error when IPA server is not installed on a system. Improve user experience by implementing a check to affected tools. https://fedorahosted.org/freeipa/ticket/1327 https://fedorahosted.org/freeipa/ticket/1347
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/installutils.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 68fce7e..ba49eb8 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -32,8 +32,7 @@ import time
import tempfile
from ConfigParser import SafeConfigParser
-from ipapython import ipautil
-from ipapython import dnsclient
+from ipapython import ipautil, dnsclient, sysrestore
class HostnameLocalhost(Exception):
pass
@@ -499,3 +498,19 @@ def read_replica_info(dir, rconfig):
rconfig.domain_name = config.get("realm", "domain_name")
rconfig.host_name = config.get("realm", "destination_host")
rconfig.subject_base = config.get("realm", "subject_base")
+
+def check_server_configuration():
+ """
+ Check if IPA server is configured on the system.
+
+ This is done by checking if there are system restore (uninstall) files
+ present on the system. Note that this check can only be run with root
+ privileges.
+
+ When IPA is not configured, this function raises a RuntimeError exception.
+ Most convenient use case for the function is in install tools that require
+ configured IPA for its function.
+ """
+ server_fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore')
+ if not server_fstore.has_files():
+ raise RuntimeError("IPA is not configured on this system.")