diff --git a/brewtils/decorators.py b/brewtils/decorators.py index 29cb0331..08781c88 100644 --- a/brewtils/decorators.py +++ b/brewtils/decorators.py @@ -519,8 +519,9 @@ def _parse_shutdown_functions(client): shutdown_functions = [] for attr in dir(client): - if callable(attr) and getattr(attr, "_shutdown", False): - shutdown_functions.append(attr) + method = getattr(client, attr) + if callable(method) and getattr(method, "_shutdown", False): + shutdown_functions.append(method) return shutdown_functions diff --git a/brewtils/plugin.py b/brewtils/plugin.py index cb50a33b..16118164 100644 --- a/brewtils/plugin.py +++ b/brewtils/plugin.py @@ -224,7 +224,7 @@ def __init__(self, client=None, system=None, logger=None, **kwargs): # Need to pop out shutdown functions because these are not processed # until shutdown self._arg_shutdown_functions = kwargs.pop("shutdown_functions", []) - if hasattr(kwargs, "shutdown_function"): + if "shutdown_function" in kwargs: self._arg_shutdown_functions.append(kwargs.pop("shutdown_function")) # Now that logging is configured we can load the real config @@ -541,7 +541,7 @@ def _shutdown(self, status="STOPPED"): self._logger.debug("About to run annotated shutdown functions") executed_shutdown_functions = self._run_shutdown_functions( - _parse_shutdown_functions(self.client) + _parse_shutdown_functions(self._client) ) self._logger.debug("About to run plugin shutdown functions")