summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipaserver/installutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/ipaserver/installutils.py')
-rw-r--r--ipa-server/ipaserver/installutils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ipa-server/ipaserver/installutils.py b/ipa-server/ipaserver/installutils.py
index ee3c1c777..674cf7d04 100644
--- a/ipa-server/ipaserver/installutils.py
+++ b/ipa-server/ipaserver/installutils.py
@@ -200,6 +200,24 @@ def update_file(filename, orig, subst):
print "File %s doesn't exist." % filename
return 1
+def set_directive(filename, directive, value):
+ """Set a name/value pair directive in a configuration file.
+
+ This has only been tested with nss.conf
+ """
+ fd = open(filename)
+ file = []
+ for line in fd:
+ if directive in line:
+ file.append('%s "%s"\n' % (directive, value))
+ else:
+ file.append(line)
+ fd.close()
+
+ fd = open(filename, "w")
+ fd.write("".join(file))
+ fd.close()
+
def kadmin(command):
ipautil.run(["/usr/kerberos/sbin/kadmin.local", "-q", command])