Commit 954621fc authored by Antoine Millet's avatar Antoine Millet

Fixed bug in list method of client handler (now return only useful tags).

parent fdac7d95
......@@ -5,6 +5,7 @@ import inspect
import logging
from sjrpc.utils import RpcHandler, pure
from tql import TqlQuery
from conf import CCConf
def listed(func):
func.__listed__ = True
......@@ -104,8 +105,9 @@ class ClientHandler(CCHandler):
# Try to get vm for each matched hypervisor:
async_calls = {}
tags = tuple(query.tags)
for hy in hypervisors:
async_calls[hy.connection.async_call('list_vm')] = hy
async_calls[hy.connection.async_call('list_vm', tags=tags)] = hy
logging.debug('Waiting for the response of hypervisors...')
responses = self._server.manager.wait(frozenset(async_calls), timeout=5)
......@@ -128,7 +130,11 @@ class ClientHandler(CCHandler):
# Filter the objects with the query, and return it:
return query.filter(objects)
class AuthenticationError(Exception):
class WelcomeHandler(CCHandler):
......@@ -147,11 +153,14 @@ class WelcomeHandler(CCHandler):
Authenticate the client.
role = self._server.conf.authentify(login, password)
except CCConf.UnknownAccount:
raise AuthenticationError('Authentication failure (Unknown login)')
role = self._server.conf.authentify(login, password)
if role is None:'New authentication from %s: failure' % login)
return False
raise AuthenticationError('Authentication failure')
# If authentication is a success, ask tags to the server:
self._server.register(login, role, connection)
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 to comment