Repository navigation
fix(config): do not fail on a local disk that is not mounted - #3449
Merged
MichaIng merged 1 commit intoOct 12, 2026
Merged
Conversation
motion_camera_ui_to_dict() looked the partition of a local-disk storage device up with mounted_partitions[target_dev], so applying settings while the disk was not mounted raised a KeyError and failed with HTTP 500. This happens when the disk goes away after the settings were opened, and when posting back what GET returned for a camera whose disk is not mounted. Keep the stored target dir in that case. The root directory cannot be resolved without the mount point: the UI sends it relative to the mount point when the disk was mounted at load time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JamBalaya56562
force-pushed
the
fix/local-disk-not-mounted
branch
from
October 12, 2026 11:34
32bfb94 to
fe1c687
Compare
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.
What
motion_camera_ui_to_dict()no longer raises aKeyErrorwhen a camera'slocal-disk-…storage device is not mounted: it logs an error and keeps the stored target dir.Why
The partition was looked up with
mounted_partitions[target_dev], so applying settings while the disk was not mounted failed with HTTP 500. Two ways to get there:root_directoryrelative to the mount point, e.g./Camera1);GET /config/N/get/returned for a camera whose disk is not mounted (motion_camera_dict_to_ui()then returns the whole target dir).The stored target dir is kept rather than derived from
root_directory, because a relative root directory cannot be resolved without the mount point; using it as is would silently move recordings to e.g./Camera1on the root filesystem.Testing
New
tests/test_local_disk.py: mounted round trip, unmounted round trip, and disk unmounted between opening and applying the settings. All 3 pass; with the previousconfig.pythe unmounted cases fail withKeyError: '/dev/sda1'atconfig.py:1242.Full suite in a Linux container (python:3.12-bookworm): 227 passed, 168 subtests passed.
End-to-end in Docker with a real partition (a loop device formatted ext4, mounted at
/media/usband listed byfdisk -l), driven with Playwright: store the disk as storage device with root directory/Camera1, reopen the settings,umount /media/usb, change the camera name and apply. The UI postedstorage_device: local-disk-dev-loop1p1withroot_directory: /Camera1.dev(6476d00)/config/0/set/{"error": "internal server error"}target_dirafterwards/media/usb/Camera1/media/usb/Camera1(nothing saved)ruff check/ruff format --checkpass.Separate from #3448, which touches the same function for a
nullstorage device.🤖 Generated with Claude Code