launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25910
[Merge] ~cjwatson/launchpad:fix-stormify-builder into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-builder into launchpad:master.
Commit message:
Fix SlaveScanner.updateVersion after porting Builder to Storm
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395729
slave_status['version'] apparently comes back from XML-RPC as a native string, so account for that.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-stormify-builder into launchpad:master.
diff --git a/lib/lp/buildmaster/manager.py b/lib/lp/buildmaster/manager.py
index 64fdb21..5cf5543 100644
--- a/lib/lp/buildmaster/manager.py
+++ b/lib/lp/buildmaster/manager.py
@@ -595,7 +595,7 @@ class SlaveScanner:
def updateVersion(self, vitals, slave_status):
"""Update the DB's record of the slave version if necessary."""
- version = slave_status.get("builder_version")
+ version = six.ensure_text(slave_status.get("builder_version"))
if version != vitals.version:
self.builder_factory[self.builder_name].version = version
transaction.commit()
diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py
index 18e8379..2b00f76 100644
--- a/lib/lp/buildmaster/tests/test_manager.py
+++ b/lib/lp/buildmaster/tests/test_manager.py
@@ -13,6 +13,7 @@ import os
import signal
import time
+import six
from six.moves import xmlrpc_client
from testtools.matchers import Equals
from testtools.testcase import ExpectedException
@@ -592,7 +593,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
def test_update_slave_version(self):
# If the reported slave version differs from the DB's record of it,
# then scanning the builder updates the DB.
- slave = OkSlave(version="100")
+ slave = OkSlave(version=six.ensure_str("100"))
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
builder.version = "99"
self._resetBuilder(builder)
@@ -610,7 +611,8 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
vitals = extract_vitals_from_db(builder)
scanner = self._getScanner()
with StormStatementRecorder() as recorder:
- scanner.updateVersion(vitals, {"builder_version": "100"})
+ scanner.updateVersion(
+ vitals, {"builder_version": six.ensure_str("100")})
self.assertThat(recorder, HasQueryCount(Equals(0)))
@defer.inlineCallbacks