++routing tests
This commit is contained in:
parent
2e6c72c093
commit
1922a0d92d
2 changed files with 14 additions and 16 deletions
|
@ -200,15 +200,15 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch("dc=example,dc=com",
|
||||||
# where to create customers
|
# where to create customers
|
||||||
LDAP_CUSTOMER_DN="ou=customer,dc=example,dc=com"
|
LDAP_CUSTOMER_DN="ou=customer,dc=example,dc=com"
|
||||||
|
|
||||||
def route_task(name, args, kwargs, options, task=None, **kw):
|
# def route_task(name, args, kwargs, options, task=None, **kw):
|
||||||
print(f"{name} - {args} - {kwargs}")
|
# print(f"{name} - {args} - {kwargs}")
|
||||||
# if name == 'myapp.tasks.compress_video':
|
# # if name == 'myapp.tasks.compress_video':
|
||||||
return {'queue': 'vpn1' }
|
# return {'queue': 'vpn1' }
|
||||||
# 'exchange_type': 'topic',
|
# # 'exchange_type': 'topic',
|
||||||
# 'routing_key': 'video.compress'}
|
# # 'routing_key': 'video.compress'}
|
||||||
|
|
||||||
|
|
||||||
CELERY_TASK_ROUTES = (route_task,)
|
# CELERY_TASK_ROUTES = (route_task,)
|
||||||
|
|
||||||
# CELERY_TASK_ROUTES = {
|
# CELERY_TASK_ROUTES = {
|
||||||
# '*': {
|
# '*': {
|
||||||
|
@ -220,7 +220,9 @@ CELERY_TASK_ROUTES = (route_task,)
|
||||||
CELERY_BROKER_URL = 'redis://:uncloud.example.com:6379/0'
|
CELERY_BROKER_URL = 'redis://:uncloud.example.com:6379/0'
|
||||||
CELERY_RESULT_BACKEND = 'redis://:uncloud.example.com:6379/0'
|
CELERY_RESULT_BACKEND = 'redis://:uncloud.example.com:6379/0'
|
||||||
|
|
||||||
CELERY_TASK_ROUTES = ( [ (re.compile(r'.*\.cdist\..*'), { 'queue': 'cdist' }), ], )
|
CELERY_TASK_ROUTES = {
|
||||||
|
re.compile(r'cdist.*'): { 'queue': 'cdist' }
|
||||||
|
}
|
||||||
|
|
||||||
# CELERY_TASK_CREATE_MISSING_QUEUES = False
|
# CELERY_TASK_CREATE_MISSING_QUEUES = False
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,9 @@ def configure_wireguard_server(wireguardvpnpool):
|
||||||
config = wireguardvpnpool.wireguard_config
|
config = wireguardvpnpool.wireguard_config
|
||||||
server = wireguardvpnpool.vpn_server_hostname
|
server = wireguardvpnpool.vpn_server_hostname
|
||||||
|
|
||||||
print(f"Configuring VPN server {server}")
|
print(f"Configuring VPN server {server} (async)")
|
||||||
#res = cdist_configure_wireguard_server.delay(config, server)
|
# cdist_configure_wireguard_server.apply_async((config, server), queue='cdist')
|
||||||
res = cdist_configure_wireguard_server.apply_async((config, server), queue='cdist')
|
cdist_configure_wireguard_server.apply_async((config, server))
|
||||||
|
|
||||||
print(f"res={res}")
|
|
||||||
res2= res.get()
|
|
||||||
print(f"res2={res2}")
|
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def cdist_configure_wireguard_server(config, server):
|
def cdist_configure_wireguard_server(config, server):
|
||||||
|
@ -39,6 +34,7 @@ def cdist_configure_wireguard_server(config, server):
|
||||||
fname = f"/home/app/.cdist/type/__ungleich_wireguard/files/{server}"
|
fname = f"/home/app/.cdist/type/__ungleich_wireguard/files/{server}"
|
||||||
|
|
||||||
print(os.uname())
|
print(os.uname())
|
||||||
|
print(f"Configuring VPN server {server} (on cdist host)")
|
||||||
with open(fname, "w") as fd:
|
with open(fname, "w") as fd:
|
||||||
fd.write(config)
|
fd.write(config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue