Handle if "TRUNK_SKELETON" is not loaded

If "TRUNK_SKELETON" has not been initialized, the "unregister" method
should finish gracefully. This issue is happening in fullstalk tests,
where the trunk initialization is not executed if "trunk" is not in
the service plugins.

Closes-Bug: #2000314
Change-Id: Idef5fd8feaf1af309862d6cb3e06da3734fb6c19
This commit is contained in:
Rodolfo Alonso Hernandez
2022-12-13 16:36:14 +01:00
parent 7471b8590c
commit 9401da6c7c

View File

@@ -105,4 +105,7 @@ def init_handler(resource, event, trigger, payload=None):
def unregister():
"""Cleanup fanout queues"""
global TRUNK_SKELETON
TRUNK_SKELETON.unregister()
try:
TRUNK_SKELETON.unregister()
except AttributeError:
pass