Bugfixes 0.3
authorGiorgos Verigakis <verigak@gmail.com>
Mon, 30 Jan 2012 14:39:21 +0000 (16:39 +0200)
committerGiorgos Verigakis <verigak@gmail.com>
Mon, 30 Jan 2012 14:39:21 +0000 (16:39 +0200)
* Rename asterias to cyclades
* Remove create image from compute
* Fix missing imports

Refs #1956

kamaki/cli.py
kamaki/clients/compute.py
kamaki/clients/image.py
kamaki/clients/pithos.py

index c9fffa7..5aa8349 100755 (executable)
@@ -257,7 +257,7 @@ class server_reboot(object):
         self.client.reboot_server(int(server_id), self.options.hard)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_start(object):
     """start server"""
     
@@ -265,7 +265,7 @@ class server_start(object):
         self.client.start_server(int(server_id))
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_shutdown(object):
     """shutdown server"""
     
@@ -273,7 +273,7 @@ class server_shutdown(object):
         self.client.shutdown_server(int(server_id))
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_console(object):
     """get a VNC console"""
     
@@ -282,7 +282,7 @@ class server_console(object):
         print_dict(reply)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_firewall(object):
     """set the firewall profile"""
     
@@ -290,7 +290,7 @@ class server_firewall(object):
         self.client.set_firewall_profile(int(server_id), profile)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_addr(object):
     """list server addresses"""
     
@@ -336,7 +336,7 @@ class server_delmeta(object):
         self.client.delete_server_metadata(int(server_id), key)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class server_stats(object):
     """get server statistics"""
     
@@ -392,15 +392,6 @@ class image_info(object):
 
 
 @command(api='compute')
-class image_create(object):
-    """create image"""
-    
-    def main(self, server_id, name):
-        reply = self.client.create_image(int(server_id), name)
-        print_dict(reply)
-
-
-@command(api='compute')
 class image_delete(object):
     """delete image"""
     
@@ -444,7 +435,7 @@ class image_delmeta(object):
         self.client.delete_image_metadata(image_id, key)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_list(object):
     """list networks"""
     
@@ -458,7 +449,7 @@ class network_list(object):
         print_items(networks)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_create(object):
     """create a network"""
     
@@ -467,7 +458,7 @@ class network_create(object):
         print_dict(reply)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_info(object):
     """get network details"""
     
@@ -476,7 +467,7 @@ class network_info(object):
         print_dict(network)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_rename(object):
     """update network name"""
     
@@ -484,7 +475,7 @@ class network_rename(object):
         self.client.update_network_name(network_id, new_name)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_delete(object):
     """delete a network"""
     
@@ -492,7 +483,7 @@ class network_delete(object):
         self.client.delete_network(network_id)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_connect(object):
     """connect a server to a network"""
     
@@ -500,7 +491,7 @@ class network_connect(object):
         self.client.connect_server(server_id, network_id)
 
 
-@command(api='asterias')
+@command(api='cyclades')
 class network_disconnect(object):
     """disconnect a server from a network"""
     
index 9df441b..5ec3b86 100644 (file)
@@ -33,6 +33,7 @@
 
 import json
 
+from . import ClientError
 from .http import HTTPClient
 
 
@@ -146,41 +147,35 @@ class ComputeClient(HTTPClient):
         path = '/images/detail' if detail else '/images'
         reply = self.http_get(path)
         return reply['images']['values']
-
+    
     def get_image_details(self, image_id):
-        path = '/images/%d' % image_id
+        path = '/images/%s' % image_id
         reply = self.http_get(path)
         return reply['image']
-
-    def create_image(self, server_id, name):
-        req = {'name': name, 'serverRef': server_id}
-        body = json.dumps({'image': req})
-        reply = self.http_post('/images', body)
-        return reply['image']
-
+    
     def delete_image(self, image_id):
-        path = '/images/%d' % image_id
+        path = '/images/%s' % image_id
         self.http_delete(path)
 
     def get_image_metadata(self, image_id, key=None):
-        path = '/images/%d/meta' % image_id
+        path = '/images/%s/meta' % image_id
         if key:
             path += '/%s' % key
         reply = self.http_get(path)
         return reply['meta'] if key else reply['metadata']['values']
     
     def create_image_metadata(self, image_id, key, val):
-        path = '/images/%d/meta/%s' % (image_id, key)
+        path = '/images/%s/meta/%s' % (image_id, key)
         body = json.dumps({'meta': {key: val}})
         reply = self.http_put(path, body, success=201)
-        reply['meta']
+        return reply['meta']
 
     def update_image_metadata(self, image_id, **metadata):
-        path = '/images/%d/meta' % image_id
+        path = '/images/%s/meta' % image_id
         body = json.dumps({'metadata': metadata})
         reply = self.http_post(path, body, success=201)
         return reply['metadata']
 
     def delete_image_metadata(self, image_id, key):
-        path = '/images/%d/meta/%s' % (image_id, key)
-        reply = self.http_delete(path)
+        path = '/images/%s/meta/%s' % (image_id, key)
+        self.http_delete(path)
index 7794595..6495ce2 100644 (file)
@@ -37,6 +37,7 @@
 
 from urllib import quote
 
+from . import ClientError
 from .http import HTTPClient
 
 
index 65af274..9e0c3e4 100644 (file)
@@ -73,7 +73,7 @@ class PithosClient(StorageClient):
         if resp.status == 201:
             return
         
-        hashes = set(reply.split())
+        hashes = set(json.loads(reply))
         
         f.seek(0)
         data = f.read(blocksize)