Commit 8e5ff8e5 by Czémán Arnold

Merge branch 'fix-hostname-handling' into 'master'

dnscelery: fix hostname handling

See merge request !3
parents db009ffc 5a7ecd47
from os import getenv, path
from argparse import ArgumentParser
import subprocess
from kombu import Queue, Exchange
from socket import gethostname
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')
DNS_DB_DIR = getenv('DNS_DB_DIR', '/var/lib/circle/dnsdriver')
......@@ -15,7 +26,7 @@ celery.conf.update(
CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(
Queue(HOSTNAME + '.dns', Exchange(
Queue(HOSTNAME, Exchange(
'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