Adding dry run option in Image.removeRecursive#843
Conversation
mtrmac
left a comment
There was a problem hiding this comment.
Thanks!
I don’t see any documented relationship between the Ignore option and a “dry run” feature; after this PR, there is no reason for a dry-run implementation to use the Ignore option; and there is no reason for a caller of Ignore to expect that removals wouldn’t happen.
And apart from the conceptual semantics, it doesn’t even work for the intended purpose anyway: Untag calls would still happen.
Should I add another option for dry run in |
|
I think you’ll also find that the current iterative logic for detecting / handling dangling images and parents does expect the removals to actually happen. So this would be a fairly major restructuring of code that claims itself to be “complex”. |
mtrmac
left a comment
There was a problem hiding this comment.
I think you’ll also find that the current iterative logic for detecting / handling dangling images and parents does expect the removals to actually happen.
It does expect the removals to happen but from what I saw it mainly looks at the The only calls in |
mtrmac
left a comment
There was a problem hiding this comment.
For a start, the danglingParent, err := parent.IsDangling(ctx) logic would be broken.
I’m not very familiar with this code and I didn’t look much further.
We can’t have a --dry-run option that under-reports its actions.
How would it break it? if it will find a dangling parent it will run with the same options and Would you rather I make a dedicated method for |
|
In dry-run, the parent would never be dangling; after a real removal, it could. I have no opinion on a good implementation here (and, sadly, no time to design one now — perhaps other maintainers can chime in). |
Signed-off-by: Mark Zvenigorodsky <mark.zvenigorodsky@gmail.com>
Partially resolving: containers/podman#27838
There's no consideration for the ignore option currently, this way we preserve current behavior and add the option