Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 error in repoquery #4183

Merged
merged 1 commit into from
May 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be hit by other items using _run (local ref). It may be a better fix to decode() before _run returns.

Here is what was done in lib_openshift.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 as b'' in Python 2 will become a str while staying bytes in 3.

]

# Act
Expand Down