ipapython.ipautil.nolog_replace: Do not replace empty value

When provided empty value in nolog parameter nolog_replace added 'XXXXXXXX'
three (once for plain value, once for http quoted value and last time for shell
quoted value) times before every character (including terminating '\0') in the string.

https://pagure.io/freeipa/issue/6738

Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
This commit is contained in:
David Kupka 2017-03-20 12:48:14 +01:00 committed by Pavel Vomacka
parent 7f567286f6
commit 4297ad6db0

View File

@ -505,7 +505,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None,
def nolog_replace(string, nolog): def nolog_replace(string, nolog):
"""Replace occurences of strings given in `nolog` with XXXXXXXX""" """Replace occurences of strings given in `nolog` with XXXXXXXX"""
for value in nolog: for value in nolog:
if not isinstance(value, six.string_types): if not value or not isinstance(value, six.string_types):
continue continue
quoted = urllib.parse.quote(value) quoted = urllib.parse.quote(value)