The problem is: if no --id/--last is specified, tmt clean will rely on generate_runs, while generate_runs will check if there is run.yaml file in the workdir, but tmt try will Not create a run.yaml file.
Here is a one possible way to fix the problem^^
add the following line to generate_runs:
if invalid_run:
if abs_child_path.name.startswith('run-'):
with open(abs_child_path.joinpath('run.yaml'), 'w') as fp:
pass
invalid_run = False
we also need to change os.path.getmtime(workdir / 'run.yaml') to os.path.getatime(workdir) in def runs of Clean class, to have --keep works as expected.
we may also could fix it by having tmt try create a run.yaml,but we will likely see this problem again on other scenarios where no run.yaml is created.
The problem is: if no --id/--last is specified, tmt clean will rely on generate_runs, while generate_runs will check if there is run.yaml file in the workdir, but tmt try will Not create a run.yaml file. Here is a one possible way to fix the problem^^ add the following line to generate_runs: if invalid_run: if abs_child_path.name.startswith('run-'): with open(abs_child_path.joinpath('run.yaml'), 'w') as fp: pass invalid_run = False we also need to change os.path.getmtime(workdir / 'run.yaml') to os.path.getatime(workdir) in def runs of Clean class, to have --keep works as expected.
we may also could fix it by having tmt try create a run.yaml,but we will likely see this problem again on other scenarios where no run.yaml is created.
The original report is from this issue:https://github.com/teemtee/tmt/issues/2772