Revision 8283d6c1 snf-cyclades-app/synnefo/api/management/commands/server-list.py

b/snf-cyclades-app/synnefo/api/management/commands/server-list.py
35 35

  
36 36
from django.core.management.base import BaseCommand, CommandError
37 37
from synnefo.management.common import (format_vm_state, get_backend, Omit,
38
                                       filter_results, pprint_table, UUIDCache)
38
                                       filter_results, pprint_table, UserCache)
39 39
from synnefo.api.util import get_image
40 40
from synnefo.db.models import VirtualMachine
41 41

  
......
92 92
        if args:
93 93
            raise CommandError("Command doesn't accept any arguments")
94 94

  
95
        ucache = UUIDCache()
95
        ucache = UserCache()
96 96

  
97 97
        if options['backend_id']:
98 98
            backend = get_backend(options['backend_id'])
......
114 114
        user = options['user']
115 115
        if user:
116 116
            if '@' in user:
117
                user = ucache.get_user(user)
117
                user = ucache.get_uuid(user)
118 118
            servers = servers.filter(userid=user)
119 119

  
120 120
        filter_by = options['filter_by']
......
136 136
                         'backend',
137 137
                          ])
138 138

  
139
        uuids = list(set([server.userid for server in servers]))
140
        ucache.fetch_names(uuids)
141

  
139 142
        table = []
140 143
        for server in servers.order_by('id'):
141 144
            try:
......
151 154

  
152 155
            uuid = server.userid
153 156
            if displayname:
154
                dname = ucache.get_user(server.userid)
157
                dname = ucache.get_name(server.userid)
155 158

  
156 159
            fields = filter(lambda x: x is not Omit,
157 160
                            [str(server.id),

Also available in: Unified diff