Add extra checks for the existance of executor_callback

In version of oslo.messaging > 4.6.1, the __call__ method of
dispatcher.RPCDispatcher no longer exists. It is now a 'method-wrapper'
from the "object" object.

Calling inspect.getargspec on a method-wrapper doesn't work
TypeError: <method-wrapper '__call__' of ABCMeta object at 0x2cc3650> is not a Python function

Change-Id: Ie2ca1a2b9163a5edfe1e779cff462692197a471d
This commit is contained in:
Derek Higgins 2016-04-14 08:41:59 +01:00
parent 11c26cffcc
commit 22769b7c70

@ -40,7 +40,9 @@ _EXECUTOR_CLIENT = None
# Declare different classes for < 4.4.0 oslo_messaging
# and >= 4.4.0 oslo_messaging:
# >= 4.4.0 doesn't contain 'executor_callback' argument anymore.
if 'executor_callback' in inspect.getargspec(
# > 4.6.1 dispatcher.RPCDispatcher doesn't have a __call__ method.
if inspect.ismethod(dispatcher.RPCDispatcher.__call__) and \
'executor_callback' in inspect.getargspec(
dispatcher.RPCDispatcher.__call__
).args:
# For < 4.4.0.