mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user