diff options
| author | Tomas Babej <tbabej@redhat.com> | 2015-11-11 14:23:43 +0100 |
|---|---|---|
| committer | Tomas Babej <tbabej@redhat.com> | 2015-11-26 12:18:08 +0100 |
| commit | 304c8694c4f945846ced5bf3cdaf18d899241876 (patch) | |
| tree | d8bff44de24e81d44519cbf68f3cf0fe894e9697 | |
| parent | b543c9a1374dabbbcfecec87c59f9995911f1cfd (diff) | |
| download | freeipa-304c8694c4f945846ced5bf3cdaf18d899241876.tar.gz freeipa-304c8694c4f945846ced5bf3cdaf18d899241876.tar.xz freeipa-304c8694c4f945846ced5bf3cdaf18d899241876.zip | |
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>
| -rw-r--r-- | ipa-client/ipaclient/ipachangeconf.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ipa-client/ipaclient/ipachangeconf.py b/ipa-client/ipaclient/ipachangeconf.py index 3d485adbd..e257c8222 100644 --- a/ipa-client/ipaclient/ipachangeconf.py +++ b/ipa-client/ipaclient/ipachangeconf.py @@ -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]): |
