Repository navigation
fix: keep the current mode when delete or an unknown mode is saved while the container runs - #318
Merged
Merged
Conversation
…ile the container runs
Owner
Author
|
@coderabbitai full review |
✅ Action performedFull review finished. |
This file contains hidden or 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
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.
Summary
mode = deleteruns the interactive delete at startup. The config reload didn't check the mode at all, so adeletesaved while the container ran (by hand inbeatscheck.confor through the API), or a typo such asreprot, became the mode for every later pass.run_scantreats any mode it doesn't know likereport, so the container went on scanning as if in report mode while the setting said otherwise, and a saveddeletealso cancelled a runningrescan move.Now:
_usable_saved_modechecks the saved mode at each reload.setup,reportandmoveapply as before, in any letter case. Fordeleteit logs that delete mode runs only at startup and points todocker exec -it beatscheck delete; for anything else it logsUnknown mode '…' in beatscheck.conf. Either way the current mode stays, so a rescan's mode also holds._RUNTIME_MODES(setup,report,move) lists the modes a running container can switch to. The WebUI save rejects any othermodewith a 400 and leaves the file alone. The Settings select already offers only those three.MODE=deletestill runs the interactive delete, and an unknown mode still stops the container with an error.docs/configuration.mddescribes this in themoderow.Testing
tests/test_runtime_mode.py(5 tests, 8 cases):deletekeeps the current mode and logs thedocker execline; an unknown mode keeps it and logs the name.deletedoesn't end arescan move.delete, an unknown mode and a number, and acceptsMove.Moveaccepted) are guards for behaviour that already worked.Summary by CodeRabbit
Bug Fixes
deleteor unrecognized.Documentation
deleteis available only at startup and provided the command to run it while the container is active.