Change in absolute_reverse breaks netbooting on installed MAAS

Bug #1363105 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Blake Rouse

Bug Description

A package built from trunk can no longer netboot nodes, because of the change in https://code.launchpad.net/~blake-rouse/maas/fix-1361799/+merge/232299

Things start going wrong when the node is booted with a cloud-init-url of “/MAAS/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed” — note the double “/MAAS” prefix. That request fails, of course.

After that, cloud-init goes into desperation mode. It tries to request its instance ID from the EC2 metadata server, which of course fails to connect, and then goes back to trying the MAAS metadata service at “//latest/meta-data/instance-id”, which 404s.

The URL-joining logic has some unexpected corners. Changes there need careful testing. The unit tests are clearly not complete, and Q/A was not done.

Related branches

description: updated
Revision history for this message
Blake Rouse (blake-rouse) wrote :

The reason the change was made, was because absolute_reverse was getting the incorrect value when being called from a different thread.

the django reverse() call is the issue, not urljoin, so bzr 2837 needs to be reverted.

main thread: /MAAS/images-stream/streams/v1/index.json
new thread: /images-stream/streams/v1/index.json

we need to sort out why from another thread it gets a different result

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Can you be more specific in your problem description? If the exact cause is not clear, it's OK to say so. If you don't say it, people may come away thinking that you know exactly what's going on and just aren't explaining it very well. Which may preempt the very discussion and investigation that's needed to get to the right solution.

Revision history for this message
Blake Rouse (blake-rouse) wrote :

The issue is that

get_script_prefix() returns '/MAAS/' when running in a django thread.

get_script_prefix() returns '/' when running in an other thread, this breaks the result that reverse returns.

try it:

import threading
from django.core.urlresolvers import get_script_prefix

print(get_script_prefix())
def thread_print():
     print(get_script_prefix())
t = threading.Thread(target=thread_print)
t.start()
t.join()

how to make get_script_prefix to return the correct value in a thread, is unknown to me.

Changed in maas:
assignee: nobody → Blake Rouse (blake-rouse)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.