Skip to content

Commit

Permalink
cmd-prune: don't prune the ostree repo if non-existant
Browse files Browse the repository at this point in the history
In cases where we buildfetch a bunch of different builds if we then
want to clean some of them up easily with `cosa prune` it will fail
if there is no ostree repo at `tmp/repo`. Let's just check and if
nothing is there then let's not try to clean it up.
  • Loading branch information
dustymabe committed Apr 5, 2024
1 parent 78eeb46 commit de0c961
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmd-prune
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ error_during_pruning = False
for build in builds_to_delete:
print(f"Pruning build {build.id}")
try:
subprocess.check_call(['ostree', '--repo=tmp/repo', 'refs', '--delete', build.id])
if os.path.exists('tmp/repo'):
subprocess.check_call(['ostree', '--repo=tmp/repo', 'refs', '--delete', build.id])
rmtree(os.path.join(builds_dir, build.id))
except Exception as e:
error_during_pruning = True
Expand Down

0 comments on commit de0c961

Please sign in to comment.