Revision 37a57502 api/handlers.py

b/api/handlers.py
83 83

  
84 84
    def read_one(self, request, id):
85 85
        try:
86
            vm = VirtualMachine.objects.get(id=id)
86
            server = VirtualMachine.objects.get(id=id)
87 87
        except VirtualMachine.DoesNotExist:
88 88
            raise fault.itemNotFound
89 89
        except VirtualMachine.MultipleObjectsReturned:
90 90
            raise fault.serviceUnavailable
91 91
        except Exception, e:
92 92
            raise fault.serviceUnavailable
93
        return { "server": vm } 
93

  
94
        server = {'status': server.rsapi_state, 
95
                                     'flavorId': server.flavor.id, 
96
                                     'name': server.name, 
97
                                     'id': server.id, 
98
                                     'imageId': server.sourceimage.id, 
99
                                     'hostId': server.hostid, 
100
                                     #'metadata': {'Server_Label': server.description },
101
                                     'metadata':[{'meta': { 'key': {metadata.meta_key: metadata.meta_value}}} for metadata in server.virtualmachinemetadata_set.all()],                                    
102
                                     'addresses': {'public': { 'ip': {'addr': server.ipfour}, 'ip6': {'addr': server.ipsix}},'private': ''},      
103
                }
104
        return { "server": server } 
94 105

  
95 106

  
96 107
    @paginator

Also available in: Unified diff