fix: do not create networks and volumes with --dry-run - #1528
Open
Sanjays2402 wants to merge 2 commits into
Open
fix: do not create networks and volumes with --dry-run#1528Sanjays2402 wants to merge 2 commits into
Sanjays2402 wants to merge 2 commits into
Conversation
Podman.run() honors dry_run and only logs the command, but Podman.output() always spawns the process. assert_volume() and assert_cnt_nets() use output(), so 'podman-compose --dry-run up' really created every referenced network and volume, violating the semantics of --dry-run. Both now log the create command and skip it when dry_run is set, matching what Podman.run() already does for the create/start calls. Adds tests/unit/test_dry_run.py asserting that no create call is issued.
p12tic
requested changes
Aug 4, 2026
p12tic
left a comment
Collaborator
There was a problem hiding this comment.
Looks great, thanks. Please add a release note.
Author
|
Added in 53674d0: 469 unit tests still pass. |
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.
Closes #1440
Contributor Checklist:
Podman.run()honorsdry_runand only logs the command, butPodman.output()always spawns the process.assert_volume()andassert_cnt_nets()create throughoutput(), sopodman-compose --dry-run upreally created every referenced network and volume. Both now log the create command and skip it under--dry-run, matching whatrun()already does for the create/start calls.Compose spec reference for
--dry-run: https://docs.docker.com/reference/cli/docker/compose/#optionsUnit tests added in
tests/unit/test_dry_run.py: they assert that underdry_runthe only podman calls issued are the existence probes (volume inspect/network exists) and never acreate. Both fail on currentmainand pass with this change; the fulltests/unitsuite is green (469 passed), andruff check/ruff formatare clean on both changed files.I did not add a
newsfragments/entry because I wasn't sure whether this counts as user-visible enough to warrant one — happy to addnewsfragments/dry_run_no_side_effects.bugfixif you'd like it.This change was prepared with AI assistance; the regression tests were run locally and fail without the fix.