~maas-committers/maas/1.2

« back to all changes in this revision

Viewing changes to src/maasserver/api.py

  • Committer: Tarmac
  • Author(s): Jeroen Vermeulen
  • Date: 2012-12-12 03:55:13 UTC
  • mfrom: (1334.1.1 1.2-bug-108450)
  • Revision ID: tarmac-20121212035513-xm6d4es9f4w2qxd9
[r=julian-edwards][bug=1084507][author=jtv] Backport trunk r1391: Pass cluster uuid to pxeconfig API call, so it knows which cluster a request comes from.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1822
1822
    return macaddress.node if macaddress else None
1823
1823
 
1824
1824
 
 
1825
def find_nodegroup_for_pxeconfig_request(request):
 
1826
    """Find the nodegroup responsible for a `pxeconfig` request.
 
1827
 
 
1828
    Looks for the `cluster_uuid` parameter in the request.  If there is
 
1829
    none, figures it out based on the requesting IP as a compatibility
 
1830
    measure.  In that case, the result may be incorrect.
 
1831
    """
 
1832
    return find_nodegroup(request)
 
1833
 
 
1834
 
1825
1835
def pxeconfig(request):
1826
1836
    """Get the PXE configuration given a node's details.
1827
1837
 
1845
1855
    :param subarch: Subarchitecture name (in the pxelinux namespace).
1846
1856
    :param local: The IP address of the cluster controller.
1847
1857
    :param remote: The IP address of the booting node.
 
1858
    :param cluster_uuid: UUID of the cluster responsible for this node.
 
1859
        If omitted, the call will attempt to figure it out based on the
 
1860
        requesting IP address, for compatibility.  Passing `cluster_uuid`
 
1861
        is preferred.
1848
1862
    """
1849
1863
    node = get_node_from_mac_string(request.GET.get('mac', None))
1850
1864
 
1889
1903
            # 1-1 mapping.
1890
1904
            subarch = pxelinux_subarch
1891
1905
 
1892
 
        nodegroup = find_nodegroup(request)
 
1906
        nodegroup = find_nodegroup_for_pxeconfig_request(request)
1893
1907
        preseed_url = compose_enlistment_preseed_url(nodegroup=nodegroup)
1894
1908
        hostname = 'maas-enlist'
1895
1909
        domain = Config.objects.get_config('enlistment_domain')