Repository navigation
feat: --dry-run for network commands (0.9.13) - #201
Merged
metharda merged 3 commits intoNov 25, 2026
Merged
Conversation
- network start/stop/restart/ip-forwarding, ports setup/add/remove/apply/clear and dhcp clear/cleanup/renew show what they would change and change nothing - These commands refuse arguments they don't take instead of running - Users may dry-run ports add/remove on their own VMs Closes metharda#23
…at restate the code
metharda
approved these changes
Nov 25, 2026
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.
Description
Adds
--dry-run(-n) to the network commands, as asked in #23: each one shows what it would do, rule by rule, and changes nothing.Covered:
network start|stop|restart|ip-forwarding,ports setup|add|remove|apply|clear,dhcp clear|cleanup|renew.ports setupcounts the rules it would remove as gone when picking ports.ports setup --dry-rundoes not start a stopped network or wait for VMs without an address.ports addandremoveon their own VMs through the socket.network vncchanges the VM's definition rather than the network, so it has no dry run and refuses the flag.Behaviour change: these commands ignored arguments they don't take, so
ports clear --dry-run(or a typo of it) would have cleared the rules. They now fail with a usage line.Closes #23
Type of Change
Testing
test_network_dry_runinlib/utils/test-suite.sh(stubbed iptables, virsh and dnsmasq): previews, no changes made, unknown arguments run nothing, socket policy. It fails when the flag is made a no-op.test-suite.sh --quickpasses exceptbcand the ISO tools, which are not installed on my machine (same before this change).shfmt -i 2 -d(v3.8.0) andshellcheck -S errorare clean.Documentation
docs/networking.md,docs/usage.md, CHANGELOG, completion)Checklist