tmt icon indicating copy to clipboard operation
tmt copied to clipboard

tmt clean guest --keep doesn't prune the workdir

Open skycastlelily opened this issue 4 months ago • 3 comments

Reproducer:

(dev) lnie@fedora:~/tmt$ tmt clean -vvv guest  --keep 1
clean
guests
workdir root: /var/tmp/tmt
    Stopping guests in run '/var/tmp/tmt/run-002' plan '/plans/testcloud'.
        cleanup
            queued cleanup task #1: default-0 on default-0
            
            cleanup task #1: default-0 on default-0
            how: tmt
            order: 50
            guest: stopped
            guest: removed
        Skipping workdir prune as requested.
            summary: 1 task completed

tmt should not "Skipping workdir prune as requested.".

The problem is that self.plan.my_run.opt('keep'),due to there are --keep option both in run and clean guest, I guess we should rename the run.--keep:)

skycastlelily avatar Oct 14 '25 09:10 skycastlelily

Yeah, the tmt run --keep and tmt run cleanup --keep options should not collide. Looks like a bug which should be fixed.

psss avatar Oct 15 '25 09:10 psss

From the hacking session, we need to confirm which --keep we need to rename. The tmt run --keep we expect to be more regularly used and the cleanup --keep is more of an accidental name collision, but we need to double-check with the code.

LecrisUT avatar Nov 18 '25 13:11 LecrisUT

I was distracted and didn't manage to say 😅 : we have --keep option for tmt clean, tmt clean run, that's the reason why I chose change the run.--keep, but yeah, we need change many tests in that way,I don't have strong opinion on this:)

skycastlelily avatar Nov 19 '25 03:11 skycastlelily