Unverified Commit 80c9df2d authored by Avraam Tsantekidis's avatar Avraam Tsantekidis
Browse files

Added initial files for testing with tox

parent 1e491cf1
# file GENERATED by distutils, do NOT edit
setup.py
...@@ -5,6 +5,7 @@ import logging ...@@ -5,6 +5,7 @@ import logging
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
from kamaki.clients import astakos, cyclades from kamaki.clients import astakos, cyclades
from kamaki.clients import ClientError from kamaki.clients import ClientError
from kamaki.clients.utils import https from kamaki.clients.utils import https
...@@ -26,6 +27,7 @@ class Provisioner: ...@@ -26,6 +27,7 @@ class Provisioner:
def __init__(self, cloud_name): def __init__(self, cloud_name):
# Load .kamakirc configuration # Load .kamakirc configuration
logger.info("Retrieving .kamakirc configuration")
self.config = KamakiConfig() self.config = KamakiConfig()
cloud_section = self.config._sections['cloud'].get(cloud_name) cloud_section = self.config._sections['cloud'].get(cloud_name)
if not cloud_section: if not cloud_section:
...@@ -36,13 +38,15 @@ class Provisioner: ...@@ -36,13 +38,15 @@ class Provisioner:
# Get the authentication url and token # Get the authentication url and token
auth_url, auth_token = cloud_section['url'], cloud_section['token'] auth_url, auth_token = cloud_section['url'], cloud_section['token']
# Create the astakos client
logger.info("Initiating Astakos Client")
self.astakos = astakos.AstakosClient(auth_url, auth_token) self.astakos = astakos.AstakosClient(auth_url, auth_token)
# Create the cyclades client logger.info("Retrieving cyclades endpoint url")
computeURL = self.astakos.get_endpoint_url( compute_url = self.astakos.get_endpoint_url(
cyclades.CycladesComputeClient.service_type) cyclades.CycladesComputeClient.service_type)
self.cyclades = cyclades.CycladesComputeClient(computeURL, auth_token) logger.info("Initiating Cyclades client")
self.cyclades = cyclades.CycladesComputeClient(compute_url, auth_token)
def find_flavor(self, **kwargs): def find_flavor(self, **kwargs):
""" """
...@@ -55,7 +59,7 @@ class Provisioner: ...@@ -55,7 +59,7 @@ class Provisioner:
kwargs.setdefault("vcpus", 1) kwargs.setdefault("vcpus", 1)
kwargs.setdefault("ram", 1024) kwargs.setdefault("ram", 1024)
kwargs.setdefault("disk", 40) kwargs.setdefault("disk", 40)
logger.info("Retrieving flavor")
for flavor in self.cyclades.list_flavors(detail=True): for flavor in self.cyclades.list_flavors(detail=True):
if all([kwargs[key] == flavor[key] \ if all([kwargs[key] == flavor[key] \
for key in set(flavor.keys()).intersection(kwargs.keys())]): for key in set(flavor.keys()).intersection(kwargs.keys())]):
...@@ -69,6 +73,8 @@ class Provisioner: ...@@ -69,6 +73,8 @@ class Provisioner:
:return: first image object that matches the name criteria :return: first image object that matches the name criteria
""" """
image_name = kwargs['image_name'] image_name = kwargs['image_name']
logger.info("Retrieving image")
for image in self.cyclades.list_images(detail=True): for image in self.cyclades.list_images(detail=True):
if image_name in image['name']: if image_name in image['name']:
return image return image
...@@ -85,6 +91,7 @@ class Provisioner: ...@@ -85,6 +91,7 @@ class Provisioner:
'owner': kwargs.get("project_owner"), 'owner': kwargs.get("project_owner"),
'mode': kwargs.get("project_mode"), 'mode': kwargs.get("project_mode"),
} }
logger.info("Retrieving project")
return self.astakos.get_projects(**filter)[0] return self.astakos.get_projects(**filter)[0]
def create_vm(self, vm_name=None, **kwargs): def create_vm(self, vm_name=None, **kwargs):
......
kamaki
pytest
\ No newline at end of file
from distutils.core import setup
setup(
name='okeanos-LoD',
version='',
packages=[],
url='',
license='',
author='',
author_email='',
description=''
)
[tox]
envlist = py27,py34
[testenv]
deps= -rrequirements.txt
commands=py.test # or 'nosetests' or ...
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