# or implied, of GRNET S.A. from kamaki.cli.config import Config from kamaki.clients import astakos, cyclades, ClientError from kamaki.clients.utils import https https.patch_with_certs('/etc/ssl/certs/ca-certificates.crt') cnf = Config() CLOUD = cnf.get('global', 'default_cloud') URL = cnf.get_cloud(CLOUD, 'url') TOKEN = cnf.get_cloud(CLOUD, 'token') identity_client = astakos.CachedAstakosClient(URL, TOKEN) computeURL = identity_client.get_endpoint_url( cyclades.CycladesComputeClient.service_type) compute_client = cyclades.CycladesComputeClient(computeURL, TOKEN) img = dict(id='10b79e4d-9362-4f30-9223-3105c9a84bce') srv_name = raw_input('Server name: ') flv = compute_client.get_flavor_details(raw_input('Flavor id: ')) srv = compute_client.create_server(srv_name, flavor_id=flv['id'], image_id=img['id']) from base64 import b64encode ssh_keys = dict(contents=b64encode(open('~/.ssh/id_rsa.pub').read()), path='/root/.ssh/authorized_keys', owner='root', group='root', mode=0600)
def setUp(self): self.url = 'http://cyclades.example.com' self.token = 'cyc14d3s70k3n' self.client = cyclades.CycladesComputeClient(self.url, self.token)