forked from uncloud/uncloud
celery test
This commit is contained in:
parent
372fe800cd
commit
e2b36c8bca
3 changed files with 18 additions and 28 deletions
|
@ -26,3 +26,4 @@ vat-validator
|
|||
|
||||
# Tasks
|
||||
celery
|
||||
redis
|
||||
|
|
|
@ -199,6 +199,16 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch("dc=example,dc=com",
|
|||
# where to create customers
|
||||
LDAP_CUSTOMER_DN="ou=customer,dc=example,dc=com"
|
||||
|
||||
CELERY_TASK_ROUTES = {
|
||||
'*': {
|
||||
'queue': 'vpn1'
|
||||
}
|
||||
}
|
||||
|
||||
CELERY_BROKER_URL = 'redis://bridge.place7.ungleich.ch:6379/0'
|
||||
CELERY_RESULT_BACKEND = 'redis://bridge.place7.ungleich.ch:6379/0'
|
||||
|
||||
# CELERY_TASK_CREATE_MISSING_QUEUES = False
|
||||
|
||||
# Overwrite settings with local settings, if existing
|
||||
try:
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
from celery import shared_task
|
||||
from .models import *
|
||||
|
||||
import os
|
||||
|
||||
@shared_task
|
||||
def whereami():
|
||||
print(os.uname())
|
||||
return os.uname()
|
||||
|
||||
@shared_task
|
||||
def configure_wireguard_server(vpnpool):
|
||||
print(f"Configuring {vpnpool.vpn_server_hostname}")
|
||||
|
@ -36,31 +43,3 @@ AllowedIPs = {peer_network}
|
|||
wireguard_config.extend(peers)
|
||||
|
||||
return "\n".join(wireguard_config)
|
||||
|
||||
|
||||
def configure_wireguard_vpnserver(self):
|
||||
"""
|
||||
This method is designed to run as a celery task and should
|
||||
not be called directly from the web
|
||||
"""
|
||||
|
||||
# subprocess, ssh
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def num_maximum_networks(self):
|
||||
"""
|
||||
sample:
|
||||
network_size = 40
|
||||
subnetwork_size = 48
|
||||
maximum_networks = 2^(48-40)
|
||||
|
||||
2nd sample:
|
||||
network_size = 8
|
||||
subnetwork_size = 24
|
||||
maximum_networks = 2^(24-8)
|
||||
"""
|
||||
|
||||
return 2**(self.subnetwork_mask - self.network_mask)
|
||||
|
|
Loading…
Reference in a new issue