From 6b3bba9141c7fdc4b00025f7e6ee8d980e41ec9a Mon Sep 17 00:00:00 2001 From: "Mauro S. M. Rodrigues" Date: Mon, 4 Mar 2013 22:55:34 -0500 Subject: Fix 'to integer' conversion of max and min count values Until now when you used values non-integer to max_count and/or min_count the coercion worked like: min_count = int(2.5) so min_count received 2 instead of raise bad request. Convert to string before coerce to int solves the problem since int coercion cannot convert from a string which is not a perfect int. Change-Id: Ifaa9910e13614554d1769e71e8eba9587ec5a13b --- nova/api/openstack/compute/servers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 05aa7b238..aec082bad 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -830,7 +830,7 @@ class Controller(wsgi.Controller): max_count = server_dict.get('max_count', min_count) try: - min_count = int(min_count) + min_count = int(str(min_count)) except ValueError: msg = _('min_count must be an integer value') raise exc.HTTPBadRequest(explanation=msg) @@ -839,7 +839,7 @@ class Controller(wsgi.Controller): raise exc.HTTPBadRequest(explanation=msg) try: - max_count = int(max_count) + max_count = int(str(max_count)) except ValueError: msg = _('max_count must be an integer value') raise exc.HTTPBadRequest(explanation=msg) -- cgit