ovsdb-subordinate: Gate available state on presence of chassis_name
Change-Id: Id04d2c33fef71c345e1f591d9e5259a834262260 Closes-Bug: #1893446
This commit is contained in:
parent
78d6c208b4
commit
93e40a6bd5
@ -129,7 +129,10 @@ class OVSDBSubordinateRequires(Endpoint):
|
||||
@when('endpoint.{endpoint_name}.joined')
|
||||
def joined(self):
|
||||
reactive.set_flag(self.expand_name('{endpoint_name}.connected'))
|
||||
reactive.set_flag(self.expand_name('{endpoint_name}.available'))
|
||||
if self.chassis_name:
|
||||
reactive.set_flag(self.expand_name('{endpoint_name}.available'))
|
||||
else:
|
||||
reactive.clear_flag(self.expand_name('{endpoint_name}.available'))
|
||||
|
||||
@when_not('endpoint.{endpoint_name}.joined')
|
||||
def broken(self):
|
||||
|
@ -112,6 +112,12 @@ class TestOVSDBSubordinateRequires(test_utils.PatchHelper):
|
||||
def test_joined(self):
|
||||
self.patch_object(requires.reactive, 'set_flag')
|
||||
self.target.joined()
|
||||
self.set_flag.assert_called_once_with('some-relation.connected')
|
||||
# available flag should be set when there is a value for chassis_name
|
||||
self.patch_target('_all_joined_units')
|
||||
self._all_joined_units.received.get.return_value = 'some.fqdn'
|
||||
self.set_flag.reset_mock()
|
||||
self.target.joined()
|
||||
self.set_flag.assert_has_calls([
|
||||
mock.call('some-relation.connected'),
|
||||
mock.call('some-relation.available'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user