# NOTE(jkoelker) Register the event on all models that have ids
for _name, klass in inspect.getmembers(models, inspect.isclass):
if klass is models.HasId:
continue
if models.HasId in klass.mro():
event.listen(klass, "init", _perhaps_generate_id)
This causes issues because of a subtle interdependency. Reorganizing the plugin into separate submodules revealed this because the test ordering changed, causing the plugin to not be the first one to configure the database, which in turn means the event listener on all models with HasId set weren't generating UUIDs in some cases. From the looks of things, someone previously noticed this and set an assertIsNone on the entity UUID on some of the IPAM test cases instead of trying to figure out why it would assign an ID in some cases and not others :-1:
Specifically, the block:
This causes issues because of a subtle interdependency. Reorganizing the plugin into separate submodules revealed this because the test ordering changed, causing the plugin to not be the first one to configure the database, which in turn means the event listener on all models with HasId set weren't generating UUIDs in some cases. From the looks of things, someone previously noticed this and set an assertIsNone on the entity UUID on some of the IPAM test cases instead of trying to figure out why it would assign an ID in some cases and not others :-1: