diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2014-12-09 13:49:21 +0000 |
---|---|---|
committer | Your Name <you@example.com> | 2016-06-28 20:23:02 +0000 |
commit | d3626d97e93f9a7f89a190bc9cee771020c0f991 (patch) | |
tree | fe48a8bfe3b0806a190ceac74f08050cf3f90b5f | |
parent | 1f0c8156017ce950295240bde3c0d10dd236a1a8 (diff) | |
download | turbo-hipster-baserock/pedroalvarez/zuul-ci.tar.gz |
Make plugin loading work properlybaserock/pedroalvarez/zuul-ci
-rw-r--r-- | turbo_hipster/worker_server.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/turbo_hipster/worker_server.py b/turbo_hipster/worker_server.py index c59c2ef..c3db2b9 100644 --- a/turbo_hipster/worker_server.py +++ b/turbo_hipster/worker_server.py @@ -17,6 +17,7 @@ import logging import os +import sys import threading import yaml @@ -118,12 +119,16 @@ class Server(threading.Thread): if 'plugins' in self.config: for plugin in self.config['plugins']: try: - if plugin['pythonpath'] not in sys.path: - sys.path.append(plugin['pythonpath']) - module = __import__('turbo_hipster.task_plugins.' + - plugin['name'] + '.task', - fromlist='turbo_hipster.task_plugins' + - plugin['name']) + if plugin['location'] not in sys.path: + sys.path.append(plugin['location']) + if plugin['import-path']: + module = __import__(plugin['import-path'], + fromlist='.'.join(plugin['import-path'].split('.')[:-1])) + else: + module = __import__('turbo_hipster.task_plugins.' + + plugin['name'] + '.task', + fromlist='turbo_hipster.task_plugins' + + plugin['name']) self.jobs[plugin['function']] = { 'name': plugin['function'], |