Skip to content

fix: clean up dut-network state dir on close#688

Merged
mangelajo merged 1 commit into
mainfrom
fix/cleanup-dut-network-state-dir-on-close
May 13, 2026
Merged

fix: clean up dut-network state dir on close#688
mangelajo merged 1 commit into
mainfrom
fix/cleanup-dut-network-state-dir-on-close

Conversation

@ambient-code

@ambient-code ambient-code Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When the DutNetwork driver is closed/reset, the runtime state directory (/var/lib/jumpstarter/dut-network-{interface}/) containing leases, pid files, config, and hosts files was not being cleaned up after dnsmasq was stopped
  • Added a call to dnsmasq.cleanup_state_dir() in the driver's cleanup() method so the entire state directory is removed, ensuring each new session starts with a clean state
  • Extracted NTP cleanup into a _stop_ntp() helper to keep cleanup() under the C901 complexity threshold

Test plan

  • Added unit test test_cleanup_removes_state_directory verifying cleanup_state_dir is called with the correct state path during cleanup
  • All 139 existing unit tests pass
  • Linting passes with make lint-fix

Closes #687

Generated with Claude Code

When the DutNetwork driver's cleanup() method runs (on close or reset),
the runtime state directory at /var/lib/jumpstarter/dut-network-{interface}/
was left behind after dnsmasq was stopped. This caused stale leases, pid
files, and other runtime state to persist across sessions.

Call dnsmasq.cleanup_state_dir() after stopping dnsmasq to remove the
entire state directory, ensuring each session starts with a clean state.

Also extract NTP cleanup into a _stop_ntp() helper to keep the cleanup()
method under the C901 complexity threshold.

Closes #687

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c6600b0-9922-41dd-84fe-ded15ec668e2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cleanup-dut-network-state-dir-on-close

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mangelajo mangelajo merged commit 954095f into main May 13, 2026
30 checks passed
@raballew raballew deleted the fix/cleanup-dut-network-state-dir-on-close branch June 5, 2026 11:38
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.

bug: when the dut network driver is closed/reset the leases remain

1 participant