csc/Hanlon — pull request #141 by tjmcs (2014-08-06 14:27:05+00:00)
Title: Fixes #138 (CentOS images fail to load if base_path is set to '/')

The changes in this PR fix the 'matches_image' regular expression in the `Hanlon::WebService::App` class so that it matches any URI that refers to a file from an image, regardless of how many slashes appear at the front of that URI. This should fix the issue #138 (which was triggered by a lack of pattern matches when the `base_path` was set to '/' in the `web/config/hanlon_server.conf` file; in those cases the URIs for files retrieved during the OS install process look like `//v1/image/os/6qeVWuZp7WWAq9rSWwC7MG/Packages/kbd-misc-1.15-11.el6.noarch.rpm` (to take the first file retrieved during the CentOS 6.4 install process as an example), and the pattern match used prior to the change in this PR to determine if such a URI was part of an image (and handle it within the Rack application itself instead of within the associated image slice's RESTful API) failed to match.

The result of this failed pattern match manifest itself in the failure of CentOS/RHEL installs whenever the `base_path` was set to '/' in the `web/config/hanlon_server.conf` file. This was because these distributions use partial downloads of files from the associated ISO to save bandwidth (on their servers during network installs?), something that isn't supported by the Grape-based image slice code but that is handled correctly within the Rack application if the resource being retrieved is a file from an image. The one-line change in this PR should fix this issue (ensuring a proper pattern match, regardless of the number of slashes found at the start of the URI string).