Merge commit '546441d49920caf43eb7d33976c2d71ae85f16d5'
* commit '546441d49920caf43eb7d33976c2d71ae85f16d5': unify routers, add support for mysql and pgsql tasks
This commit is contained in:
commit
589373a693
2 changed files with 8 additions and 16 deletions
1
gvaldap/gvacommon/.gitignore
vendored
1
gvaldap/gvacommon/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
.*.swp
|
.*.swp
|
||||||
*.pyc
|
*.pyc
|
||||||
|
.ropeproject/
|
||||||
|
|
|
@ -2,23 +2,14 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
class LdapRouter(object):
|
class GvaRouter(object):
|
||||||
|
|
||||||
def route_for_task(self, task, args=None, kwargs=None):
|
def route_for_task(self, task, args=None, kwargs=None):
|
||||||
if 'ldap' in task:
|
for route in ['ldap', 'file', 'mysql', 'pgsql']:
|
||||||
return {'exchange': 'ldap',
|
if route in task:
|
||||||
|
return {
|
||||||
|
'exchange': route,
|
||||||
'exchange_type': 'direct',
|
'exchange_type': 'direct',
|
||||||
'queue': 'ldap'}
|
'queue': route,
|
||||||
|
}
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class FileRouter(object):
|
|
||||||
|
|
||||||
def route_for_task(self, task, args=None, kwargs=None):
|
|
||||||
if 'file' in task:
|
|
||||||
return {'exchange': 'file',
|
|
||||||
'exchange_type': 'direct',
|
|
||||||
'queue': 'file'}
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue