From 53226b3262a95e4e62472416c125ee3ebd58b52e Mon Sep 17 00:00:00 2001 From: Satyanarayana Patibandla Date: Sat, 27 Apr 2013 18:18:44 -0400 Subject: Added validation for networks parameter value A validation check is added for networks parameter value. In server create request body, if networks parameter value is not stored in a list then 'Bad networks format' error is thrown with bad request exception.A new test case is added to verify whether it is returning bad request exception when invalid syntax is used. Fixes: bug #1175683 Change-Id: I457a1626c56281f89d8c4a606ccc0d0e3aea05fa --- nova/api/openstack/compute/servers.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 166c8b10e..a63a39860 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -791,6 +791,9 @@ class Controller(wsgi.Controller): requested_networks = server_dict.get('networks') if requested_networks is not None: + if not isinstance(requested_networks, list): + expl = _('Bad networks format') + raise exc.HTTPBadRequest(explanation=expl) requested_networks = self._get_requested_networks( requested_networks) -- cgit