Fix regression: Handle unicode where str is expected

Regression caused by 947ac4bc1f when
trying to fix a similar issue for clients running Python 3. However,
that fix broke Python 2 clients.

Issue: https://pagure.io/freeipa/issue/7626

Signed-off-by: Armando Neto <abiagion@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Armando Neto 2018-07-17 16:08:49 -03:00 committed by Christian Heimes
parent 4b2af2570a
commit 717d59e2fe
2 changed files with 8 additions and 1 deletions

View File

@ -608,7 +608,7 @@ def get_package(server_info, client):
s = topic['topic_topic']
if isinstance(s, bytes):
s = s.decode('utf-8')
module.topic = s.partition('/')[0]
module.topic = str(s).partition('/')[0]
else:
module.topic = None

View File

@ -180,3 +180,10 @@ class TestIPACommand(IntegrationTest):
["ipa", "console", filename],
)
assert "ipalib.config.Env" in result.stdout_text
def test_list_help_topics(self):
result = self.master.run_command(
["ipa", "help", "topics"],
raiseonerr=False
)
assert result.returncode == 0