def prune_auto_generated_builds(domain, app_id): last_build_id = get_latest_build_id(domain, app_id) saved_builds = get_auto_generated_built_apps(domain, app_id) for doc in saved_builds: app = get_app(domain, doc['_id']) if app.id == last_build_id or app.is_released: continue if not app.is_auto_generated or app.copy_of != app_id or app.id == last_build_id: raise SavedAppBuildException( "Attempted to delete build that should not be deleted") app.delete()
def prune_auto_generated_builds(domain, app_id): last_build_id = get_latest_build_id(domain, app_id) saved_builds = get_auto_generated_built_apps(domain, app_id) for doc in saved_builds: app = get_app(domain, doc['_id']) if app.id == last_build_id or app.is_released: continue if not app.is_auto_generated or app.copy_of != app_id or app.id == last_build_id: raise SavedAppBuildException("Attempted to delete build that should not be deleted") app.delete_app() logger.info("Pruned build {} from domain {}".format(app.id, domain)) app.save(increment_version=False)