Skip to content

Commit 7979498

Browse files
committed
Skip unnecessary SDK get_machine calls
The _process_sdk function starts by calling cloud.list_machines() which returns all nodes including their names. There is no need to call cloud.get_machine individually for each node just to get its name attribute when we might be skipping this node. This speeds up execution of the Bifrost inventory module when BIFROST_NODE_NAMES is used. Change-Id: I27ccc12b9f408d510710d5ba82ad04135169827a
1 parent ec182e7 commit 7979498

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bifrost/inventory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ def _process_sdk(groups, hostvars):
232232
node_names = node_names.split(',')
233233

234234
for machine in machines:
235-
machine = cloud.get_machine(machine['uuid'])
236235
if machine['name'] is None:
237236
name = machine['uuid']
238237
else:
@@ -241,6 +240,7 @@ def _process_sdk(groups, hostvars):
241240
if node_names and name not in node_names:
242241
continue
243242

243+
machine = cloud.get_machine(machine['uuid'])
244244
new_machine = {}
245245
for key, value in machine.items():
246246
# NOTE(TheJulia): We don't want to pass infomrational links

0 commit comments

Comments
 (0)