Merge lp:~gocept/landscape-client/py3-sysstats into lp:~landscape/landscape-client/trunk

Proposed by Steffen Allner
Status: Merged
Approved by: Данило Шеган
Approved revision: 959
Merged at revision: 948
Proposed branch: lp:~gocept/landscape-client/py3-sysstats
Merge into: lp:~landscape/landscape-client/trunk
Prerequisite: lp:~gocept/landscape-client/python3
Diff against target: 14 lines (+3/-2)
1 file modified
landscape/lib/sysstats.py (+3/-2)
To merge this branch: bzr merge lp:~gocept/landscape-client/py3-sysstats
Reviewer Review Type Date Requested Status
Simon Poirier (community) Approve
Alberto Donato (community) Approve
🤖 Landscape Builder test results Approve
Gocept Pending
Review via email: mp+319441@code.launchpad.net

Commit message

Decode stdout strings from ASCII in landscape.lib.sysstats to support both Python 2 and 3.

Description of the change

We are on the journey to get the Bytes / String story solved for Python 2/3 compatibility.

This MP considers code in the landscape.lib.sysstats module which renders different status information of the system. To properly handle the information about logged in users, we need to improve convert the bytes to string for the error message and the return value.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Fail
Revno: 959
Branch: lp:~gocept/landscape-client/py3-sysstats
Jenkins: https://ci.lscape.net/job/latch-test-precise/904/

review: Needs Fixing (test results)
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: TRIAL_ARGS=-j4 make check
Result: Success
Revno: 959
Branch: lp:~gocept/landscape-client/py3-sysstats
Jenkins: https://ci.lscape.net/job/latch-test-xenial/1468/

review: Approve (test results)
Revision history for this message
Alberto Donato (ack) wrote :

+1

review: Approve
Revision history for this message
Simon Poirier (simpoir) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/lib/sysstats.py'
2--- landscape/lib/sysstats.py 2017-03-09 12:35:27 +0000
3+++ landscape/lib/sysstats.py 2017-03-09 12:35:28 +0000
4@@ -60,8 +60,9 @@
5 def parse_output(args):
6 stdout_data, stderr_data, status = args
7 if status != 0:
8- raise CommandError(stderr_data)
9- first_line = stdout_data.split("\n", 1)[0]
10+ raise CommandError(stderr_data.decode('ascii'))
11+ first_line = stdout_data.split(b"\n", 1)[0]
12+ first_line = first_line.decode('ascii')
13 return sorted(set(first_line.split()))
14 return result.addCallback(parse_output)
15

Subscribers

People subscribed via source and target branches

to all changes: