removed extra stubout, switched to isinstance and catching explicit exception

This commit is contained in:
Sandy Walsh
2011-06-29 09:29:07 -07:00
parent de4a165a9d
commit 291df3a09a
3 changed files with 2 additions and 12 deletions

View File

@@ -260,7 +260,7 @@ class API(base.Base):
elevated = context.elevated()
if security_group is None:
security_group = ['default']
if not type(security_group) is list:
if not isinstance(security_group, list):
security_group = [security_group]
security_groups = []

View File

@@ -194,7 +194,7 @@ class ZoneAwareScheduler(driver.Scheduler):
cooked_weight = offset + scale * raw_weight
item['weight'] = cooked_weight
item['raw_weight'] = raw_weight
except Exception, e:
except KeyError:
LOG.exception(_("Bad child zone scaling values "
"for Zone: %(zone)s") % locals())

View File

@@ -16,8 +16,6 @@
Tests For Zone Aware Scheduler.
"""
import stubout
import nova.db
from nova import exception
@@ -170,14 +168,6 @@ def fake_zone_get_all(context):
class ZoneAwareSchedulerTestCase(test.TestCase):
"""Test case for Zone Aware Scheduler."""
def setUp(self):
super(ZoneAwareSchedulerTestCase, self).setUp()
self.stubs = stubout.StubOutForTesting()
def tearDown(self):
self.stubs.UnsetAll()
super(ZoneAwareSchedulerTestCase, self).tearDown()
def test_zone_aware_scheduler(self):
"""
Create a nested set of FakeZones, ensure that a select call returns the