Commit a225fb3a by Bach Dániel

add missing agent.update code

parent 89e2fcba
...@@ -25,7 +25,7 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI, ...@@ -25,7 +25,7 @@ celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
def send_command(vm, command, *args, **kwargs): def send_command(vm, command, *args, **kwargs):
uuid = kwargs.get('uuid', None) uuid = kwargs.get('uuid', None)
timeout = kwargs.get('timeout', 10) timeout = kwargs.get('timeout', 58)
if uuid: if uuid:
event = Event() event = Event()
reactor.running_tasks[vm][uuid] = event reactor.running_tasks[vm][uuid] = event
...@@ -85,11 +85,25 @@ def start_access_server(vm): ...@@ -85,11 +85,25 @@ def start_access_server(vm):
send_command(vm, command='start_access_server') send_command(vm, command='start_access_server')
@celery.task(name='agent.append')
def append(vm, data, filename, chunk_number):
kwargs = {'command': 'append', 'data': data, 'chunk_number': chunk_number,
'filename': filename, 'uuid': append.request.id}
return send_command(vm, **kwargs)
@celery.task(name='agent.update_legacy')
def update_legacy(vm, data):
kwargs = {'command': 'update', 'uuid': update_legacy.request.id,
'data': data}
return send_command(vm, **kwargs)
@celery.task(name='agent.update') @celery.task(name='agent.update')
def update(vm, data, executable=None): def update(vm, filename, executable, checksum):
kwargs = {'command': 'update', 'data': data, 'uuid': update.request.id} kwargs = {'command': 'update', 'uuid': update.request.id,
if executable is not None: 'filename': filename, 'checksum': checksum,
kwargs['executable'] = executable 'executable': executable}
return send_command(vm, **kwargs) return send_command(vm, **kwargs)
......
...@@ -33,6 +33,7 @@ class GraphiteClientProtocol(protocol.Protocol): ...@@ -33,6 +33,7 @@ class GraphiteClientProtocol(protocol.Protocol):
self.transport.write(message) self.transport.write(message)
self.transport.loseConnection() self.transport.loseConnection()
logger.debug('s: %s' % self.data) logger.debug('s: %s' % self.data)
logger.info("Monitor info from: %s", self.name)
class GraphiteClientFactory(protocol.ClientFactory): class GraphiteClientFactory(protocol.ClientFactory):
...@@ -65,8 +66,9 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -65,8 +66,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
args=(self.factory.vm, )) args=(self.factory.vm, ))
elif command == 'agent_started': elif command == 'agent_started':
version = args.get('version', None) version = args.get('version', None)
system = args.get('system', None)
agent_started.apply_async(queue='localhost.man', agent_started.apply_async(queue='localhost.man',
args=(self.factory.vm, version)) args=(self.factory.vm, version, system))
elif command == 'renew': elif command == 'renew':
renew.apply_async(queue='localhost.man', renew.apply_async(queue='localhost.man',
args=(self.factory.vm, )) args=(self.factory.vm, ))
......
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