Commit 270e7aed by Jenkins Committed by Gerrit Code Review

Merge "conductor saves version in db"

parents 08173a56 8a982282
......@@ -110,9 +110,11 @@ class Conductor(base.IronicObject, object_base.VersionedObjectDictCompat):
:returns: a :class:`Conductor` object.
db_cond = cls.dbapi.register_conductor({'hostname': hostname,
'drivers': drivers},
db_cond = cls.dbapi.register_conductor(
{'hostname': hostname,
'drivers': drivers,
'version': cls.get_target_version()},
return cls._from_db_object(context, cls(), db_cond)
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
......@@ -20,6 +20,7 @@ import mock
from oslo_utils import timeutils
from ironic import objects
from ironic.objects import base
from ironic.objects import fields
from ironic.tests.unit.db import base as db_base
from ironic.tests.unit.db import utils as db_utils
......@@ -86,7 +87,9 @@ class TestConductorObject(db_base.DbTestCase):
self.assertEqual(expected, mock_get_cdr.call_args_list)
self.assertEqual(self.context, c._context)
def _test_register(self, update_existing=False):
@mock.patch.object(base.IronicObject, 'get_target_version')
def _test_register(self, mock_target_version, update_existing=False):
mock_target_version.return_value = '1.5'
host = self.fake_conductor['hostname']
drivers = self.fake_conductor['drivers']
with mock.patch.object(self.dbapi, 'register_conductor',
......@@ -97,7 +100,9 @@ class TestConductorObject(db_base.DbTestCase):
self.assertIsInstance(c, objects.Conductor)
{'drivers': drivers, 'hostname': host},
{'drivers': drivers,
'hostname': host,
'version': '1.5'},
def test_register(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment