Move plugin listing into config
diff --git a/etc/config.json b/etc/config.json
index d6a2e56..45665a7 100644
--- a/etc/config.json
+++ b/etc/config.json
@@ -6,5 +6,6 @@
},
"debug_log": "/home/josh/var/log/turbo-hipster/debug.log",
"git_working_dir": "/home/josh/var/lib/turbo-hipster/git/",
- "job_log_dir": "/home/josh/var/lib/turbo-hipster/logs/"
+ "job_log_dir": "/home/josh/var/lib/turbo-hipster/logs/",
+ "plugins": ["gate_real_db_upgrade"]
}
\ No newline at end of file
diff --git a/turbo_hipster/worker_server.py b/turbo_hipster/worker_server.py
index 827bbf2..6e3a2ad 100755
--- a/turbo_hipster/worker_server.py
+++ b/turbo_hipster/worker_server.py
@@ -42,6 +42,8 @@
def setup_logging(self):
if self.debug_log:
+ if not os.path.isdir(os.path.dirname(self.debug_log)):
+ os.makedirs(os.path.dirname(self.debug_log))
logging.basicConfig(format='%(asctime)s %(message)s',
filename=self.debug_log, level=logging.DEBUG)
else:
@@ -52,11 +54,13 @@
def load_plugins(self):
""" Load the available plugins from task_plugins """
# Load plugins
- for ent in os.listdir('task_plugins'):
- if (os.path.isdir('task_plugins/' + ent)
- and os.path.isfile('task_plugins/' + ent + '/task.py')):
- plugin_info = imp.find_module('task', ['task_plugins/' + ent])
- self.plugins.append(imp.load_module('task', *plugin_info))
+ for plugin in self.config['plugins']:
+ print
+ plugin_info = imp.find_module('task',
+ [(os.path.dirname(
+ os.path.realpath(__file__)) +
+ '/task_plugins/' + plugin)])
+ self.plugins.append(imp.load_module('task', *plugin_info))
def run_tasks(self):
""" Run the tasks """