Commit e957e6a5 by Kohl Krisztofer

First 3.6 version

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