Commit b103d9bc by Guba Sándor

refactor to use environmnet settings

parent 72d28704
from celery import Celery from celery import Celery
from kombu import Queue, Exchange from kombu import Queue, Exchange
from socket import gethostname from socket import gethostname
import os from os import getenv
HOSTNAME = gethostname() HOSTNAME = gethostname()
AMQP_URI = getenv('AMQP_URI')
lib_connection = None lib_connection = None
celery = Celery('vmcelery', backend='amqp', celery = Celery('vmcelery', backend='amqp',
broker='amqp://cloud:test@10.9.1.31/vmdriver', broker=AMQP_URI,
include=['tasks']) include=['vmdriver'])
celery.conf.update( celery.conf.update(
CELERY_QUEUES=( CELERY_QUEUES=(
...@@ -18,6 +20,6 @@ celery.conf.update( ...@@ -18,6 +20,6 @@ celery.conf.update(
) )
) )
if os.getenv('LIBVIRT_KEEPALIVE') is not None: if getenv('LIBVIRT_KEEPALIVE') is not None:
import libvirt import libvirt
lib_connection = libvirt.open(os.getenv('LIBVIRT_URI')) lib_connection = libvirt.open(getenv('LIBVIRT_URI'))
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