Merge "Trivial: use default value in next() func"
This commit is contained in:
commit
09832946a3
@ -693,14 +693,13 @@ class HostManager(object):
|
|||||||
timeout = context_module.CELL_TIMEOUT
|
timeout = context_module.CELL_TIMEOUT
|
||||||
nodes_by_cell = context_module.scatter_gather_cells(
|
nodes_by_cell = context_module.scatter_gather_cells(
|
||||||
ctxt, cells, timeout, target_fnc)
|
ctxt, cells, timeout, target_fnc)
|
||||||
try:
|
|
||||||
# Only one cell should have a value for the compute nodes
|
# Only one cell should have values for the compute nodes
|
||||||
# so we get it here
|
# so we get them here, or return an empty list if no cell
|
||||||
nodes = next(
|
# has a value
|
||||||
nodes for nodes in nodes_by_cell.values() if nodes)
|
nodes = next(
|
||||||
except StopIteration:
|
(nodes for nodes in nodes_by_cell.values() if nodes),
|
||||||
# ...or we find no node if none of the cells has a value
|
objects.ComputeNodeList())
|
||||||
nodes = objects.ComputeNodeList()
|
|
||||||
|
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user