Merge "Python 3: Wrap map() in a list call"
This commit is contained in:
commit
dc8436c190
@ -557,7 +557,7 @@ class DeferredOVSBridge(object):
|
||||
key=operator.itemgetter(0))
|
||||
itemgetter_1 = operator.itemgetter(1)
|
||||
for action, action_flow_list in grouped:
|
||||
flows = map(itemgetter_1, action_flow_list)
|
||||
flows = list(map(itemgetter_1, action_flow_list))
|
||||
self.br.do_action_flows(action, flows)
|
||||
|
||||
def __enter__(self):
|
||||
|
@ -79,7 +79,7 @@ def create_process(cmd, run_as_root=False, addl_env=None):
|
||||
The return value will be a tuple of the process object and the
|
||||
list of command arguments used to create it.
|
||||
"""
|
||||
cmd = map(str, addl_env_args(addl_env) + cmd)
|
||||
cmd = list(map(str, addl_env_args(addl_env) + cmd))
|
||||
if run_as_root:
|
||||
cmd = shlex.split(config.get_root_helper(cfg.CONF)) + cmd
|
||||
LOG.debug("Running command: %s", cmd)
|
||||
@ -92,7 +92,7 @@ def create_process(cmd, run_as_root=False, addl_env=None):
|
||||
|
||||
|
||||
def execute_rootwrap_daemon(cmd, process_input, addl_env):
|
||||
cmd = map(str, addl_env_args(addl_env) + cmd)
|
||||
cmd = list(map(str, addl_env_args(addl_env) + cmd))
|
||||
# NOTE(twilson) oslo_rootwrap.daemon will raise on filter match
|
||||
# errors, whereas oslo_rootwrap.cmd converts them to return codes.
|
||||
# In practice, no neutron code should be trying to execute something that
|
||||
|
@ -25,7 +25,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_process(cmd, addl_env=None):
|
||||
cmd = map(str, cmd)
|
||||
cmd = list(map(str, cmd))
|
||||
|
||||
LOG.debug("Running command: %s", cmd)
|
||||
env = os.environ.copy()
|
||||
|
@ -634,7 +634,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
|
||||
in_(AUTO_DELETE_PORT_OWNERS)))
|
||||
network_ports = qry_network_ports.all()
|
||||
if network_ports:
|
||||
map(context.session.delete, network_ports)
|
||||
for port in network_ports:
|
||||
context.session.delete(port)
|
||||
# Check if there are more IP allocations, unless
|
||||
# is_auto_address_subnet is True. In that case the check is
|
||||
# unnecessary. This additional check not only would be wasteful
|
||||
|
@ -33,7 +33,7 @@ MIGRATION_BRANCHES = ('expand', 'contract')
|
||||
|
||||
|
||||
mods = repos.NeutronModules()
|
||||
VALID_SERVICES = map(mods.alembic_name, mods.installed_list())
|
||||
VALID_SERVICES = list(map(mods.alembic_name, mods.installed_list()))
|
||||
|
||||
|
||||
_core_opts = [
|
||||
|
@ -167,7 +167,7 @@ class ApicTopologyAgent(manager.Manager):
|
||||
self.interfaces = {}
|
||||
self.lldpcmd = None
|
||||
self.peers = {}
|
||||
self.port_desc_re = map(re.compile, ACI_PORT_DESCR_FORMATS)
|
||||
self.port_desc_re = list(map(re.compile, ACI_PORT_DESCR_FORMATS))
|
||||
self.service_agent = ApicTopologyServiceNotifierApi()
|
||||
self.state = None
|
||||
self.state_agent = None
|
||||
|
@ -864,7 +864,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
allocated = qry_allocated.all()
|
||||
# Delete all the IPAllocation that can be auto-deleted
|
||||
if allocated:
|
||||
map(session.delete, allocated)
|
||||
for x in allocated:
|
||||
session.delete(x)
|
||||
LOG.debug("Ports to auto-deallocate: %s", allocated)
|
||||
# Check if there are more IP allocations, unless
|
||||
# is_auto_address_subnet is True. In that case the check is
|
||||
|
@ -189,7 +189,7 @@ class RoutersTest(base.BaseRouterTest):
|
||||
CONF.network.public_network_id)
|
||||
public_subnet_id = public_net_body['network']['subnets'][0]
|
||||
self.assertIn(public_subnet_id,
|
||||
map(lambda x: x['subnet_id'], fixed_ips))
|
||||
[x['subnet_id'] for x in fixed_ips])
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('6cc285d8-46bf-4f36-9b1a-783e3008ba79')
|
||||
|
@ -1521,7 +1521,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
ri.router = {'distributed': False}
|
||||
ri._handle_router_snat_rules(ex_gw_port, "iface")
|
||||
|
||||
nat_rules = map(str, ri.iptables_manager.ipv4['nat'].rules)
|
||||
nat_rules = list(map(str, ri.iptables_manager.ipv4['nat'].rules))
|
||||
wrap_name = ri.iptables_manager.wrap_name
|
||||
|
||||
jump_float_rule = "-A %s-snat -j %s-float-snat" % (wrap_name,
|
||||
@ -1540,7 +1540,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
self.assertThat(nat_rules.index(jump_float_rule),
|
||||
matchers.LessThan(nat_rules.index(snat_rule1)))
|
||||
|
||||
mangle_rules = map(str, ri.iptables_manager.ipv4['mangle'].rules)
|
||||
mangle_rules = list(map(str, ri.iptables_manager.ipv4['mangle'].rules))
|
||||
mangle_rule = ("-A %s-mark -i iface "
|
||||
"-j MARK --set-xmark 0x2/0xffffffff") % wrap_name
|
||||
self.assertIn(mangle_rule, mangle_rules)
|
||||
|
@ -117,7 +117,7 @@ class TestMl2SecurityGroups(Ml2SecurityGroupsTestCase,
|
||||
plugin.get_ports_from_devices(self.ctx,
|
||||
['%s%s' % (const.TAP_DEVICE_PREFIX, i)
|
||||
for i in range(ports_to_query)])
|
||||
all_call_args = map(lambda x: x[1][1], get_mock.mock_calls)
|
||||
all_call_args = [x[1][1] for x in get_mock.mock_calls]
|
||||
last_call_args = all_call_args.pop()
|
||||
# all but last should be getting MAX_PORTS_PER_QUERY ports
|
||||
self.assertTrue(
|
||||
|
Loading…
Reference in New Issue
Block a user