← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/fix-metadata-urls into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/fix-metadata-urls into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1031365 in MAAS: "The urls of the metadata API are badly defined."
  https://bugs.launchpad.net/maas/+bug/1031365

For more details, see:
https://code.launchpad.net/~rvb/maas/fix-metadata-urls/+merge/117442

This branch fixes the metadata API urls.  The regular expressions should all start with "^" otherwise things like: http://0.0.0.0:5240/metadata/SUPER_ALPHA_SMOSER_ROCKS/latest/enlist-preseed/?op=get_enlist_preseed work.
-- 
https://code.launchpad.net/~rvb/maas/fix-metadata-urls/+merge/117442
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/fix-metadata-urls into lp:maas.
=== modified file 'src/metadataserver/urls.py'
--- src/metadataserver/urls.py	2012-06-22 13:22:57 +0000
+++ src/metadataserver/urls.py	2012-07-31 14:17:27 +0000
@@ -49,16 +49,16 @@
 node_patterns = patterns(
     '',
     url(
-        r'(?P<version>[^/]+)/meta-data/(?P<item>.*)$',
+        r'^(?P<version>[^/]+)/meta-data/(?P<item>.*)$',
         meta_data_handler,
         name='metadata-meta-data'),
     url(
-        r'(?P<version>[^/]+)/user-data$', user_data_handler,
+        r'^(?P<version>[^/]+)/user-data$', user_data_handler,
         name='metadata-user-data'),
     url(
-        r'(?P<version>[^/]+)/', version_index_handler,
+        r'^(?P<version>[^/]+)/', version_index_handler,
         name='metadata-version'),
-    url(r'', index_handler, name='metadata'),
+    url(r'^', index_handler, name='metadata'),
     )
 
 # Anonymous random metadata access, keyed by system ID.  These serve requests
@@ -69,11 +69,11 @@
     # XXX: rvb 2012-06-20 bug=1015559:  This method is accessible
     # without authentication.  This is a security threat.
     url(
-        r'(?P<version>[^/]+)/by-id/(?P<system_id>[\w\-]+)/$',
+        r'^(?P<version>[^/]+)/by-id/(?P<system_id>[\w\-]+)/$',
         meta_data_anon_handler,
         name='metadata-node-by-id'),
     url(
-        r'(?P<version>[^/]+)/enlist-preseed/$',
+        r'^(?P<version>[^/]+)/enlist-preseed/$',
         meta_data_anon_handler,
         name='metadata-enlist-preseed'),
     )
@@ -84,15 +84,15 @@
 by_mac_patterns = patterns(
     '',
     url(
-        r'(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/meta-data/(?P<item>.*)$',
+        r'^(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/meta-data/(?P<item>.*)$',
         meta_data_by_mac_handler,
         name='metadata-meta-data-by-mac'),
     url(
-        r'(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/user-data$',
+        r'^(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/user-data$',
         user_data_by_mac_handler,
         name='metadata-user-data-by-mac'),
     url(
-        r'(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/',
+        r'^(?P<version>[^/]+)/by-mac/(?P<mac>[^/]+)/',
         version_index_by_mac_handler,
         name='metadata-version-by-mac'),
     )