Revision 088e4262 snfOCCI/APIserver.py

b/snfOCCI/APIserver.py
2 2

  
3 3
from snfOCCI.registry import snfRegistry
4 4
from snfOCCI.compute import ComputeBackend
5
from snfOCCI.config import SERVER_CONFIG
5
from snfOCCI.config import SERVER_CONFIG, KAMAKI_CONFIG
6 6

  
7 7
from kamaki.clients.compute import ComputeClient
8 8
from kamaki.clients.cyclades import CycladesClient
......
79 79
            resource.attributes['occi.compute.cores'] = flavor['cpu']
80 80
            resource.attributes['occi.compute.memory'] = flavor['ram']
81 81
            resource.attributes['occi.compute.hostname'] = SERVER_CONFIG['hostname'] % {'id':int(key)}
82

  
82 83
            self.registry.add_resource(key, resource, None)
83 84

  
84 85
        #Compute instances in registry not available in synnefo
......
89 90

  
90 91
    def __call__(self, environ, response):
91 92

  
92
        conf = Config()
93
        conf.set('compute_token',environ['HTTP_AUTH_TOKEN'])
94
        compClient = ComputeClient(conf)
95
        cyclClient = CycladesClient(conf)
93
        compClient = ComputeClient(KAMAKI_CONFIG['compute_url'], environ['HTTP_AUTH_TOKEN'])
94
        cyclClient = CycladesClient(KAMAKI_CONFIG['compute_url'], environ['HTTP_AUTH_TOKEN'])
96 95

  
97 96
        #Up-to-date flavors and images
98
        self.refresh_images(compClient, cyclClient)
99
        self.refresh_flavors(compClient, cyclClient)
97
        self.refresh_images(compClient,cyclClient)
98
        self.refresh_flavors(compClient,cyclClient)
100 99
        self.refresh_compute_instances(compClient)
101 100

  
102

  
103 101
        # token will be represented in self.extras
104 102
        return self._call_occi(environ, response, security = None, token = environ['HTTP_AUTH_TOKEN'], snf = compClient, client = cyclClient)
105 103

  

Also available in: Unified diff