From ec7540e8f08ad3c5d2758f3d8d3a58fad8eb1fd8 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 17 Mar 2015 14:23:55 -0400 Subject: [PATCH] Fix terrible path finding code in 1679b5bc102 migration This commit fixes a blatant bug in the 1679b5bc102. If there was a '.' in the path of the migration file (which there will be if it's installed, because of python 2.x or python 3.x, then the hack of path finding code will not generate the correct path and the migration will fail before it even began. Change-Id: I4008b13dc356450eb463e81cff7d30230aed96eb --- .../1679b5bc102c_add_subsecond_columns_to_test_runs_table.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subunit2sql/migrations/versions/1679b5bc102c_add_subsecond_columns_to_test_runs_table.py b/subunit2sql/migrations/versions/1679b5bc102c_add_subsecond_columns_to_test_runs_table.py index bf292ce..6f0a8cc 100644 --- a/subunit2sql/migrations/versions/1679b5bc102c_add_subsecond_columns_to_test_runs_table.py +++ b/subunit2sql/migrations/versions/1679b5bc102c_add_subsecond_columns_to_test_runs_table.py @@ -40,7 +40,10 @@ CONF = cfg.CONF def upgrade(): - sql_path = os.path.realpath(__file__).split('.')[0] + '.mysql_upgrade.sql' + migration_file = ('1679b5bc102c_add_subsecond_columns_to_test_runs_table.' + 'mysql_upgrade.sql') + migration_dir = os.path.dirname(os.path.realpath(__file__)) + sql_path = os.path.join(migration_dir, migration_file) migration_context = context.get_context() if migration_context.dialect.name == 'mysql': with open(sql_path, 'r') as sql_file: