#475 [frontend] add get_admins command to manage.py
Merged 5 years ago by msuchy. Opened 5 years ago by clime.

@@ -586,6 +586,13 @@ 

          db.session.commit()

  

  

+ class GetAdminsCommand(Command):

+ 

+     def run(self, **kwargs):

+         for u in models.User.query.filter(models.User.admin == True).all():

+             print(u.username)

+ 

+ 

  manager = Manager(app)

  manager.add_command("test", TestCommand())

  manager.add_command("create_sqlite_file", CreateSqliteFileCommand())
@@ -606,6 +613,7 @@ 

  manager.add_command("update_graphs", UpdateGraphsDataCommand())

  manager.add_command("vacuum_graphs", RemoveGraphsDataCommand())

  manager.add_command("notify_outdated_chroots", NotifyOutdatedChrootsCommand())

+ manager.add_command("get_admins", GetAdminsCommand())

  

  if __name__ == "__main__":

      manager.run()

This PR adds get_admins subcommand to manage.py so that we can get the list of admins in an ansible playbook and not call ./manage.py alter_user --admin on those users who are already admins.

Pull-Request has been merged by msuchy

5 years ago
Metadata