Making celeryd consistent: look for mediagoblin_local.ini

Use mediagoblin_local.ini as default conf file if it exists, else use
mediagoblin.ini, just like everything else.
This commit is contained in:
Christopher Allan Webber 2012-04-22 14:09:47 -05:00
parent fe44915922
commit 80dc071b79

View File

@ -24,7 +24,7 @@ OUR_MODULENAME = __name__
def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME, def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME,
default_conf_file='mediagoblin.ini'): default_conf_file=None):
""" """
Transform this module into a celery config module by reading the Transform this module into a celery config module by reading the
mediagoblin config file. Set the environment variable mediagoblin config file. Set the environment variable
@ -35,6 +35,11 @@ def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME,
Note that if celery_setup_elsewhere is set in your config file, Note that if celery_setup_elsewhere is set in your config file,
this simply won't work. this simply won't work.
""" """
if os.path.exists(os.path.abspath('mediagoblin_local.ini')):
default_conf_file = 'mediagoblin_local.ini'
else:
default_conf_file = 'mediagoblin.ini'
if check_environ_for_conf: if check_environ_for_conf:
mgoblin_conf_file = os.path.abspath( mgoblin_conf_file = os.path.abspath(
os.environ.get('MEDIAGOBLIN_CONFIG', default_conf_file)) os.environ.get('MEDIAGOBLIN_CONFIG', default_conf_file))