Py3: use dict.items() instead of dict.iteritems()
Python 3 use dict.items(), so we'd better use it. Change-Id: I41380ebbed60bd33cc7e2494c5c3b226fedec3ac
This commit is contained in:
parent
9e2517a038
commit
fdb7fc4498
@ -48,7 +48,7 @@ class Event(object):
|
|||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not type(self) == type(other):
|
if not type(self) == type(other):
|
||||||
return False
|
return False
|
||||||
for k, v in vars(self).iteritems():
|
for k, v in vars(self).items():
|
||||||
if k not in vars(other):
|
if k not in vars(other):
|
||||||
return False
|
return False
|
||||||
if vars(other)[k] != v:
|
if vars(other)[k] != v:
|
||||||
|
@ -123,7 +123,7 @@ class PezPoolManager(object):
|
|||||||
|
|
||||||
def _check_err_instances(self, pools):
|
def _check_err_instances(self, pools):
|
||||||
"""Scans the pool and deletes any instances in error state"""
|
"""Scans the pool and deletes any instances in error state"""
|
||||||
for resource, pool in copy.copy(pools).iteritems():
|
for resource, pool in copy.copy(pools).items():
|
||||||
err_instances = [i for i in pool if i.status == ERROR]
|
err_instances = [i for i in pool if i.status == ERROR]
|
||||||
for err_inst in err_instances:
|
for err_inst in err_instances:
|
||||||
LOG.error(_LE(
|
LOG.error(_LE(
|
||||||
@ -140,7 +140,7 @@ class PezPoolManager(object):
|
|||||||
# out what to do with them later.
|
# out what to do with them later.
|
||||||
stuck_instances = []
|
stuck_instances = []
|
||||||
del_instances = []
|
del_instances = []
|
||||||
for resource, pool in pools.iteritems():
|
for resource, pool in pools.items():
|
||||||
del_instances += [i for i in pool if i.status == DELETING]
|
del_instances += [i for i in pool if i.status == DELETING]
|
||||||
|
|
||||||
# clean out counters for old instances that have been deleted entirely
|
# clean out counters for old instances that have been deleted entirely
|
||||||
@ -164,7 +164,7 @@ class PezPoolManager(object):
|
|||||||
|
|
||||||
def _check_outdated_instances(self, pools):
|
def _check_outdated_instances(self, pools):
|
||||||
outdated_instances = []
|
outdated_instances = []
|
||||||
for resource, pool in pools.iteritems():
|
for resource, pool in pools.items():
|
||||||
for server in pool:
|
for server in pool:
|
||||||
if server.image['id'] != str(self.images[resource]):
|
if server.image['id'] != str(self.images[resource]):
|
||||||
LOG.info(_LI(
|
LOG.info(_LI(
|
||||||
|
@ -19,7 +19,7 @@ from astara import drivers
|
|||||||
|
|
||||||
class DriverFactoryTest(base.RugTestBase):
|
class DriverFactoryTest(base.RugTestBase):
|
||||||
def test_get_driver(self):
|
def test_get_driver(self):
|
||||||
for k, v in drivers.AVAILABLE_DRIVERS.iteritems():
|
for k, v in drivers.AVAILABLE_DRIVERS.items():
|
||||||
self.assertEqual(drivers.get(k), v)
|
self.assertEqual(drivers.get(k), v)
|
||||||
|
|
||||||
def test_get_bad_driver(self):
|
def test_get_bad_driver(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user