Skip to content

Commit

Permalink
Fix python3 error in repoquery
Browse files Browse the repository at this point in the history
Explicitly convert from bytes to string so that splitting the string is
successful. This change works with python 2 as well.

Closes #4182
  • Loading branch information
Jeff Peeler committed May 13, 2017
1 parent 56cc912 commit 7fb814d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roles/lib_utils/library/repoquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def process_versions(query_output):

version_dict = defaultdict(dict)

for version in query_output.split('\n'):
for version in query_output.decode().split('\n'):
pkg_info = version.split("|")

pkg_version = {}
Expand Down
2 changes: 1 addition & 1 deletion roles/lib_utils/src/class/repoquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def process_versions(query_output):

version_dict = defaultdict(dict)

for version in query_output.split('\n'):
for version in query_output.decode().split('\n'):
pkg_info = version.split("|")

pkg_version = {}
Expand Down
2 changes: 1 addition & 1 deletion roles/lib_utils/src/test/unit/test_repoquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_querying_a_package(self, mock_cmd):

# Return values of our mocked function call. These get returned once per call.
mock_cmd.side_effect = [
(0, '4.2.46|21.el7_3|x86_64|rhel-7-server-rpms|4.2.46-21.el7_3', valid_stderr), # first call to the mock
(0, b'4.2.46|21.el7_3|x86_64|rhel-7-server-rpms|4.2.46-21.el7_3', valid_stderr), # first call to the mock
]

# Act
Expand Down

0 comments on commit 7fb814d

Please sign in to comment.