Friday, December 6, 2019

[389-commits] [389-ds-base] 01/02: Issue 50586 - lib389 - Fix DSEldif long line processing

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.

commit d7ad34b04bc77a31f8d8f0dcd5a7231e4face4cc
Author: Simon Pichugin <spichugi@redhat.com>
AuthorDate: Thu Sep 5 20:16:08 2019 +0200

Issue 50586 - lib389 - Fix DSEldif long line processing

Description: When dse.ldif has a very long line inthe attribute value,
it puts it to the next line and adds ' '.
We should process it correctly in lib389.

https://pagure.io/389-ds-base/issue/50586

Reviewed by: mreynolds, mhonek (Thanks!)
---
src/lib389/lib389/dseldif.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/lib389/lib389/dseldif.py b/src/lib389/lib389/dseldif.py
index 36e7758..b994103 100644
--- a/src/lib389/lib389/dseldif.py
+++ b/src/lib389/lib389/dseldif.py
@@ -47,9 +47,16 @@ class DSEldif(object):
self.path = os.path.join(ds_paths.config_dir, 'dse.ldif')

with open(self.path, 'r') as file_dse:
+ processed_line = ""
for line in file_dse.readlines():
- if line.startswith('dn'):
- self._contents.append(line.lower())
+ if not line.startswith(' '):
+ if processed_line:
+ self._contents.append(processed_line)
+
+ if line.startswith('dn:'):
+ processed_line = line.lower()
+ else:
+ processed_line = line
else:
processed_line = processed_line[:-1] + line[1:]
self._lint_functions = [self._lint_nsstate]
@@ -84,6 +91,7 @@ class DSEldif(object):
report['fix'] = report['fix'].replace('YOUR_INSTANCE', self._instance.serverid)
yield report

+
def _update(self):
"""Update the dse.ldif with a new contents"""

@@ -348,3 +356,4 @@ class FSChecks(object):
report['fix'] = report['fix'].replace('FILE', ds_file[0])
report['fix'] = report['fix'].replace('PERMS', ds_file[1])
yield report
+

--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-commits@lists.fedoraproject.org

No comments:

Post a Comment