From b08e06d97d0fbce1d0878a98e737c0f072e8fdb8 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Feb 26 2020 09:30:16 +0000 Subject: Do not run find_images_to_rebuild 10 times. --- diff --git a/dev_scripts/find_images_to_rebuild.py b/dev_scripts/find_images_to_rebuild.py index f7e3abf..30bd4ca 100755 --- a/dev_scripts/find_images_to_rebuild.py +++ b/dev_scripts/find_images_to_rebuild.py @@ -31,16 +31,15 @@ if len(sys.argv) != 2: app_context = app.app_context() app_context.__enter__() -for i in range(10): - db.drop_all() - db.create_all() - db.session.commit() - - errata = Errata() - event = ErrataAdvisoryStateChangedEvent( - "fake_message", ErrataAdvisory.from_advisory_id(errata, sys.argv[1]), - dry_run=True) - - handler = RebuildImagesOnRPMAdvisoryChange() - with patch("freshmaker.consumer.get_global_consumer"): - handler.handle(event) +db.drop_all() +db.create_all() +db.session.commit() + +errata = Errata() +event = ErrataAdvisoryStateChangedEvent( + "fake_message", ErrataAdvisory.from_advisory_id(errata, sys.argv[1]), + dry_run=True) + +handler = RebuildImagesOnRPMAdvisoryChange() +with patch("freshmaker.consumer.get_global_consumer"): + handler.handle(event)