Commit 17e03a44 authored by Stavros Sachtouris's avatar Stavros Sachtouris

Implement get_images functionality

parent 1dd10f79
......@@ -30,7 +30,8 @@
from soi.log import reveale_me
import json
from kamaki.clients.astakos import AstakosClient
from kamaki.clients.cyclades import CycladesComputeClient
from kamaki.clients.cyclades import (
CycladesComputeClient, CycladesNetworkClient)
from kamaki.clients.utils import https
from soi.config import AUTH_URL, CA_CERTS
......@@ -39,9 +40,11 @@ ADMIN_TOKEN = ''
https.patch_with_certs(CA_CERTS)
auth = AstakosClient(AUTH_URL, ADMIN_TOKEN)
endpoints, client_classes = {}, {}
for cls in (AstakosClient, CycladesComputeClient):
service_type = CycladesComputeClient.service_type
endpoints = {'identity': AUTH_URL}
client_classes = {'identity': AstakosClient}
for cls in (CycladesComputeClient, CycladesNetworkClient):
service_type = cls.service_type
endpoints[service_type] = auth.get_endpoint_url(service_type)
client_classes[service_type] = cls
......@@ -59,6 +62,8 @@ def call_kamaki(environ, start_response, *args, **kwargs):
method_name = environ.pop('method_name')
kwargs = environ.pop('kwargs', {})
print '\t', service_type, method_name, kwargs
endpoint = endpoints[service_type]
token = environ['HTTP_X_AUTH_TOKEN']
cls = client_classes[service_type]
......
......@@ -36,16 +36,18 @@ def snf_get_flavors(cls, req):
return cls.get_from_response(response, 'flavors', [])
OpenStackHelper.index = snf_index
OpenStackHelper.get_flavors = snf_get_flavors
# Test ground
from soi.log import reveale_cme
def snf_get_images(cls, req):
"""Synnefo: list images"""
req.environ['service_type'] = 'compute'
req.environ['method_name'] = 'images_get'
req.environ['kwargs'] = {'detail': True}
response = req.get_response(cls.app)
return cls.get_from_response(response, 'images', [])
# end test ground
OpenStackHelper.index = snf_index
OpenStackHelper.get_flavors = snf_get_flavors
OpenStackHelper.get_images = snf_get_images
class SNFOCCIMiddleware(OCCIMiddleware):
......
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