launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25475
[Merge] ~cjwatson/launchpad:py3-mirror-prober-bytesio into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-mirror-prober-bytesio into launchpad:master.
Commit message:
Port the mirror prober to io.BytesIO
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392078
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-mirror-prober-bytesio into launchpad:master.
diff --git a/lib/lp/registry/scripts/distributionmirror_prober.py b/lib/lp/registry/scripts/distributionmirror_prober.py
index b1d2df0..0ed5eb9 100644
--- a/lib/lp/registry/scripts/distributionmirror_prober.py
+++ b/lib/lp/registry/scripts/distributionmirror_prober.py
@@ -7,6 +7,7 @@ __all__ = [
]
from datetime import datetime
+import io
import itertools
import logging
import os.path
@@ -959,9 +960,10 @@ class DistroMirrorProber:
"""
logfile.seek(0)
filename = '%s-probe-logfile.txt' % mirror.name
+ log_data = logfile.getvalue().encode('UTF-8')
log_file = getUtility(ILibraryFileAliasSet).create(
- name=filename, size=len(logfile.getvalue()),
- file=logfile, contentType='text/plain')
+ name=filename, size=len(log_data),
+ file=io.BytesIO(log_data), contentType='text/plain')
mirror.newProbeRecord(log_file)
def probe(self, content_type, no_remote_hosts, ignore_last_probe,