Revision ee6eff28

b/ci/utils.py
15 15
from ConfigParser import ConfigParser, DuplicateSectionError
16 16

  
17 17
from kamaki.cli import config as kamaki_config
18
from kamaki.clients.astakos import CachedAstakosClient
18
from kamaki.clients.astakos import AstakosClient, parse_endpoints
19 19
from kamaki.clients.cyclades import CycladesClient, CycladesNetworkClient
20 20
from kamaki.clients.image import ImageClient
21 21
from kamaki.clients.compute import ComputeClient
......
199 199
        token = config.get_cloud(self.kamaki_cloud, "token")
200 200
        #self.logger.debug("Token is %s" % _green(token))
201 201

  
202
        self.astakos_client = CachedAstakosClient(auth_url, token)
202
        self.astakos_client = AstakosClient(auth_url, token)
203
        endpoints = self.astakos_client.authenticate()
203 204

  
204
        cyclades_url = \
205
            self.astakos_client.get_service_endpoints('compute')['publicURL']
205
        cyclades_url = get_endpoint_url(endpoints, "compute")
206 206
        self.logger.debug("Cyclades API url is %s" % _green(cyclades_url))
207 207
        self.cyclades_client = CycladesClient(cyclades_url, token)
208 208
        self.cyclades_client.CONNECTION_RETRY_LIMIT = 2
209 209

  
210
        network_url = \
211
            self.astakos_client.get_service_endpoints('network')['publicURL']
210
        network_url = get_endpoint_url(endpoints, "network")
212 211
        self.logger.debug("Network API url is %s" % _green(network_url))
213 212
        self.network_client = CycladesNetworkClient(network_url, token)
214 213
        self.network_client.CONNECTION_RETRY_LIMIT = 2
215 214

  
216
        image_url = \
217
            self.astakos_client.get_service_endpoints('image')['publicURL']
215
        image_url = get_endpoint_url(endpoints, "image")
218 216
        self.logger.debug("Images API url is %s" % _green(image_url))
219 217
        self.image_client = ImageClient(cyclades_url, token)
220 218
        self.image_client.CONNECTION_RETRY_LIMIT = 2
221 219

  
222
        compute_url = \
223
            self.astakos_client.get_service_endpoints('compute')['publicURL']
220
        compute_url = get_endpoint_url(endpoints, "compute")
224 221
        self.logger.debug("Compute API url is %s" % _green(compute_url))
225 222
        self.compute_client = ComputeClient(compute_url, token)
226 223
        self.compute_client.CONNECTION_RETRY_LIMIT = 2
......
285 282
        return port
286 283

  
287 284
    @_check_kamaki
285
    # Too many local variables. pylint: disable-msg=R0914
288 286
    def create_server(self, image=None, flavor=None, ssh_keys=None,
289 287
                      server_name=None):
290 288
        """Create slave server"""
......
1040 1038
    except ValueError:
1041 1039
        msg = "Invalid %s format. Must be [id|name]:.+" % option
1042 1040
        raise ValueError(msg)
1041

  
1042

  
1043
def get_endpoint_url(endpoints, endpoint_type):
1044
    """Get the publicURL for the specified endpoint"""
1045

  
1046
    service_catalog = parse_endpoints(endpoints, ep_type=endpoint_type)
1047
    return service_catalog[0]['endpoints'][0]['publicURL']

Also available in: Unified diff