From 1ba21312ea4f5816ff047915b2972e2339141b6f Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 11 Jan 2024 00:05:56 -0500 Subject: [PATCH] Use flask manage for all versions The legacy method does not work any longer, so just use the Flask manage script and remove the obsolete legacy one. --- api-daemon/pvc-api-db-upgrade | 13 ++------ ...anage_flask.py => pvcapid-manage-flask.py} | 0 api-daemon/pvcapid-manage_legacy.py | 33 ------------------- 3 files changed, 2 insertions(+), 44 deletions(-) rename api-daemon/{pvcapid-manage_flask.py => pvcapid-manage-flask.py} (100%) delete mode 100755 api-daemon/pvcapid-manage_legacy.py diff --git a/api-daemon/pvc-api-db-upgrade b/api-daemon/pvc-api-db-upgrade index c75e4ae4..4031b252 100755 --- a/api-daemon/pvc-api-db-upgrade +++ b/api-daemon/pvc-api-db-upgrade @@ -12,16 +12,7 @@ fi pushd /usr/share/pvc -case "$( cat /etc/debian_version )" in - 10.*|11.*) - # Debian 10 & 11 - ./pvcapid-manage_legacy.py db upgrade - ;; - *) - # Debian 12+ - export FLASK_APP=./pvcapid-manage_flask.py - flask db upgrade - ;; -esac +export FLASK_APP=./pvcapid-manage-flask.py +flask db upgrade popd diff --git a/api-daemon/pvcapid-manage_flask.py b/api-daemon/pvcapid-manage-flask.py similarity index 100% rename from api-daemon/pvcapid-manage_flask.py rename to api-daemon/pvcapid-manage-flask.py diff --git a/api-daemon/pvcapid-manage_legacy.py b/api-daemon/pvcapid-manage_legacy.py deleted file mode 100755 index 30d9ed3e..00000000 --- a/api-daemon/pvcapid-manage_legacy.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -# pvcapid-manage_legacy.py - PVC Database management tasks (Legacy) -# Part of the Parallel Virtual Cluster (PVC) system -# -# Copyright (C) 2018-2024 Joshua M. Boniface -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################### - -from flask_migrate import Migrate, MigrateCommand, Manager - -from pvcapid.flaskapi import app, db -from pvcapid.models import * # noqa F401,F403 - -migrate = Migrate(app, db) -manager = Manager(app) - -manager.add_command("db", MigrateCommand) - -if __name__ == "__main__": - manager.run()