Beispiel #1
0
Datei: util.py Projekt: ceph/mita
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
Beispiel #2
0
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
Beispiel #3
0
 def test_matching_nodes(self, expr, matches):
     assert sorted(matching_nodes(expr, nodes)) == sorted(matches)