The old TKO web application (a bunch of cgi scripts located
in tko/) was broken with the change to South, since the
tko_test_view view was not contemplated in the datbase
creation schema and migration info.
Fortunately, it is all a matter of adding an sql for the
generation of the view and let autotest-database-turnkey
to process it. We don't need to add it to the Django
models or add it to the migration info, since no django
related code needs to touch it. Users that installed, say,
0.15.0 will have to manually run the sql that creates
the new view as a workaround.
CC: Cleber Rosa <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
frontend/tko/rpc_interface_unittest.py | 2 +-
frontend/tko/sql/test.sql | 31 --------------------------
frontend/tko/sql/tko-test-view-2.sql | 31 ++++++++++++++++++++++++++
frontend/tko/sql/tko-test-view.sql | 30 +++++++++++++++++++++++++
installation_support/autotest-database-turnkey | 8 ++++++-
5 files changed, 69 insertions(+), 33 deletions(-)
delete mode 100644 frontend/tko/sql/test.sql
create mode 100644 frontend/tko/sql/tko-test-view-2.sql
create mode 100644 frontend/tko/sql/tko-test-view.sql
diff --git a/frontend/tko/rpc_interface_unittest.py
b/frontend/tko/rpc_interface_unittest.py
index 3fe4413..8c00c1f 100755
--- a/frontend/tko/rpc_interface_unittest.py
+++ b/frontend/tko/rpc_interface_unittest.py
@@ -36,7 +36,7 @@ def get_create_test_view_sql():
Returns the SQL code that creates the test view
"""
dir_path = os.path.dirname(os.path.abspath(__file__))
- sql_path = os.path.join(dir_path, 'sql', 'test.sql')
+ sql_path = os.path.join(dir_path, 'sql', 'tko-test-view-2.sql')
return open(sql_path).read()
diff --git a/frontend/tko/sql/test.sql b/frontend/tko/sql/test.sql
deleted file mode 100644
index bdf3183..0000000
--- a/frontend/tko/sql/test.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-CREATE VIEW tko_test_view_2 AS
- SELECT
- tko_tests.test_idx AS test_idx,
- tko_tests.job_idx AS job_idx,
- tko_tests.test AS test_name,
- tko_tests.subdir AS subdir,
- tko_tests.kernel_idx AS kernel_idx,
- tko_tests.status AS status_idx,
- tko_tests.reason AS reason,
- tko_tests.machine_idx AS machine_idx,
- tko_tests.started_time AS test_started_time,
- tko_tests.finished_time AS test_finished_time,
- tko_jobs.tag AS job_tag,
- tko_jobs.label AS job_name,
- tko_jobs.username AS job_owner,
- tko_jobs.queued_time AS job_queued_time,
- tko_jobs.started_time AS job_started_time,
- tko_jobs.finished_time AS job_finished_time,
- tko_jobs.afe_job_id AS afe_job_id,
- tko_machines.hostname AS hostname,
- tko_machines.machine_group AS platform,
- tko_machines.owner AS machine_owner,
- tko_kernels.kernel_hash AS kernel_hash,
- tko_kernels.base AS kernel_base,
- tko_kernels.printable AS kernel,
- tko_status.word AS status
- FROM
- tko_tests JOIN tko_jobs ON tko_jobs.job_idx=tko_tests.job_idx
- JOIN tko_machines ON
tko_machines.machine_idx=tko_jobs.machine_idx
- JOIN tko_kernels ON tko_kernels.kernel_idx=tko_tests.kernel_idx
- JOIN tko_status ON tko_status.status_idx = tko_tests.status;
diff --git a/frontend/tko/sql/tko-test-view-2.sql
b/frontend/tko/sql/tko-test-view-2.sql
new file mode 100644
index 0000000..bc86d7c
--- /dev/null
+++ b/frontend/tko/sql/tko-test-view-2.sql
@@ -0,0 +1,31 @@
+CREATE VIEW tko_test_view_2 AS
+ SELECT
+ tko_tests.test_idx AS test_idx,
+ tko_tests.job_idx AS job_idx,
+ tko_tests.test AS test_name,
+ tko_tests.subdir AS subdir,
+ tko_tests.kernel_idx AS kernel_idx,
+ tko_tests.status AS status_idx,
+ tko_tests.reason AS reason,
+ tko_tests.machine_idx AS machine_idx,
+ tko_tests.started_time AS test_started_time,
+ tko_tests.finished_time AS test_finished_time,
+ tko_jobs.tag AS job_tag,
+ tko_jobs.label AS job_name,
+ tko_jobs.username AS job_owner,
+ tko_jobs.queued_time AS job_queued_time,
+ tko_jobs.started_time AS job_started_time,
+ tko_jobs.finished_time AS job_finished_time,
+ tko_jobs.afe_job_id AS afe_job_id,
+ tko_machines.hostname AS hostname,
+ tko_machines.machine_group AS platform,
+ tko_machines.owner AS machine_owner,
+ tko_kernels.kernel_hash AS kernel_hash,
+ tko_kernels.base AS kernel_base,
+ tko_kernels.printable AS kernel,
+ tko_status.word AS status
+ FROM
+ tko_tests JOIN tko_jobs ON tko_jobs.job_idx=tko_tests.job_idx
+ JOIN tko_machines ON
tko_machines.machine_idx=tko_jobs.machine_idx
+ JOIN tko_kernels ON tko_kernels.kernel_idx=tko_tests.kernel_idx
+ JOIN tko_status ON tko_status.status_idx = tko_tests.status;
diff --git a/frontend/tko/sql/tko-test-view.sql
b/frontend/tko/sql/tko-test-view.sql
new file mode 100644
index 0000000..c40049f
--- /dev/null
+++ b/frontend/tko/sql/tko-test-view.sql
@@ -0,0 +1,30 @@
+CREATE VIEW tko_test_view AS
+ SELECT tko_tests.test_idx AS test_idx,
+ tko_tests.job_idx AS job_idx,
+ tko_tests.test AS test,
+ tko_tests.subdir AS subdir,
+ tko_tests.kernel_idx AS kernel_idx,
+ tko_tests.status AS status,
+ tko_tests.reason AS reason,
+ tko_tests.machine_idx AS machine_idx,
+ tko_tests.started_time AS test_started_time,
+ tko_tests.finished_time AS test_finished_time,
+ tko_jobs.tag AS job_tag,
+ tko_jobs.label AS job_label,
+ tko_jobs.username AS job_username,
+ tko_jobs.queued_time AS job_queued_time,
+ tko_jobs.started_time AS job_started_time,
+ tko_jobs.finished_time AS job_finished_time,
+ tko_machines.hostname AS machine_hostname,
+ tko_machines.machine_group AS machine_group,
+ tko_machines.owner AS machine_owner,
+ tko_kernels.kernel_hash AS kernel_hash,
+ tko_kernels.base AS kernel_base,
+ tko_kernels.printable AS kernel_printable,
+ tko_status.word AS status_word
+ FROM
+ tko_tests JOIN tko_jobs ON tko_jobs.job_idx = tko_tests.job_idx
+ JOIN tko_machines ON tko_machines.machine_idx =
tko_jobs.machine_idx
+ JOIN tko_kernels ON tko_kernels.kernel_idx =
tko_tests.kernel_idx
+ JOIN tko_status ON tko_status.status_idx = tko_tests.status;
+
diff --git a/installation_support/autotest-database-turnkey
b/installation_support/autotest-database-turnkey
index a3a12bf..d593668 100755
--- a/installation_support/autotest-database-turnkey
+++ b/installation_support/autotest-database-turnkey
@@ -189,11 +189,17 @@ class App(object):
this_path = os.path.dirname(os.path.abspath(__file__))
base_path = os.path.dirname(this_path)
tko_view_sql_path = os.path.join(base_path, 'frontend', 'tko',
- 'sql', 'test.sql')
+ 'sql', 'tko-test-view.sql')
+ tko_view_2_sql_path = os.path.join(base_path, 'frontend', 'tko',
+ 'sql', 'tko-test-view-2.sql')
if os.path.exists(tko_view_sql_path):
sql = open(tko_view_sql_path).read()
if not (mngr.run_sql(sql)):
return -1
+ if os.path.exists(tko_view_2_sql_path):
+ sql = open(tko_view_2_sql_path).read()
+ if not (mngr.run_sql(sql)):
+ return -1
return 0
else: