Open ericfranz opened 6 years ago
A bigger problem though is the fact that the title and description can be set in the form.yml for ihpc apps, and if its a form.yml.erb, that erb could potentially affect the title and description.
Even with a solution like https://github.com/OSC/ood-dashboard/issues/418 the form.yml.erb will still be processed when building the cache, whether it is done every time a new Passenger app instance loads (which means it would be re-done every 5 minutes if a user is inactive for 5 minutes after accessing the dashboard).
We have several cases:
This problem gets a little worse.
title: "Oakley Desktop"
sinfo
. This encourages admins to add erb code, intended to only be run when the user accesses the app, that inadvertently gets executed when building a navigation, every request to the dashboard. This is even worse when the code is duplicated across all of the dashboard sub apps because you want that queue dropdown to appear in each.Should probably require a separated manifest for each ihpc app (or subapp) which has the title, description, and list of clusters.
Will have to think of how to support backwards compatibility while adding this. One way would be if the manifest does not specify a cluster (or array of clusters) we then load the form.yml to get this. If manifest has title, description, and cluster we just use that and avoid parsing the form.yml.
We could also optimize the code for building the navigation by using an in memory cache of apps users have access to.
Change for 1.5 release:
By using default_title and "" for the description, we avoid rendering erb. However, we still have the problem of "You do not have access to use this app." situation, like we have with ruby-vdi. A simple solution is to say we are not going to remove that from the menu and instead recommend using file permissions on this file. So 640 ruby-vdi and only users in the ruby group have access to it.
Enforcing authorization any other way is too expensive. Unless that authorization can be enforced by adding a new line to the manifest.yml file.
Of course, another option is to just introduce caching for the entire menu.
Maybe the solution for backwards compatibility in some form is to support a manifest.yml.erb
.
Note: this should be introduced under a feature flag that disables the new behavior by default. That way it can be released in the patch release and be optionally enabled by interested sites. The default can change in a later release.
Updated April 26, 2021
The logic currently is to:
With this issue the new logic would be:
The technical design for this is as follows:
With a configuration option we could switch it back to the previous functionality. We could also wait until someone complains that the previous functionality is necessary and worth the performance cost before adding back this support.
NOTE: before doing this, sub_app_list must be refactored out of all the places it is used and the knowledge of that relationship should only be in one place - the router that creates the OodApp objects. Then the new functionality will need to only create OodApp objects for those "apps" that have a manifest.yml (or subapp.manifest.yml). This is how we address the bug where currently a sub_app_list pulls in any yml/yml.erb as a subapp, and only after validating the rendered erb does it determine it is not (such as submit.yml.erb in /etc).
Old description
We load and process the batch connect form.yml.erb files to generate the title and description of the iHPC apps. Unfortunately, this means that any expensive parts of the form.yml.erb are also executed. If there is code to build a queue list from a command, for example, that will be executed for each iHPC app on every request to the dashboard. This is terrible for performance.
┆Issue is synchronized with this Asana task by Unito