Commit 37887fd0 authored by Antoine Millet's avatar Antoine Millet
Browse files

[bug#3992] Tag order is now provided to the cli.

parent c658b660
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ class CCServer(object):
                return right['target'] == 'allow'
        return False

    def list(self, query, show=set(), pure=False):
    def list(self, query, show=set(), pure=False, return_toshow=False):
        '''
        List objects on the server.

@@ -250,6 +250,7 @@ class CCServer(object):
        parser = TqlParser(query)
        ast, to_show, to_get, to_check = parser.parse()

        orig_to_show = copy(to_show)
        to_show += show

        # Calculate the tags to get/check/show:
@@ -295,4 +296,7 @@ class CCServer(object):
        for obj in objects:
            objects_dicts.append(obj.to_dict(to_display, deny=deny))

        if return_toshow:
            return objects_dicts, orig_to_show
        else:
            return objects_dicts
+5 −2
Original line number Diff line number Diff line
@@ -190,8 +190,11 @@ class CliHandler(OnlineCCHandler):

        self._check(conn, 'list', query)
        logging.debug('Executed list function with query %s', query)
        objects = self._server.list(query)
        return {'objects': objects, 'order': ['id']}
        objects, tags = self._server.list(query, return_toshow=True)
        order = ['id']
        if tags is not None:
            order += tags
        return {'objects': objects, 'order': order}

    def _vm_action(self, query, method, *args, **kwargs):
        vms = self._server.list(query, show=set(('r', 'h')))