update create_keypair
diff --git a/plstackapi/openstack/driver.py b/plstackapi/openstack/driver.py
index 79c50b9..81273b3 100644
--- a/plstackapi/openstack/driver.py
+++ b/plstackapi/openstack/driver.py
@@ -155,8 +155,10 @@
def create_keypair(self, name, key):
keys = self.client.nova.keypairs.findall(name=name)
if keys:
- raise Exception, "Key name already exists: %s" % name
- return self.client.nova.keypairs.create(name=name, public_key=key)
+ key = keys[0]
+ else:
+ key = self.client.nova.keypairs.create(name=name, public_key=key)
+ return key
def delete_keypair(self, name):
keys = self.client.nova.keypairs.findall(name=name)
diff --git a/plstackapi/planetstack/models.py b/plstackapi/planetstack/models.py
index f795177..1c1774d 100644
--- a/plstackapi/planetstack/models.py
+++ b/plstackapi/planetstack/models.py
@@ -244,7 +244,6 @@
super(Key, self).delete(*args, **kwds)
-
class Sliver(PlCoreBase):
instance_id = models.CharField(max_length=200, help_text="Nova instance id")
name = models.CharField(max_length=200, help_text="Sliver name")