Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on #758, I noticed a bug in the way variables are handled:
Currently, there is one global
Variables
object, as member of the globalApplication
. When loading profiles, variables are added to it, but never removed. So when switching profiles, there are still variables present from the previous profile.To demonstrate, use the debug print from the first commit of this PR, with two profiles:
variable1
:variable2
:Then use
tuned-adm profile
to switch between them, and note how the debug output will contain not only variables of the current, but also of the previously loaded profile:My proposal is to have the
Variables
object owned by theProfile
. It is created by the profile loader, so that more complex load scenarios (multiple profiles, potentially with includes) still only use oneVariables
object.An alternative would be to simply clear variables when loading a new profile, but that would break my #758, where (when restoring a snapshot) a second profile is loaded, which can fail, and therefore does not work well with
Variables
as global state.