try:
with ResourceExceptionHandler():
gen = ext(req=request, **action_args)
- response = gen.next()
+ response = next(gen)
except Fault as ex:
response = ex
return '', {}
parts = _tokenize(';' + value)
- name = parts.next()[0]
+ name = next(parts)[0]
extra = dict(parts)
return name, extra
def add_initiator(target_iqn, initiator_iqn, userid, password):
target = _lookup_target(target_iqn, initiator_iqn)
- tpg = target.tpgs.next() # get the first one
+ tpg = next(target.tpgs) # get the first one
for acl in tpg.node_acls:
# See if this ACL configuration already exists
if acl.node_wwn == initiator_iqn:
def delete_initiator(target_iqn, initiator_iqn):
target = _lookup_target(target_iqn, initiator_iqn)
- tpg = target.tpgs.next() # get the first one
+ tpg = next(target.tpgs) # get the first one
for acl in tpg.node_acls:
if acl.node_wwn == initiator_iqn:
acl.delete()
"""Create a client that will be used for one call."""
if self.api_servers is None:
self.api_servers = get_api_servers()
- self.netloc, self.use_ssl = self.api_servers.next()
+ self.netloc, self.use_ssl = next(self.api_servers)
return _create_glance_client(context,
self.netloc,
self.use_ssl, version)
called.append(2)
ext1 = extension1(None)
- ext1.next()
+ next(ext1)
ext2 = extension2(None)
- ext2.next()
+ next(ext2)
response = resource.post_process_extensions([ext2, ext1],
None, None, {})
yield 'foo'
ext1 = extension1(None)
- ext1.next()
+ next(ext1)
ext2 = extension2(None)
- ext2.next()
+ next(ext2)
response = resource.post_process_extensions([ext2, ext1],
None, None, {})
[{'node_acls': mock.sentinel.initiator_iqn}]
acl = mock.MagicMock(node_wwn=mock.sentinel.initiator_iqn)
tpg = mock.MagicMock(node_acls=[acl])
- tpgs = mock.MagicMock()
- tpgs.next.return_value = tpg
+ tpgs = iter([tpg])
target = mock.MagicMock(tpgs=tpgs, wwn=target_iqn)
rtsroot.return_value = mock.MagicMock(targets=[target])
target_iqn.tpgs.return_value = \
[{'node_acls': mock.sentinel.initiator_iqn}]
tpg = mock.MagicMock()
- target = mock.MagicMock(tpgs=tpg, wwn=target_iqn)
+ tpgs = iter([tpg])
+ target = mock.MagicMock(tpgs=tpgs, wwn=target_iqn)
rtsroot.return_value = mock.MagicMock(targets=[target])
acl_new = mock.MagicMock(chap_userid=mock.sentinel.userid,
mock.sentinel.initiator_iqn,
mock.sentinel.userid,
mock.sentinel.password)
- node_acl.assert_called_once_with(tpg.next(),
+ node_acl.assert_called_once_with(tpg,
mock.sentinel.initiator_iqn,
mode='create')
mapped_lun.assert_called_once_with(acl_new, 0, tpg_lun=0)
# NOTE(thingee): Refer to the Datera test for a stub of what this
# looks like. We're just going to pull the first IP that the Datera
# cluster makes available for the portal.
- iqn = export['targetIds'].itervalues().next()['ids'][0]['id']
+ iqn = next(export['targetIds'].itervalues())['ids'][0]['id']
else:
export = self._issue_api_request(
'export_configs',
vg_list = volutils.get_all_volume_groups(
self.configuration.volume_group)
vg_dict = \
- (vg for vg in vg_list if vg['name'] == self.vg.vg_name).next()
+ next(vg for vg in vg_list if vg['name'] == self.vg.vg_name)
if vg_dict is None:
message = (_("Volume Group %s does not exist") %
self.configuration.volume_group)
if dest_vg != self.vg.vg_name:
vg_list = volutils.get_all_volume_groups()
try:
- (vg for vg in vg_list if vg['name'] == dest_vg).next()
+ next(vg for vg in vg_list if vg['name'] == dest_vg)
except StopIteration:
LOG.error(_LE("Destination Volume Group %s does not exist"),
dest_vg)