Skip to content

Commit

Permalink
undo_items: Gracefully handle skipped cruft items in undo
Browse files Browse the repository at this point in the history
In 203466b, we stopped migrating cruft items if they were not in
testing already.  However, if the migration failed we would still
attempt to undo it from testing, which (unsurprisingly) does not work
very well.

Signed-off-by: Niels Thykier <niels@thykier.net>
  • Loading branch information
nthykier committed Apr 27, 2016
1 parent 4ced8a3 commit 2e81e55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions britney_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,17 @@ def undo_changes(lundo, inst_tester, sources, binaries, all_binary_packages,
# undo all new binaries (consequence of the above)
for (undo, item) in lundo:
if not item.is_removal and item.package in sources[item.suite]:
for pkg_id in sources[item.suite][item.package][BINARIES]:
source_data = sources[item.suite][item.package]
for pkg_id in source_data[BINARIES]:
binary, _, arch = pkg_id
if item.architecture in ['source', arch]:
del binaries["testing"][arch][0][binary]
try:
del binaries["testing"][arch][0][binary]
except KeyError:
# If this happens, pkg_id must be a cruft item that
# was *not* migrated.
assert source_data[VERSION] != all_binary_packages[pkg_id][VERSION]
assert not inst_tester.any_of_these_are_in_testing((pkg_id,))
inst_tester.remove_testing_binary(pkg_id)


Expand Down

0 comments on commit 2e81e55

Please sign in to comment.