~rvb/maas/transaction-1.7-bug-1409852

« back to all changes in this revision

Viewing changes to src/maasserver/rpc/nodegroupinterface.py

merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    None, sometimes as an empty string, and the difference being enough
38
38
    to convince the signal machinery that these fields have changed when
39
39
    in fact they have not.
 
40
 
 
41
    :param cluster_uuid: Cluster's UUID.
 
42
    :param interface_name: The name of the cluster interface on which the
 
43
        foreign DHCP server was (or wasn't) discovered.
 
44
    :param foreign_dhcp_ip: IP address of foreign DCHP server, if any.
40
45
    """
41
46
    query = NodeGroupInterface.objects.filter(
42
47
        nodegroup__uuid=cluster_uuid, name=interface_name)
47
52
def get_cluster_interfaces_as_dicts(cluster_uuid):
48
53
    """Return all the interfaces on a given cluster as a list of dicts.
49
54
 
50
 
    :return: A list of dicts in the form {'name': interface.name, 'ip':
51
 
        interface.ip}, one dict per interface on the cluster.
 
55
    :return: A list of dicts in the form {'name': interface.name,
 
56
        'interface': interface.interface, 'ip': interface.ip}, one dict per
 
57
        interface on the cluster.
52
58
    """
53
59
    cluster_interfaces = NodeGroupInterface.objects.filter(
54
60
        nodegroup__uuid=cluster_uuid)
55
61
    return [
56
 
        {b'name': interface.name, b'ip': interface.ip}
 
62
        {
 
63
            b'name': interface.name,
 
64
            b'interface': interface.interface,
 
65
            b'ip': interface.ip,
 
66
        }
57
67
        for interface in cluster_interfaces]