-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
[MM-12623] Create CLI command "config reset" #10296
[MM-12623] Create CLI command "config reset" #10296
Conversation
…to the config_test.go
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.
Thanks for the contribution @joshuabezaleel! 👍
These two copy pasted error let the build fail.
I am sorry that the errors slip through. To be honest I didn't know why the build failed. Changes submitted. |
Any idea why is this failing? I am really sorry but I still can not seem to understand why 🙁 |
It was a wanky test, not related to your PR. Green now. |
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.
I really like the PR, needs some changes, but in general looks good :)
Hi, @jespino I am sorry if I got a really bad question. Do you have any idea why? |
…rint debug statement
Hey @joshuabezaleel, You need to merge |
cmd/mattermost/commands/config.go
Outdated
CommandPrettyPrintln("Are you sure you want to reset all the configuration settings?(YES/NO): ") | ||
fmt.Scanln(&confirmResetAll) | ||
if confirmResetAll == "YES" { | ||
currentConfigMap := configToMap(*currentConfig) |
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.
This option should be atomic and simpler. The app.UpdateConfig
is already storing the configuration in each iteration, so, if something goes wrong in one iteration, you will end up with a partial reset of the configuration.
Here probably you simply need something like app.SaveConfig(defaultConfig, false)
.
cmd/mattermost/commands/config.go
Outdated
} | ||
|
||
for _, arg := range args { | ||
f := resetConfigValue(arg, defaultConfig, currentConfig) |
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.
Here we have the same problem, you can end up with a partial reset of your config, and actually, with an invalid configuration. Would be great if the changes to the config are done to a temporary config object, and at the end, we validate the new config and save it using the app.SaveConfig
function.
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.
Thanks @joshuabezaleel !
@joshuabezaleel Would you be open on fixing the issue found by our new linter? Let me know, if you need help with this or if I should take care of this. |
Thanks for the contribution @joshuabezaleel! I finished the PR for you. I hope you are fine with this. |
* master: (70 commits) Run unused against codebase (mattermost#12968) [MM-12623] Create CLI command "config reset" (mattermost#10296) Migrate tests from store/storetest/status_store.go to use test… (mattermost#12873) Fix golangci-lint target (mattermost#12985) [MM-16437] Plugin crashes the server when calling WriteHeader with an invalid http code (mattermost#11276) MM-18060: Include deleted posts in compliance export. (mattermost#12957) [MM-18331] When patching a bot send websocket notification (mattermost#12373) [MM-19473] Fix data race on user login (mattermost#12870) license, openGraph tests: convert to testify (mattermost#12919) oauth_test: use testify (mattermost#12949) [MM-18830] Unhelpful error message when adding bot to a channel before adding to team (mattermost#12844) emoji_test: update to use testify (mattermost#12932) MM-19310 - Wrong validation message when Bot name ends in a . (mattermost#12905) Migrate tests from store/storetest/oauth_store.go to use testify (mattermost#12875) Include extra metadata when clicking an interactive button (mattermost#12697) MM-19553: Generate valid passwords on bulk import. (mattermost#12871) Convert api4/webhook_test.go t.Fatal calls into require/assert calls (mattermost#12904) Fix golangci-lint target for non GOPATH installations (mattermost#12934) MM-17888 Check plugin Helpers minimum server version comments (mattermost#12663) [MM-18898] Stringify plugin.Log* parameters (mattermost#12700) ...
No problem @joshuabezaleel, this was quickly done. Thanks again for the PR 👍 |
Hey @hanzei , I am truly sorry that I've just saw this 🙁 Thank you for taking care of the linting issues for me, that's very kind of you!! 🙂 Nah, I am the one who should be thanking you folks for the opportunity to learn and contribute, and for being very patient with me for this long contribution. I hope you folks are still okay for me taking care of other issues in the future. This was a realy pleasant experience for me. Once again, thank you. Looking forward to contributing more to Mattermost!! 🎉 |
Thanks for the kind words Joshua. It would be great if you continue contributing to Mattermost. I'm looking forward to more awesome PR from you. Let me know, if you have any questions about tickets. |
* Update command-line-tools.rst Docs for mattermost/mattermost#10296 * Update source/administration/command-line-tools.rst Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com>
* Update conf.py (#3165) * Update organizing-conversations.rst (#3204) Docs for PR: mattermost/mattermost-webapp#3702 * Update guest-accounts.rst (#3207) * Update guest-accounts.rst docs for mattermost/mattermost#13007 * Update guest-accounts.rst * Update command-line-tools.rst (#3209) * Update command-line-tools.rst Docs for mattermost/mattermost#10296 * Update source/administration/command-line-tools.rst Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com> * Update open-source-components.rst (#3214) * Delete email_notification_chart.png * Update config-settings.rst (#3210) * Update config-settings.rst Docs for mattermost/mattermost#11944 * Update config-settings.rst * Update config-settings.rst * Update telemetry for 5.18 (#3232) * Update telemetry.rst * Update telemetry.rst * MM-19844 - Disallow plugin upload w/signature Added some information about why you cannot upload and enable signature simultaneously. * removed extra line * Update config-settings.rst (#3226) * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update config-settings.rst * Update source/administration/config-settings.rst Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com> * Update source/administration/config-settings.rst Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com> * Update source/administration/config-settings.rst Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com> * Update config-settings.rst * Update config-settings.rst * v5.18 docs (ES) (#3238) * Update email notification flow chart * Update signing-in.rst * Update sending-messages.rst * Update mobile-faq.rst * Update mobile-compile-yourself.rst * Delete mobile_push_contents.png * Add files via upload * Update mobile-faq.rst * Update config-settings.rst * Update mobile-appstore-install.rst * Update source/mobile/mobile-faq.rst Co-Authored-By: Amy Blais <amy_blais@hotmail.com> * Update source/mobile/mobile-appstore-install.rst Co-Authored-By: Amy Blais <amy_blais@hotmail.com> * Update source/administration/config-settings.rst Co-Authored-By: Amy Blais <amy_blais@hotmail.com> * Update source/mobile/mobile-compile-yourself.rst Co-Authored-By: Amy Blais <amy_blais@hotmail.com> * Update mobile-faq.rst * Add plugin marketplace telemetry (#3197) * Update data-retention.rst (#3240) * Update data-retention.rst Fixed procedure order and UI terms. * Update data-retention.rst (#3241) Reviewed process/steps and edited. Added some clarification comments for process. * Update data-retention.rst Clarified retention periods/deletion times. * v5.18 Changelog (#3164) * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update source/administration/changelog.md Co-Authored-By: Dennis Kittrell <dennis.kittrell@mattermost.com> * Update changelog.md * Update changelog.md * Update changelog.md * Update changelog.md * Update docs for archived channels (#3177) * Update config setting description for ViewArchivedChannels * Update organizing-conversations.rst * Update important-upgrade-notes.rst (#3180) * Update important-upgrade-notes.rst * Update important-upgrade-notes.rst * Update important-upgrade-notes.rst * Update important-upgrade-notes.rst * Update compliance.rst (#3239) * Update compliance.rst Confirm UI steps against 5.18 UI and fixed minor formatting/typos. * Update source/administration/compliance.rst Co-Authored-By: Amy Blais <amy_blais@hotmail.com> * Update changelog.md * Update changelog.md * Update changelog.md * Update important-upgrade-notes.rst * Update changelog.md * Update important-upgrade-notes.rst * Update changelog.md * Update changelog.md
Summary
Add the CLI command
config reset
and also it's testTicket Link
Fixes #9596
Checklist