| |
@@ -22,79 +22,63 @@
|
| |
import commands.update_indexes
|
| |
import commands.update_indexes_quick
|
| |
import commands.update_indexes_required
|
| |
-
|
| |
+ import commands.get_admins
|
| |
+ import commands.fail_build
|
| |
import commands.rawhide_to_release
|
| |
+ import commands.update_graphs
|
| |
+ import commands.vacuum_graphs
|
| |
+ import commands.notify_outdated_chroots
|
| |
+ import commands.delete_outdated_chroots
|
| |
+ import commands.clean_expired_projects
|
| |
+ import commands.clean_old_builds
|
| |
+ import commands.delete_orphans
|
| |
|
| |
from flask_script import Manager
|
| |
from coprs import app
|
| |
|
| |
-
|
| |
- commands_old = {
|
| |
- # Other
|
| |
- "get_admins": "GetAdminsCommand",
|
| |
- "fail_build": "FailBuildCommand",
|
| |
- "update_graphs": "UpdateGraphsDataCommand",
|
| |
- "vacuum_graphs": "RemoveGraphsDataCommand",
|
| |
- "notify_outdated_chroots": "NotifyOutdatedChrootsCommand",
|
| |
- "delete_outdated_chroots": "DeleteOutdatedChrootsCommand",
|
| |
- "clean_expired_projects": "CleanExpiredProjectsCommand",
|
| |
- "clean_old_builds": "DeleteOldBuilds",
|
| |
- "delete_orphans": "DeleteOrphansCommand",
|
| |
- }
|
| |
-
|
| |
if os.getuid() == 0:
|
| |
sys.stderr.write("Please don't run this script as a 'root' user, use:\n")
|
| |
sys.stderr.write("$ sudo -u copr-fe {}\n".format(
|
| |
' '.join([pipes.quote(arg) for arg in sys.argv])))
|
| |
sys.exit(1)
|
| |
|
| |
- manager = Manager(app)
|
| |
- for cmdname, clsname in commands_old.items():
|
| |
- module = importlib.import_module("commands.{0}".format(cmdname))
|
| |
- cls = getattr(module, clsname)
|
| |
- manager.add_command(cmdname, cls())
|
| |
-
|
| |
- # General commands
|
| |
- app.cli.add_command(commands.test.test, "test")
|
| |
-
|
| |
- # Database commands
|
| |
- app.cli.add_command(commands.create_sqlite_file.create_sqlite_file_command, "create_sqlite_file")
|
| |
- app.cli.add_command(commands.create_db.create_db, "create_db")
|
| |
- app.cli.add_command(commands.drop_db.drop_db, "drop_db")
|
| |
-
|
| |
- # Chroot commands
|
| |
- app.cli.add_command(commands.create_chroot.create_chroot_command, "create_chroot")
|
| |
- app.cli.add_command(commands.alter_chroot.alter_chroot, "alter_chroot")
|
| |
- app.cli.add_command(commands.display_chroots.display_chroots, "display_chroots")
|
| |
- app.cli.add_command(commands.drop_chroot.drop_chroot, "drop_chroot")
|
| |
- app.cli.add_command(commands.branch_fedora.branch_fedora, "branch_fedora")
|
| |
- app.cli.add_command(commands.comment_chroot.comment_chroot, "comment_chroot")
|
| |
-
|
| |
- # User commands
|
| |
- app.cli.add_command(commands.alter_user.alter_user, "alter_user")
|
| |
- app.cli.add_command(commands.add_user.add_user, "add_user")
|
| |
- app.cli.add_command(commands.dump_user.dump_user, "dump_user")
|
| |
-
|
| |
- # Whooshee indexes
|
| |
- app.cli.add_command(commands.update_indexes.update_indexes, "update_indexes")
|
| |
- app.cli.add_command(commands.update_indexes_quick.update_indexes_quick, "update_indexes_quick")
|
| |
- app.cli.add_command(commands.update_indexes_required.update_indexes_required, "update_indexes_required")
|
| |
-
|
| |
-
|
| |
- # Other
|
| |
- #TODO
|
| |
- app.cli.add_command(commands.rawhide_to_release.rawhide_to_release, "rawhide_to_release")
|
| |
+ # General commands
|
| |
+ app.cli.add_command(commands.test.test, "test")
|
| |
+
|
| |
+ # Database commands
|
| |
+ app.cli.add_command(commands.create_sqlite_file.create_sqlite_file_command, "create_sqlite_file")
|
| |
+ app.cli.add_command(commands.create_db.create_db, "create_db")
|
| |
+ app.cli.add_command(commands.drop_db.drop_db, "drop_db")
|
| |
+
|
| |
+ # Chroot commands
|
| |
+ app.cli.add_command(commands.create_chroot.create_chroot_command, "create_chroot")
|
| |
+ app.cli.add_command(commands.alter_chroot.alter_chroot, "alter_chroot")
|
| |
+ app.cli.add_command(commands.display_chroots.display_chroots, "display_chroots")
|
| |
+ app.cli.add_command(commands.drop_chroot.drop_chroot, "drop_chroot")
|
| |
+ app.cli.add_command(commands.branch_fedora.branch_fedora, "branch_fedora")
|
| |
+ app.cli.add_command(commands.comment_chroot.comment_chroot, "comment_chroot")
|
| |
+
|
| |
+ # User commands
|
| |
+ app.cli.add_command(commands.alter_user.alter_user, "alter_user")
|
| |
+ app.cli.add_command(commands.add_user.add_user, "add_user")
|
| |
+ app.cli.add_command(commands.dump_user.dump_user, "dump_user")
|
| |
+
|
| |
+ # Whooshee indexes
|
| |
+ app.cli.add_command(commands.update_indexes.update_indexes, "update_indexes")
|
| |
+ app.cli.add_command(commands.update_indexes_quick.update_indexes_quick, "update_indexes_quick")
|
| |
+ app.cli.add_command(commands.update_indexes_required.update_indexes_required, "update_indexes_required")
|
| |
+
|
| |
+ # Other
|
| |
+ app.cli.add_command(commands.get_admins.get_admins, "get_admins")
|
| |
+ app.cli.add_command(commands.fail_build.fail_build, "fail_build")
|
| |
+ app.cli.add_command(commands.rawhide_to_release.rawhide_to_release, "rawhide_to_release")
|
| |
+ app.cli.add_command(commands.update_graphs.update_graphs, "update_graphs")
|
| |
+ app.cli.add_command(commands.vacuum_graphs.vacuum_graphs, "vacuum_graphs")
|
| |
+ app.cli.add_command(commands.notify_outdated_chroots.notify_outdated_chroots, "notify_outdated_chroots")
|
| |
+ app.cli.add_command(commands.delete_outdated_chroots.delete_outdated_chroots, "delete_outdated_chroots")
|
| |
+ app.cli.add_command(commands.clean_expired_projects.clean_expired_projects, "clean_expired_projects")
|
| |
+ app.cli.add_command(commands.clean_old_builds.clean_old_builds, "clean_old_builds")
|
| |
+ app.cli.add_command(commands.delete_orphans.delete_orphans, "delete_orphans")
|
| |
|
| |
if __name__ == "__main__":
|
| |
- # This is just temporary while migrating to flask script,
|
| |
- # values in arrays are already migrated parameters.
|
| |
- # Else part will be removed once migration is complete.
|
| |
- if sys.argv[1] in [
|
| |
- 'test', 'create_sqlite_file', 'create_db', 'drop_db',
|
| |
- 'create_chroot', 'alter_chroot', 'display_chroots', 'drop_chroot',
|
| |
- 'branch_fedora', 'comment_chroot', 'rawhide_to_release',
|
| |
- 'alter_user', 'add_user', 'dump_user', 'update_indexes',
|
| |
- 'update_indexes_quick', 'update_indexes_required']:
|
| |
- app.cli()
|
| |
- else:
|
| |
- manager.run()
|
| |
+ app.cli()
|
| |
get_admins.py - done
fail_build.py - done
rawhide_to_release.py - done
backend_rawhide_to_release.py - removed
update_graphs.py - done
vacuum_graphs.py - done
notify_outdated_chroots.py - done
delete_outdated_chroots.py - done
clean_expired_projects.py - done
clean_old_builds.py - done
delete_orphans.py - done