-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update variant handling in SubiquityServer #2128
Merged
Chris-Peterson444
merged 3 commits into
canonical:main
from
Chris-Peterson444:server-variant-handling
Jan 21, 2025
Merged
Update variant handling in SubiquityServer #2128
Chris-Peterson444
merged 3 commits into
canonical:main
from
Chris-Peterson444:server-variant-handling
Jan 21, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
ogayot
reviewed
Jan 15, 2025
Chris-Peterson444
force-pushed
the
server-variant-handling
branch
from
January 15, 2025 19:30
e6c4f26
to
14898d9
Compare
ogayot
approved these changes
Jan 16, 2025
dbungert
approved these changes
Jan 17, 2025
mwhudson
approved these changes
Jan 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me. I think we can beef up that docstring a bit though.
Chris-Peterson444
force-pushed
the
server-variant-handling
branch
3 times, most recently
from
January 21, 2025 22:45
36b1185
to
a8c4e62
Compare
Make the return value of `SubiquityController.interactive` an explicit False return if the controller is not interactive. Previously, if none of the `if` blocks passed then `interactive` would implicility return `None`, which would effectively return `False` when used in `if controller.interactive()` checks. Let's make it explicit. Additionally, add a docstring that describes the ways in which the _active value can be changed and generally when controllers get configured. Lastly, add some tests to the controller class to assert behavior about interactivity and the interactive_for_variants functionality. Co-authored-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Fix a mismatch between the variant of the server and the variant of the SubiquityModel. POST requests to /meta/client_variant would modify the variant for both the server and the SubiquityModel, while POST requests to the source controller would update only the SubiquityModel. Fix this by making all requests to change the variant go through a single function in the server and let that be responsible for updating itself and the SubiquityModel. (Conceptually the Source controller should not be responsible for updating the SubiquityModel.)
When the source controller starts in the server, it reads the source catalog and sets the currently selected version to the first item in the list. Subiquity server starts with a default "server" variant, but needs to be updated on startup if the install media doesn't match that expectation.
Chris-Peterson444
force-pushed
the
server-variant-handling
branch
from
January 21, 2025 22:50
a8c4e62
to
e7765a3
Compare
mwhudson
approved these changes
Jan 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part 1 of 2 for adding support for a "core" variant from #2127.
This PR introduces 1 behavior change and 1 bug fix surrounding variant handling, and 1 function signature fix for a semi-related function in the
SubiquityController
class.app.base_model
) and not the server's notion of the variant (app.variant
). Now selecting a new source will update both.SubiquityController.interactive
to returnFalse
instead ofNone
for non-interactive controllers, since this is always used in truthy contexts.There is one temporary commit here that adds "core" as a supported variant in
subiquity/server/server.py
, just so that theexamples/sources/core-desktop.yaml
answers test will pass. (The TUI will get "core" as the client and then try to post it to the server, which would otherwise fail without this commit.) We can drop this commit before merging, as the logic to add "core" as a supported variant is handled in the other PR.