Merge "Use _get_server_admin_password()"

This commit is contained in:
Jenkins 2013-11-05 05:21:15 +00:00 committed by Gerrit Code Review
commit f119908b26
2 changed files with 4 additions and 12 deletions

View File

@ -1082,10 +1082,7 @@ class ServersController(wsgi.Controller):
image_href = self._image_uuid_from_href(image_href)
try:
password = rebuild_dict['admin_pass']
except (KeyError, TypeError):
password = utils.generate_password()
password = self._get_server_admin_password(rebuild_dict)
context = req.environ['nova.context']
instance = self._get_server(context, req, id)

View File

@ -1209,10 +1209,8 @@ class Controller(wsgi.Controller):
or 'adminPass' not in body['changePassword']):
msg = _("No adminPass was specified")
raise exc.HTTPBadRequest(explanation=msg)
password = body['changePassword']['adminPass']
if not isinstance(password, six.string_types):
msg = _("Invalid adminPass")
raise exc.HTTPBadRequest(explanation=msg)
password = self._get_server_admin_password(body['changePassword'])
server = self._get_server(context, req, id)
try:
self.compute_api.set_admin_password(context, server, password)
@ -1271,10 +1269,7 @@ class Controller(wsgi.Controller):
image_href = self._image_uuid_from_href(image_href)
try:
password = body['adminPass']
except (KeyError, TypeError):
password = utils.generate_password()
password = self._get_server_admin_password(body)
context = req.environ['nova.context']
instance = self._get_server(context, req, id)