From 9da29144d1df3c280993677d825a3e97cb4f9b40 Mon Sep 17 00:00:00 2001 From: Mathew Odden Date: Thu, 26 Mar 2015 10:23:06 -0500 Subject: [PATCH] Fix TODO in tempest testr prep script technical_debt = technical_debt - 1 This function is now available from the subunit2sql 0.4.2 API, so lets use it and clean up this TODO. Change-Id: I5acf279b2e78dddaeb59489d01d92c00ee996f8d --- nodepool/scripts/prepare_tempest_testrepository.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/nodepool/scripts/prepare_tempest_testrepository.py b/nodepool/scripts/prepare_tempest_testrepository.py index 8d32b2386e..2947baf492 100755 --- a/nodepool/scripts/prepare_tempest_testrepository.py +++ b/nodepool/scripts/prepare_tempest_testrepository.py @@ -17,9 +17,7 @@ import os import sys -from oslo.db.sqlalchemy import utils as db_utils from subunit2sql.db import api -from subunit2sql.db import models from subunit2sql import shell from subunit2sql import write_subunit @@ -35,18 +33,12 @@ else: TEMPEST_PATH = '/opt/stack/new/tempest' -def get_run_ids(session): - # TODO(mtreinish): Move this function into the subunit2sql db api - results = db_utils.model_query(models.Run, session).order_by( - models.Run.run_at.desc()).filter_by(fails=0).limit(10).all() - return map(lambda x: x.id, results) - - def main(): shell.parse_args([]) shell.CONF.set_override('connection', DB_URI, group='database') session = api.get_session() - run_ids = get_run_ids(session) + run_ids = api.get_recent_successful_runs(num_runs=10, + session=session) session.close() preseed_path = os.path.join(TEMPEST_PATH, 'preseed-streams') os.mkdir(preseed_path)