ipachangeconf: Add ability to preserve section case

The IPAChangeConf normallizes section names to lower case. There are
cases where this behaviour might not be desirable, so provide a way to
opt out.

https://fedorahosted.org/freeipa/ticket/5069

Reviewed-By: Gabe Alford <redhatrises@gmail.com>
This commit is contained in:
Tomas Babej committed 2015-11-26 12:18:08 +01:00
1 parent b543c9a137
commit 304c8694c4
1 file changed
+4 -1
+4 -1
View File
@@ -63,6 +63,7 @@ class IPAChangeConf:
self.deol = self.eol[0]
self.sectnamdel = ("[", "]")
self.subsectdel = ("{", "}")
self.case_insensitive_sections = True
def setProgName(self, name):
self.progname = name
@@ -114,7 +115,9 @@ class IPAChangeConf:
return False
def matchSection(self, line):
cl = "".join(line.strip().split()).lower()
cl = "".join(line.strip().split())
cl = cl.lower() if self.case_insensitive_sections else cl
if len(self.sectnamdel) != 2:
return False
if not cl.startswith(self.sectnamdel[0]):