def match_node_from_label_expr(expr, configured_nodes=None): """ Given a label expression, find all matching configured node types so that one can be created. """ if not expr: return configured_nodes = configured_nodes or get_nodes() matches = matching_nodes(expr, configured_nodes) # XXX return first? random? try to figure out if # one is already provisioning and return it? if matches: return matches[0] else: return None
def match_node_from_label_expr(expr, configured_nodes=None): """ Given a label expression, find all matching configured node types so that one can be created. """ if not expr: return configured_nodes = configured_nodes or get_nodes() matches = matching_nodes(expr, configured_nodes) # XXX return first? random? try to figure out if # one is already provisioning and return it? if matches: return matches[0] else: return None
def test_matching_nodes(self, expr, matches): assert sorted(matching_nodes(expr, nodes)) == sorted(matches)