diff options
| author | Dan Prince <dan.prince@rackspace.com> | 2011-03-07 12:07:23 -0500 |
|---|---|---|
| committer | Dan Prince <dan.prince@rackspace.com> | 2011-03-07 12:07:23 -0500 |
| commit | b3d3366b8fd4eaf81bb9e03ad808c1a139e5b5b0 (patch) | |
| tree | dcc7d428a15ea63d720a4964819608ae5abf57a4 /nova/api | |
| parent | 2280848e8477c33f2a903eb7f821dcbcc90ce307 (diff) | |
Generate 'adminPass' and call set_password when creating servers.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 08b95b46a..6cd8bb451 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -84,13 +84,11 @@ def _translate_detail_keys(inst): return dict(server=inst_dict) - def _translate_keys(inst): """ Coerces into dictionary format, excluding all model attributes save for id and name """ return dict(server=dict(id=inst['id'], name=inst['display_name'])) - class Controller(wsgi.Controller): """ The Server API controller for the OpenStack API """ @@ -178,7 +176,13 @@ class Controller(wsgi.Controller): key_data=key_pair['public_key'], metadata=metadata, onset_files=env.get('onset_files', [])) - return _translate_keys(instances[0]) + + server = _translate_keys(instances[0]) + password = "%s%s" % (server['server']['name'][:4], + utils.generate_password(12)) + server['server']['adminPass'] = password + self.compute_api.set_admin_password(context, server['server']['id']) + return server def update(self, req, id): """ Updates the server name or password """ |
