Commit 10acf55b authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

snf-ci: Replace usage of CachedAstakosClient

CachedAstakosClient is an internal class of kamaki.
Instead of using this, use the AstakosClient class that
kamaki re-exports from astakosclient library.
parent ebb0ac41
......@@ -15,7 +15,7 @@ import tempfile
from ConfigParser import ConfigParser, DuplicateSectionError
from kamaki.cli import config as kamaki_config
from kamaki.clients.astakos import CachedAstakosClient
from kamaki.clients.astakos import AstakosClient, parse_endpoints
from kamaki.clients.cyclades import CycladesClient, CycladesNetworkClient
from kamaki.clients.image import ImageClient
from kamaki.clients.compute import ComputeClient
......@@ -199,28 +199,25 @@ class SynnefoCI(object):
token = config.get_cloud(self.kamaki_cloud, "token")
#self.logger.debug("Token is %s" % _green(token))
self.astakos_client = CachedAstakosClient(auth_url, token)
self.astakos_client = AstakosClient(auth_url, token)
endpoints = self.astakos_client.authenticate()
cyclades_url = \
cyclades_url = get_endpoint_url(endpoints, "compute")
self.logger.debug("Cyclades API url is %s" % _green(cyclades_url))
self.cyclades_client = CycladesClient(cyclades_url, token)
self.cyclades_client.CONNECTION_RETRY_LIMIT = 2
network_url = \
network_url = get_endpoint_url(endpoints, "network")
self.logger.debug("Network API url is %s" % _green(network_url))
self.network_client = CycladesNetworkClient(network_url, token)
self.network_client.CONNECTION_RETRY_LIMIT = 2
image_url = \
image_url = get_endpoint_url(endpoints, "image")
self.logger.debug("Images API url is %s" % _green(image_url))
self.image_client = ImageClient(cyclades_url, token)
self.image_client.CONNECTION_RETRY_LIMIT = 2
compute_url = \
compute_url = get_endpoint_url(endpoints, "compute")
self.logger.debug("Compute API url is %s" % _green(compute_url))
self.compute_client = ComputeClient(compute_url, token)
self.compute_client.CONNECTION_RETRY_LIMIT = 2
......@@ -285,6 +282,7 @@ class SynnefoCI(object):
return port
# Too many local variables. pylint: disable-msg=R0914
def create_server(self, image=None, flavor=None, ssh_keys=None,
"""Create slave server"""
......@@ -1040,3 +1038,10 @@ def parse_typed_option(option, value):
except ValueError:
msg = "Invalid %s format. Must be [id|name]:.+" % option
raise ValueError(msg)
def get_endpoint_url(endpoints, endpoint_type):
"""Get the publicURL for the specified endpoint"""
service_catalog = parse_endpoints(endpoints, ep_type=endpoint_type)
return service_catalog[0]['endpoints'][0]['publicURL']
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