Merge lp:~simpoir/landscape-client/py3fix-apt-sources-replace into lp:~landscape/landscape-client/trunk

Proposed by Simon Poirier
Status: Merged
Approved by: Simon Poirier
Approved revision: 1015
Merged at revision: 1017
Proposed branch: lp:~simpoir/landscape-client/py3fix-apt-sources-replace
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 101 lines (+18/-18)
2 files modified
landscape/manager/aptsources.py (+11/-11)
landscape/manager/tests/test_aptsources.py (+7/-7)
To merge this branch: bzr merge lp:~simpoir/landscape-client/py3fix-apt-sources-replace
Reviewer Review Type Date Requested Status
Chad Smith Approve
🤖 Landscape Builder test results Approve
Eric Snow (community) Approve
Review via email: mp+322394@code.launchpad.net

Commit message

Assume byte for content of apt-sources, as sent by the server.

Description of the change

Assume byte for content of apt-sources, as sent by the server.

Testing instructions:

source ./dev/setup-api
landscape-api create-repository-profile repo_prof
landscape-api associate-repository-profile repo_prof --all-computers
approve the activity in the UI
verify the content of /etc/apt/sources.list.d/landscape-repo_prof.list

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 ci-check
Result: Success
Revno: 1014
Branch: lp:~simpoir/landscape-client/py3fix-apt-sources-replace
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3871/

review: Approve (test results)
Revision history for this message
Eric Snow (ericsnowcurrently) :
review: Needs Information
Revision history for this message
Eric Snow (ericsnowcurrently) wrote :

Other than a small nit, LGTM.

review: Approve
1015. By Simon Poirier

fix docstring sample

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 ci-check
Result: Success
Revno: 1015
Branch: lp:~simpoir/landscape-client/py3fix-apt-sources-replace
Jenkins: https://ci.lscape.net/job/latch-test-xenial/3873/

review: Approve (test results)
Revision history for this message
Chad Smith (chad.smith) wrote :

Tested w/ multiple apt sources in the repo. worked fine against existing landscape installations.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/manager/aptsources.py'
2--- landscape/manager/aptsources.py 2017-04-05 14:19:27 +0000
3+++ landscape/manager/aptsources.py 2017-04-11 22:00:55 +0000
4@@ -69,18 +69,18 @@
5 {"sources": [
6 {"name": "repository-name",
7 "content":
8- "deb http://archive.ubuntu.com/ubuntu/ maverick main\n\
9- "deb-src http://archive.ubuntu.com/ubuntu/ maverick main"}
10+ b"deb http://archive.ubuntu.com/ubuntu/ maverick main\n"
11+ b"deb-src http://archive.ubuntu.com/ubuntu/ maverick main"}
12 {"name": "repository-name-dev",
13 "content":
14- "deb http://archive.ubuntu.com/ubuntu/ maverick universe\n\
15- "deb-src http://archive.ubuntu.com/ubuntu/ maverick universe"}],
16- "gpg-keys": ["-----BEGIN PGP PUBLIC KEY BLOCK-----\n\
17- XXXX
18- -----END PGP PUBLIC KEY BLOCK-----",
19- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\
20- YYY
21- -----END PGP PUBLIC KEY BLOCK-----"]}
22+ b"deb http://archive.ubuntu.com/ubuntu/ maverick universe\n"
23+ b"deb-src http://archive.ubuntu.com/ubuntu/ maverick universe"}],
24+ "gpg-keys": ["-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
25+ "XXXX"
26+ "-----END PGP PUBLIC KEY BLOCK-----",
27+ "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
28+ "YYY"
29+ "-----END PGP PUBLIC KEY BLOCK-----"]}
30 """
31 deferred = succeed(None)
32 for key in message["gpg-keys"]:
33@@ -128,7 +128,7 @@
34 for source in sources:
35 filename = os.path.join(self.SOURCES_LIST_D,
36 "landscape-%s.list" % source["name"])
37- with open(filename, "w") as sources_file:
38+ with open(filename, "wb") as sources_file:
39 sources_file.write(source["content"])
40 os.chmod(filename, 0o644)
41 return self._run_reporter().addCallback(lambda ignored: None)
42
43=== modified file 'landscape/manager/tests/test_aptsources.py'
44--- landscape/manager/tests/test_aptsources.py 2017-04-05 15:59:20 +0000
45+++ landscape/manager/tests/test_aptsources.py 2017-04-11 22:00:55 +0000
46@@ -53,7 +53,7 @@
47
48 self.manager.dispatch_message(
49 {"type": "apt-sources-replace",
50- "sources": [{"name": "bla", "content": ""}],
51+ "sources": [{"name": "bla", "content": b""}],
52 "gpg-keys": [],
53 "operation-id": 1})
54
55@@ -73,7 +73,7 @@
56
57 self.manager.dispatch_message(
58 {"type": "apt-sources-replace",
59- "sources": [{"name": "bla", "content": ""}],
60+ "sources": [{"name": "bla", "content": b""}],
61 "gpg-keys": [],
62 "operation-id": 1})
63
64@@ -97,7 +97,7 @@
65
66 self.manager.dispatch_message(
67 {"type": "apt-sources-replace",
68- "sources": [{"name": "bla", "content": ""}],
69+ "sources": [{"name": "bla", "content": b""}],
70 "gpg-keys": [],
71 "operation-id": 1})
72
73@@ -153,7 +153,7 @@
74
75 self.manager.dispatch_message(
76 {"type": "apt-sources-replace",
77- "sources": [{"name": "bla", "content": ""}],
78+ "sources": [{"name": "bla", "content": b""}],
79 "gpg-keys": [],
80 "operation-id": 1})
81
82@@ -183,7 +183,7 @@
83
84 self.manager.dispatch_message(
85 {"type": "apt-sources-replace",
86- "sources": [{"name": "bla", "content": ""}],
87+ "sources": [{"name": "bla", "content": b""}],
88 "gpg-keys": [],
89 "operation-id": 1})
90
91@@ -230,8 +230,8 @@
92 For every sources listed in the sources field of the message,
93 C{AptSources} creates a file with the content in sources.list.d.
94 """
95- sources = [{"name": "dev", "content": "oki\n"},
96- {"name": "lucid", "content": "doki\n"}]
97+ sources = [{"name": "dev", "content": b"oki\n"},
98+ {"name": "lucid", "content": b"doki\n"}]
99 self.manager.dispatch_message(
100 {"type": "apt-sources-replace", "sources": sources, "gpg-keys": [],
101 "operation-id": 1})

Subscribers

People subscribed via source and target branches

to all changes: