Module manage
[hide private]
[frames] | no frames]

Source Code for Module manage

 1  #!/usr/bin/python3 
 2   
 3   
 4  import importlib 
 5  from flask_script import Manager 
 6  from coprs import app 
 7   
 8   
 9  commands = { 
10      # General commands 
11      "test": "TestCommand", 
12   
13      # Database commands 
14      "create_sqlite_file": "CreateSqliteFileCommand", 
15      "create_db": "CreateDBCommand", 
16      "drop_db": "DropDBCommand", 
17   
18      # Chroot commands 
19      "create_chroot": "CreateChrootCommand", 
20      "alter_chroot": "AlterChrootCommand", 
21      "display_chroots": "DisplayChrootsCommand", 
22      "drop_chroot": "DropChrootCommand", 
23   
24      # User commands 
25      "alter_user": "AlterUserCommand", 
26      "add_user": "AddUserCommand", 
27      "dump_user": "DumpUserCommand", 
28   
29      # Other 
30      "get_admins": "GetAdminsCommand", 
31      "fail_build": "FailBuildCommand", 
32      "update_indexes": "UpdateIndexesCommand", 
33      "update_indexes_quick": "UpdateIndexesQuickCommand", 
34      "rawhide_to_release": "RawhideToReleaseCommand", 
35      "backend_rawhide_to_release": "BackendRawhideToReleaseCommand", 
36      "update_graphs": "UpdateGraphsDataCommand", 
37      "vacuum_graphs": "RemoveGraphsDataCommand", 
38      "notify_outdated_chroots": "NotifyOutdatedChrootsCommand", 
39      "delete_outdated_chroots": "DeleteOutdatedChrootsCommand", 
40  } 
41   
42   
43  manager = Manager(app) 
44  for cmdname, clsname in commands.items(): 
45      module = importlib.import_module("commands.{0}".format(cmdname)) 
46      cls = getattr(module, clsname) 
47      manager.add_command(cmdname, cls()) 
48   
49   
50  if __name__ == "__main__": 
51      manager.run() 
52