distributed-system-analysis / pbench

A benchmarking and performance analysis framework
http://distributed-system-analysis.github.io/pbench/
GNU General Public License v3.0
188 stars 108 forks source link

Redirect DIR `/inventory/path` to `/contents/path` #3571

Closed dbutenhof closed 1 year ago

dbutenhof commented 1 year ago

PBENCH-1291

Pbench Agent postprocessing creates result.html files, which display a table of result data for each iteration. Each row contains a relative link to the iteration directory, with the intention of linking to the web server directory listing. Because the result.html was loaded using the inventory API as /datasets/<id>/inventory/result.html, the relative path access also routes to the inventory API, which doesn't support directories and therefore fails.

It's hard to fix this to work like the old server without some way to interact with the dashboard UI code (ideally it would open the appropriate directory in the TOC view). Nevertheless, this PR implements a change that improves the behavior a bit (it's no longer an error), by handling this request as an HTML 301 (redirect, as "permanently moved") to the appropriate /contents URI.

Right now the browser will display the raw contents JSON response, which is a bit ugly if not entirely uninformative.

This PR also cleans up the inventory code path a bit, collapsing the cache manager stream API into get_inventory as it's not called anywhere else.