Commit 5a7ecd47 by Czémán Arnold

dnscelery: fix hostname handling

parent db009ffc
from os import getenv, path from os import getenv, path
from argparse import ArgumentParser
import subprocess import subprocess
from kombu import Queue, Exchange from kombu import Queue, Exchange
from socket import gethostname
from celery import Celery from celery import Celery
HOSTNAME = gethostname() parser = ArgumentParser()
parser.add_argument('-n', '--hostname', dest='hostname',
help='Define the full queue name with'
'with priority', metavar='hostname.queue')
(args, unknwon_args) = parser.parse_known_args()
HOSTNAME = vars(args).pop('hostname')
if HOSTNAME is None:
raise Exception('You must define hostname as -n <hostname> or '
'--hostname=<hostname>.\n'
'Hostname format must be hostname.queue.')
AMQP_URI = getenv('AMQP_URI') AMQP_URI = getenv('AMQP_URI')
DNS_DB_DIR = getenv('DNS_DB_DIR', '/var/lib/circle/dnsdriver') DNS_DB_DIR = getenv('DNS_DB_DIR', '/var/lib/circle/dnsdriver')
...@@ -15,7 +26,7 @@ celery.conf.update( ...@@ -15,7 +26,7 @@ celery.conf.update(
CELERY_RESULT_BACKEND='amqp', CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300, CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=( CELERY_QUEUES=(
Queue(HOSTNAME + '.dns', Exchange( Queue(HOSTNAME, Exchange(
'dnsdriver', type='direct'), routing_key='dnsdriver'), 'dnsdriver', type='direct'), routing_key='dnsdriver'),
) )
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment