Finds a betterr solution to handle keypari
This commit is contained in:
parent
6560500f28
commit
e54b2f1840
|
@ -116,10 +116,12 @@ class Key(Base):
|
||||||
whitelist = dict(
|
whitelist = dict(
|
||||||
name=options["name"],
|
name=options["name"],
|
||||||
path=options.get("path", "."))
|
path=options.get("path", "."))
|
||||||
key = self._agent.client.compute.keypairs.create(whitelist["name"])
|
key = self._agent.client.compute.keypairs.get(whitelist["name"])
|
||||||
f = open("%(path)s/%(name)s.pem" % whitelist, 'w')
|
if not key:
|
||||||
f.write(key.private_key)
|
key = self._agent.client.compute.keypairs.create(whitelist["name"])
|
||||||
f.close
|
f = open("%(path)s/%(name)s.pem" % whitelist, 'w')
|
||||||
|
f.write(key.private_key)
|
||||||
|
f.close
|
||||||
return key
|
return key
|
||||||
|
|
||||||
class Image(Base):
|
class Image(Base):
|
||||||
|
|
Loading…
Reference in New Issue