diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-26 22:26:11 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-26 22:26:11 +0000 |
| commit | 73eaa61f468d1c4f6f800862e4eb4d8a70f88bb1 (patch) | |
| tree | 0d8fd887cfcbdc00843f9893b6b8233a27a906bc /nova | |
| parent | ad9e7a83de4e57c44bf9d5e089a548c2f8820867 (diff) | |
| parent | 645c2d3a06bbf8b0854ebcc539ad33dd706866c5 (diff) | |
| download | nova-73eaa61f468d1c4f6f800862e4eb4d8a70f88bb1.tar.gz nova-73eaa61f468d1c4f6f800862e4eb4d8a70f88bb1.tar.xz nova-73eaa61f468d1c4f6f800862e4eb4d8a70f88bb1.zip | |
Merge "Accept is_public=None when listing all flavors"
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/api/openstack/compute/flavors.py | 3 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/test_flavors.py | 1 | ||||
| -rw-r--r-- | nova/utils.py | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/flavors.py b/nova/api/openstack/compute/flavors.py index 4da130e9b..c6303646a 100644 --- a/nova/api/openstack/compute/flavors.py +++ b/nova/api/openstack/compute/flavors.py @@ -24,6 +24,7 @@ from nova.api.openstack import xmlutil from nova.compute import flavors from nova import exception from nova.openstack.common import strutils +from nova import utils def make_flavor(elem, detailed=False): @@ -98,7 +99,7 @@ class Controller(wsgi.Controller): if is_public is None: # preserve default value of showing only public flavors return True - elif is_public == 'none': + elif utils.is_none_string(is_public): return None else: try: diff --git a/nova/tests/api/openstack/compute/test_flavors.py b/nova/tests/api/openstack/compute/test_flavors.py index 77e637044..3741fcd33 100644 --- a/nova/tests/api/openstack/compute/test_flavors.py +++ b/nova/tests/api/openstack/compute/test_flavors.py @@ -792,6 +792,7 @@ class ParseIsPublicTest(test.TestCase): def test_string_none(self): self.assertPublic(None, 'none') + self.assertPublic(None, 'None') def test_other(self): self.assertRaises( diff --git a/nova/utils.py b/nova/utils.py index 5e968bd35..9922804c0 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -1050,3 +1050,13 @@ def spawn_n(func, *args, **kwargs): interfering with the service spawns. """ eventlet.spawn_n(func, *args, **kwargs) + + +def is_none_string(val): + """ + Check if a string represents a None value. + """ + if not isinstance(val, basestring): + return False + + return val.lower() == 'none' |
