From cd6d865e271183901d9dec5668f0c3adc478c933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=81=BA=28Xia=20Kai=29?= Date: Tue, 15 Mar 2016 10:01:31 +0000 Subject: [PATCH] use __mro__ for plugin loading when we search for its base class. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This would relax the constraint a little bit, allowing subclassing existing plugins. Signed-off-by: 夏恺(Xia Kai) --- lib/ansible/plugins/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index 139e5a7d61..afeab7a103 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -329,7 +329,7 @@ class PluginLoader: obj = getattr(self._module_cache[path], self.class_name) else: obj = getattr(self._module_cache[path], self.class_name)(*args, **kwargs) - if self.base_class and self.base_class not in [base.__name__ for base in obj.__class__.__bases__]: + if self.base_class and self.base_class not in [base.__name__ for base in obj.__class__.__mro__]: return None return obj