Merge "Replace six iteration methods with standard ones"
This commit is contained in:
commit
c82673912f
@ -12,8 +12,6 @@
|
||||
|
||||
import random
|
||||
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _, _LE
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
@ -193,7 +191,7 @@ class OpenStackAPIVersions(context.Context):
|
||||
self.context["users"])["credential"])
|
||||
services = clients.keystone.service_catalog.get_endpoints()
|
||||
services_from_admin = None
|
||||
for client_name, conf in six.iteritems(self.config):
|
||||
for client_name, conf in self.config.items():
|
||||
if "service_type" in conf and conf["service_type"] not in services:
|
||||
raise exceptions.ValidationError(_(
|
||||
"There is no service with '%s' type in your environment.")
|
||||
|
@ -18,7 +18,6 @@ import random
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from rally.common import broker
|
||||
from rally.common.i18n import _
|
||||
@ -80,7 +79,7 @@ class UserContextMixin(object):
|
||||
|
||||
"""
|
||||
scenario_ctx = {}
|
||||
for key, value in six.iteritems(context_obj):
|
||||
for key, value in context_obj.items():
|
||||
if key not in ["users", "tenants"]:
|
||||
scenario_ctx[key] = value
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally.common import logging
|
||||
from rally.common import utils
|
||||
@ -68,7 +66,7 @@ def _prepare_open_secgroup(credential, secgroup_name):
|
||||
|
||||
def rule_match(criteria, existing_rule):
|
||||
return all(existing_rule[key] == value
|
||||
for key, value in six.iteritems(criteria))
|
||||
for key, value in criteria.items())
|
||||
|
||||
for new_rule in rules_to_add:
|
||||
if not any(rule_match(new_rule, existing_rule) for existing_rule
|
||||
|
@ -13,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally.common import logging
|
||||
from rally.common import utils
|
||||
@ -103,7 +101,7 @@ class Network(context.Context):
|
||||
net_wrapper = network_wrapper.wrap(
|
||||
osclients.Clients(self.context["admin"]["credential"]),
|
||||
self, config=self.config)
|
||||
for tenant_id, tenant_ctx in six.iteritems(self.context["tenants"]):
|
||||
for tenant_id, tenant_ctx in self.context["tenants"].items():
|
||||
for network in tenant_ctx.get("networks", []):
|
||||
with logging.ExceptionLogger(
|
||||
LOG,
|
||||
|
@ -10,8 +10,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally.common import logging
|
||||
from rally.common import utils
|
||||
@ -81,7 +79,7 @@ class Lbaas(context.Context):
|
||||
net_wrapper = network_wrapper.wrap(
|
||||
osclients.Clients(self.context["admin"]["credential"]),
|
||||
self, config=self.config)
|
||||
for tenant_id, tenant_ctx in six.iteritems(self.context["tenants"]):
|
||||
for tenant_id, tenant_ctx in self.context["tenants"].items():
|
||||
for network in tenant_ctx.get("networks", []):
|
||||
for pool in network.get("lb_pools", []):
|
||||
with logging.ExceptionLogger(
|
||||
|
@ -60,7 +60,7 @@ class CeilometerScenario(scenario.OpenStackScenario):
|
||||
"source": source,
|
||||
"timestamp": timestamp,
|
||||
}
|
||||
for k, v in six.iteritems(opt_fields):
|
||||
for k, v in opt_fields.items():
|
||||
if v:
|
||||
sample.update({k: v})
|
||||
len_meta = len(metadata_list) if metadata_list else 0
|
||||
|
@ -16,7 +16,6 @@
|
||||
import random
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from rally import exceptions
|
||||
from rally.plugins.openstack import scenario
|
||||
@ -753,7 +752,7 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
break
|
||||
try:
|
||||
new_host = random.choice(
|
||||
[key for key, value in six.iteritems(az.hosts)
|
||||
[key for key, value in az.hosts.items()
|
||||
if key != host and
|
||||
value.get("nova-compute", {}).get("available", False)])
|
||||
return new_host
|
||||
|
@ -798,7 +798,7 @@ class FakeAlarmManager(FakeManager):
|
||||
|
||||
def update(self, alarm_id, **fake_alarm_dict_diff):
|
||||
alarm = self.get(alarm_id)[0]
|
||||
for attr, value in six.iteritems(fake_alarm_dict_diff):
|
||||
for attr, value in fake_alarm_dict_diff.items():
|
||||
setattr(alarm, attr, value)
|
||||
return alarm
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from rally.plugins.openstack.cleanup import base
|
||||
from rally.plugins.openstack.cleanup import manager
|
||||
@ -167,7 +166,7 @@ class SeekAndDestroyTestCase(test.TestCase):
|
||||
mock_mgr().list.side_effect = list_side_effect
|
||||
mock_mgr.reset_mock()
|
||||
|
||||
for k, v in six.iteritems(kw):
|
||||
for k, v in kw.items():
|
||||
setattr(mock_mgr, k, v)
|
||||
|
||||
return mock_mgr
|
||||
@ -342,7 +341,7 @@ class ResourceManagerTestCase(test.TestCase):
|
||||
|
||||
def _get_res_mock(self, **kw):
|
||||
_mock = mock.MagicMock()
|
||||
for k, v in six.iteritems(kw):
|
||||
for k, v in kw.items():
|
||||
setattr(_mock, k, v)
|
||||
return _mock
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from rally.plugins.openstack.scenarios.quotas import utils
|
||||
from tests.unit import test
|
||||
@ -75,7 +74,7 @@ class QuotasScenarioTestCase(test.ScenarioTestCase):
|
||||
max_quota = 1024
|
||||
scenario = utils.QuotasScenario(self.context)
|
||||
quotas = scenario._generate_quota_values(max_quota, "nova")
|
||||
for k, v in six.iteritems(quotas):
|
||||
for k, v in quotas.items():
|
||||
self.assertGreaterEqual(v, -1)
|
||||
self.assertLessEqual(v, max_quota)
|
||||
|
||||
@ -83,7 +82,7 @@ class QuotasScenarioTestCase(test.ScenarioTestCase):
|
||||
max_quota = 1024
|
||||
scenario = utils.QuotasScenario(self.context)
|
||||
quotas = scenario._generate_quota_values(max_quota, "cinder")
|
||||
for k, v in six.iteritems(quotas):
|
||||
for k, v in quotas.items():
|
||||
self.assertGreaterEqual(v, -1)
|
||||
self.assertLessEqual(v, max_quota)
|
||||
|
||||
@ -91,9 +90,9 @@ class QuotasScenarioTestCase(test.ScenarioTestCase):
|
||||
max_quota = 1024
|
||||
scenario = utils.QuotasScenario(self.context)
|
||||
quotas = scenario._generate_quota_values(max_quota, "neutron")
|
||||
for v in six.itervalues(quotas):
|
||||
for v1 in six.itervalues(v):
|
||||
for v2 in six.itervalues(v1):
|
||||
for v in quotas.values():
|
||||
for v1 in v.values():
|
||||
for v2 in v1.values():
|
||||
self.assertGreaterEqual(v2, -1)
|
||||
self.assertLessEqual(v2, max_quota)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user