Skip to content
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

Settings handlers #2352

Merged
merged 254 commits into from
Apr 7, 2022
Merged

Settings handlers #2352

merged 254 commits into from
Apr 7, 2022

Conversation

ricab
Copy link
Collaborator

@ricab ricab commented Nov 23, 2021

This PR implements settings handlers.

ricab added 30 commits November 15, 2021 18:14
Start moving and adapting tests for functionality that was previously in
the Settings class and is now located in the PersistentSettingsHandler.
Add a test to confirm the PersistentSettingsHandler returns the default
value for a setting by default.
Fork an UnrecognizedSettingException from InvalidSettingsException.
Make it singular: InvalidSettingException.
Register a `PersistentSettingsHandler` to deal with client settings, in
both the CLI and the GUI clients.
Register a temporary PersistentSettingsHandler for daemon settings in
the client, in order to keep feature parity until we introduce routing
handlers.
Temporarily derive path for daemon settings in client, to keep feature
parity until we introduce routing handlers.
Transfer comment from old to new filename deriving functions, to
preserve the info therein.
To be coherent with client side.
Generalize test file to test both client- and daemon-registered settings
handlers.
@ricab ricab force-pushed the settings-handlers branch from 71b741b to 66a44a7 Compare March 8, 2022 15:25
@ricab ricab force-pushed the settings-handlers branch from 66a44a7 to f516881 Compare March 8, 2022 20:00
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda fun that git decided mock_settings.cpp is now basic_settings_spec.cpp 🤷.

First pass through roughly a half of this :)

include/multipass/settings/settings.h Show resolved Hide resolved
include/multipass/constants.h Outdated Show resolved Hide resolved
src/client/cli/cmd/remote_settings_handler.cpp Outdated Show resolved Hide resolved
include/multipass/settings/dynamic_setting_spec.h Outdated Show resolved Hide resolved
src/daemon/daemon_init_settings.cpp Show resolved Hide resolved
src/daemon/daemon_init_settings.cpp Show resolved Hide resolved
src/platform/platform_linux.cpp Show resolved Hide resolved
src/settings/CMakeLists.txt Outdated Show resolved Hide resolved
@ricab
Copy link
Collaborator Author

ricab commented Mar 28, 2022

OK, finally circling back to this :)

Kinda fun that git decided mock_settings.cpp is now basic_settings_spec.cpp shrug.

I know! I was also surprised, but I guess the difference between them was smaller than a threshold. I bet there's a way to tell git otherwise...

ricab added 5 commits March 28, 2022 19:36
It is not a default at all. Addresses review request.
Declare compilation units for the tests executable in alphabetical
order. The order was already questionable in places, but got worse with
new test files.
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, just going through the tests now but wanted to register what I have. Tiny bits.

And kudos on this, it's a big one!

src/client/cli/cmd/remote_settings_handler.cpp Outdated Show resolved Hide resolved
src/daemon/daemon_init_settings.cpp Show resolved Hide resolved
src/daemon/daemon_init_settings.cpp Show resolved Hide resolved
src/daemon/daemon_main.cpp Show resolved Hide resolved
src/daemon/daemon_main.cpp Outdated Show resolved Hide resolved
src/settings/bool_setting_spec.cpp Outdated Show resolved Hide resolved
tests/test_cli_client.cpp Show resolved Hide resolved
tests/test_daemon.cpp Show resolved Hide resolved
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing is, this needs a rebase / merge :)

Other than that - works well, too :)

ricab and others added 2 commits April 6, 2022 17:51
Applies review suggestions.

Co-authored-by: Michał Sawicz <michal.sawicz@canonical.com>
@ricab ricab force-pushed the settings-handlers branch from 08d41d1 to 47688d9 Compare April 6, 2022 17:30
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Will review the other side and merge first thing tomorrow.

src/daemon/daemon_main.cpp Show resolved Hide resolved
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a problem with the passphrase handling. When you multipass set local.passphrase="", we need the stored passphrase to actually be blank:

# current
$ multipass version
multipass   1.10.0-dev.591.ci2957+g446817e7.mac
multipassd  1.10.0-dev.591.ci2957+g446817e7.mac

$ sudo multipass set local.passphrase=""

$ sudo multipass get local.passphrase
false

$ sudo cat /var/root/Library/Preferences/multipassd/multipassd.conf
[General]
local.passphrase=

# update
$ sudo installer -target / -dumplog -verbose -pkg multipass-1.10.0-dev.886.pr2352+g17e3ebc8.mac-Darwin.pkg

$ sudo multipass get local.passphrase
false

# but then
$ multipass set local.passphrase=""
$ multipass get local.passphrase
true

$ sudo cat /var/root/Library/Preferences/multipassd/multipassd.conf
[General]
local.passphrase=d72c87d0f077c7766f2985dfab30e8955c373a13a1e93d315203939f542ff86e73ee37c31f4c4b571f4719fa8e3589f12db8dcb57ea9f56764bb7d58f64cf705

@ricab
Copy link
Collaborator Author

ricab commented Apr 7, 2022

Hmm good catch. Will dig.

ricab added 2 commits April 7, 2022 11:26
Check that the input password is hashed and reset.
Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup!

All good now :)

bors merge

(I know you won't :P)

@bors
Copy link
Contributor

bors bot commented Apr 7, 2022

Build failed:

  • Windows

@townsend2010 townsend2010 merged commit 0a776a2 into main Apr 7, 2022
@bors bors bot deleted the settings-handlers branch April 7, 2022 13:39
townsend2010 pushed a commit that referenced this pull request Apr 7, 2022
2352: Settings handlers r=Saviq a=ricab

This PR implements settings handlers.

Co-authored-by: Ricardo Abreu <ricardo.abreu@canonical.com>
townsend2010 pushed a commit that referenced this pull request Apr 7, 2022
2352: Settings handlers r=Saviq a=ricab

This PR implements settings handlers.

Co-authored-by: Ricardo Abreu <ricardo.abreu@canonical.com>
townsend2010 pushed a commit that referenced this pull request Apr 7, 2022
2352: Settings handlers r=Saviq a=ricab

This PR implements settings handlers.

Co-authored-by: Ricardo Abreu <ricardo.abreu@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants