On 12-03-14 01:17 PM, Raphaël Badin wrote: > Hi all, > > I've just added longpoll support to MaaS. > > It's disabled by default on a dev instance because enabling it breaks > django's auto-reload feature and requires a multithreading dev server to > work properly. To enable it : > - set LONGPOLL_URL = 'longpoll/' in src/maas/demo.py (don't forget to > set PSERV_URL = None if you don't want to talk to a real cobbler). > - start the longpoll server: make longpoll-start (that will become "make > txlongpoll-start" once Gavin's branch is landed) > - run the dev server with threading enabled: bin/maas runserver > 0.0.0.0:8000 --settings=maas.demo --threading > > I've included sample event listeners in index.html so you should see the > events being printed (Y.log) on the console when they are fired. > > The only remaining task now is to create a proper apache production > configuration snippet that will make apache proxy requests to the > txlongpoll server (on a dev instance the maas server itself does that). >
Accessing the site on latest trunk after a make run (which has
LONGPOLL_URL = None) gets you an OOPS:
TypeError NoneType object is not iterable
File "/usr/lib/python2.7/dist-pac
kages/oops_wsgi/middleware.py", line 208, in oops_middleware
app(environ, oops_start_response))
File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py",
line 250
, in __call__
self.load_middleware()
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py",
line 53,
in load_middleware
mw_instance = mw_class()
File
"/home/francis/canonical/maas/trunk/src/maasserver/middleware.py", line 6
4, in __init__
reverse('login'),
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 391,
in reverse
*args, **kwargs)))
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 312, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 229, in _get_reverse_dict
self._populate()
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 208, in _populate
for name in pattern.reverse_dict:
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 229, in _get_reverse_dict
self._populate()
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 197, in _populate
for pattern in reversed(self.url_patterns):
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 279, in _get_url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 274, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py",
line 35, in import_module
in _populate
for name in pattern.reverse_dict:
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 229, in _get_reverse_dict
self._populate()
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 197, in _populate
for pattern in reversed(self.url_patterns):
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 279, in _get_url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py",
line 274, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
File "/home/francis/canonical/maas/trunk/src/maasserver/urls.py", line
83, in <module>
r'^%s$' % re.escape(django_settings.LONGPOLL_URL),
File "/usr/lib/python2.7/re.py", line 208, in escape
s = list(pattern)
I've fixed it with the following patch locally:
=== modified file 'src/maasserver/urls.py'
--- src/maasserver/urls.py 2012-03-14 14:03:33 +0000
+++ src/maasserver/urls.py 2012-03-14 21:44:23 +0000
@@ -80,7 +80,7 @@
if django_settings.LONGPOLL_SERVER_URL is not None:
urlpatterns += patterns('maasserver.views',
url(
- r'^%s$' % re.escape(django_settings.LONGPOLL_URL),
+ r'^%s$' % re.escape(django_settings.LONGPOLL_SERVER_URL),
proxy_to_longpoll, name='proxy-to-longpoll'),
)
But after inspection it seems that settings has both LONGPOLL_SERVER_URL
and LONG_URL which is _terribly_ confusing. So I don't have confidence
in my patch.
Also, the fact that we are erroring in urls.py means that we are lacking
a test here for this code path.
--
Francis J. Lacoste
[email protected]
signature.asc
Description: OpenPGP digital signature
-- Mailing list: https://launchpad.net/~maas-devel Post to : [email protected] Unsubscribe : https://launchpad.net/~maas-devel More help : https://help.launchpad.net/ListHelp

