Merge pull request #35 from alvarolopez/stable/folsom

Reimplement the SSH key management.
This commit is contained in:
Andy Edmonds 2013-03-12 08:01:33 -07:00
commit 886f548c38
3 changed files with 14 additions and 3 deletions

View File

@ -40,13 +40,11 @@ SEC_RULE = core_model.Kind(
_SEC_RULE_ATTRIBUTES,
'/network/security/rule/')
# Network security rule group
SEC_GROUP = core_model.Mixin(
'http://schemas.ogf.org/occi/infrastructure/security#',
'group', attributes=None)
# OS change adminstrative password action
_OS_CHG_PWD_ATTRIBUTES = {'org.openstack.credentials.admin_pwd': '', }
OS_CHG_PWD = core_model.Action(
@ -54,7 +52,6 @@ OS_CHG_PWD = core_model.Action(
'chg_pwd', 'Changes Admin password.',
_OS_CHG_PWD_ATTRIBUTES)
# OS create image from VM action
_OS_CREATE_IMAGE_ATTRIBUTES = {'org.openstack.snapshot.image_name': '', }
OS_CREATE_IMAGE = core_model.Action(
@ -68,3 +65,10 @@ OS_VM = core_model.Mixin(
'http://schemas.openstack.org/instance/instance#',
'os_vms', actions=[OS_CHG_PWD, OS_CREATE_IMAGE],
attributes=_OS_VM_ATTRIBUTES)
# OS Key pair extension
_OS_KEY_PAIR_ATTRIBUTES = {'org.openstack.credentials.publickey.name': '',
'org.openstack.credentials.publickey.data': '', }
OS_KEY_PAIR_EXT = core_model.Mixin(
'http://schemas.openstack.org/instance/credentials#',
'public_key', attributes=_OS_KEY_PAIR_ATTRIBUTES)

View File

@ -83,6 +83,11 @@ def create_vm(entity, context):
resource_template = mixin
elif isinstance(mixin, os_mixins.OsTemplate):
os_template = mixin
elif mixin == os_addon.OS_KEY_PAIR_EXT:
attr = 'org.openstack.credentials.publickey.name'
key_name = entity.attributes[attr]
attr = 'org.openstack.credentials.publickey.data'
key_data = entity.attributes[attr]
# Look for security group. If the group is non-existant, the
# call to create will fail.
if os_addon.SEC_GROUP in mixin.related:

View File

@ -125,6 +125,8 @@ class OCCIApplication(occi_wsgi.Application, wsgi.Application):
openstack.OsComputeBackend())
self.register_backend(os_addon.OS_CREATE_IMAGE,
openstack.OsComputeBackend())
self.register_backend(os_addon.OS_KEY_PAIR_EXT,
openstack.OsComputeBackend())
self.register_backend(os_addon.OS_CHG_PWD,
openstack.OsComputeBackend())