From f7ae3f47a267222b7a85658ce6518e0091c26124 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Fri, 27 Jan 2017 15:43:30 -0800 Subject: [PATCH] dbscan - Support additional options (-t truncate -R) --- lib389/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib389/__init__.py b/lib389/__init__.py index 7b8d8eb..389beae 100644 --- a/lib389/__init__.py +++ b/lib389/__init__.py @@ -2711,12 +2711,14 @@ class DirSrv(SimpleLDAPObject, object): return result - def dbscan(self, bename=None, index=None, key=None): + def dbscan(self, bename=None, index=None, key=None, width=None, isRaw=False): """ @param bename - The backend name to scan @param index - index name (e.g., cn or cn.db) to scan @param key - index key to dump @param id - entry id to dump + @param width - entry truncate size (bytes) + @param isRaw - dump as raw data @return - dumped string """ DirSrvTools.lib389User(user=DEFAULT_USER) @@ -2732,7 +2734,7 @@ class DirSrv(SimpleLDAPObject, object): elif '.db' in index: indexfile = os.path.join(self.dbdir, bename, index) else: - indexfile = os.path.join(self.dbdir, bename, index) + indexfile = os.path.join(self.dbdir, bename, index + '.db') option = '' if 'id2entry' in index: @@ -2742,6 +2744,12 @@ class DirSrv(SimpleLDAPObject, object): if key: option = ' -k %s' % key + if width: + option = option + ' -t %d' % width + + if isRaw: + option = option + ' -R' + cmd = '%s -f %s' % (prog, indexfile) if len(option) > 0: -- 2.9.3