Commit e957e6a5 by Kohl Krisztofer

First 3.6 version

parent f859b4cc
......@@ -14,8 +14,8 @@ HOSTNAME = gethostname().split('.')[0]
AMQP_URI = getenv('AMQP_URI')
celery = Celery('agent', broker=AMQP_URI)
celery.conf.update(CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300,
celery.conf.update(CELERY_RESULT_BACKEND='amqp://',
CELERY_TASK_RESULT_EXPIRES=30000,
CELERY_QUEUES=(Queue(HOSTNAME + '.agent',
Exchange('agent', type='direct'),
routing_key='agent'), ))
......@@ -33,7 +33,7 @@ def send_command(vm, command, *args, **kwargs):
if command == 'append' and 'vio-cloud' not in conn.transport.addr:
continue
logger.info('%s(%s, %s)', command, vm,
', '.join(map(lambda x: str(x)[:100], kwargs.values())))
', '.join([str(x)[:100] for x in list(kwargs.values())]))
conn.send_command(command=command, args=kwargs)
if uuid:
......@@ -135,19 +135,19 @@ def change_ip(vm, interfaces, dns):
@celery.task(name='vm.tasks.local_agent_tasks.renew')
def renew(vm):
print vm
print(vm)
@celery.task(name='vm.tasks.local_agent_tasks.agent_started')
def agent_started(vm):
print vm
print(vm)
@celery.task(name='vm.tasks.local_agent_tasks.agent_stopped')
def agent_stopped(vm):
print vm
print(vm)
@celery.task(name='vm.tasks.local_agent_tasks.agent_ok')
def agent_ok(vm):
print vm
print(vm)
......@@ -13,7 +13,7 @@ level = environ.get('LOGLEVEL', 'INFO')
logger.setLevel(level)
SOCKET_DIR = getenv('SOCKET_DIR', '/var/lib/libvirt/serial')
SOCKET_DIR = getenv('SOCKET_DIR', '/var/lib/libvirt/')
old_install_platform_tweaks = Worker.install_platform_tweaks
......
......@@ -10,8 +10,8 @@ setuid cloud
script
cd /home/cloud/agentdriver
. /home/cloud/.virtualenvs/agentdriver/local/bin/activate
. /home/cloud/.virtualenvs/agentdriver/local/bin/postactivate
cd /home/kohlkriszto/Documents/agentdriver
. /home/kohlkriszto/Documents/agentdriver_venv/bin/activate
. /home/kohlkriszto/Documents/agentdriver_venv/bin/postactivate
python agentdriver.py
end script
......@@ -20,10 +20,10 @@ class GraphiteClientProtocol(protocol.Protocol):
def connectionMade(self):
timestamp = time.time()
data_list = []
for key, value in self.data.items():
for key, value in list(self.data.items()):
if not isinstance(value, dict):
continue
for k, v in value.items():
for k, v in list(value.items()):
data_list.append(('agent.%s.%s.%s' % (self.name, key, k),
(timestamp, float(v))))
......
......@@ -37,9 +37,9 @@ class SerialLineReceiverBase(LineReceiver, object):
logger.error('[serial] invalid json: %s (%s)' % (data, e))
return
if command is not None and isinstance(command, unicode):
if command is not None and isinstance(command, str):
logger.debug('received command: %s (%s)' % (command, args))
self.handle_command(command, args)
elif response is not None and isinstance(response, unicode):
elif response is not None and isinstance(response, str):
logger.debug('received reply: %s (%s)' % (response, args))
self.handle_response(response, args)
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