summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-10-12 14:18:21 +0300
committerRob Crittenden <rcritten@redhat.com>2011-10-11 18:21:48 -0400
commit498311d2efdeacca0cbaaff68829b9e21da030eb (patch)
tree2440a02af558a7bf1ac958f106cd56fd6aad26d6
parent8badce286f9e50384b68e0f5e77e314fd48363db (diff)
downloadfreeipa-498311d2efdeacca0cbaaff68829b9e21da030eb.zip
freeipa-498311d2efdeacca0cbaaff68829b9e21da030eb.tar.gz
freeipa-498311d2efdeacca0cbaaff68829b9e21da030eb.tar.xz
Write KRB5REALM to /etc/sysconfig/krb5kdc and make use of common backup_config_and_replace_variables() tool
systemd service unit for krb5kdc in Fedora 16 uses KRB5REALM variable of /etc/sysconfig/krb5kdc to start krb5kdc for the default realm. Thus, we need to make sure it is always existing and pointing to our realm. Partial fix for: https://fedorahosted.org/freeipa/ticket/1192
-rw-r--r--ipaserver/install/krbinstance.py30
1 files changed, 9 insertions, 21 deletions
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index fbc802c..74e28bc 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -320,28 +320,16 @@ class KrbInstance(service.Service):
min = version.LooseVersion(MIN_KRB5KDC_WITH_WORKERS)
if ver >= min:
workers = True
+ # Write down config file
+ # We write realm and also number of workers (for multi-CPU systems)
+ replacevars = {'KRB5REALM':self.realm}
+ appendvars = {}
if workers and cpus > 1:
- #read in memory, find KRB5KDC_ARGS, check/change it, then overwrite file
- self.fstore.backup_file("/etc/sysconfig/krb5kdc")
-
- need_w = True
- fd = open("/etc/sysconfig/krb5kdc", "r")
- lines = fd.readlines()
- fd.close()
- for line in lines:
- sline = line.strip()
- if not sline.startswith('KRB5KDC_ARGS'):
- continue
- sline = sline.replace('"', '')
- if sline.find("-w") != -1:
- need_w = False
-
- if need_w:
- fd = open("/etc/sysconfig/krb5kdc", "w")
- for line in lines:
- fd.write(line)
- fd.write('KRB5KDC_ARGS="${KRB5KDC_ARGS} -w %s"\n' % str(cpus))
- fd.close()
+ appendvars = {'KRB5KDC_ARGS': "-w %s" % str(cpus)}
+ ipautil.backup_config_and_replace_variables(self.fstore, "/etc/sysconfig/krb5kdc",
+ replacevars=replacevars,
+ appendvars=appendvars)
+ ipaservices.restore_context("/etc/sysconfig/krb5kdc")
def __write_stash_from_ds(self):
try: