add mysqltasks and pgsqltasks with placeholders for the real tasks
This commit is contained in:
parent
ab50907b97
commit
e7ae0054b5
7 changed files with 162 additions and 0 deletions
|
@ -225,6 +225,8 @@ DJANGO_APPS = (
|
||||||
# Apps specific for this project go here.
|
# Apps specific for this project go here.
|
||||||
LOCAL_APPS = (
|
LOCAL_APPS = (
|
||||||
'taskresults',
|
'taskresults',
|
||||||
|
'mysqltasks',
|
||||||
|
'pgsqltasks',
|
||||||
'domains',
|
'domains',
|
||||||
'osusers',
|
'osusers',
|
||||||
'managemails',
|
'managemails',
|
||||||
|
|
4
gnuviechadmin/mysqltasks/__init__.py
Normal file
4
gnuviechadmin/mysqltasks/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
This module contains :py:mod:`mysqltasks.tasks`.
|
||||||
|
|
||||||
|
"""
|
4
gnuviechadmin/mysqltasks/models.py
Normal file
4
gnuviechadmin/mysqltasks/models.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
Empty models to make Django accept mysqltasks as an app.
|
||||||
|
|
||||||
|
"""
|
72
gnuviechadmin/mysqltasks/tasks.py
Normal file
72
gnuviechadmin/mysqltasks/tasks.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
"""
|
||||||
|
This module defines Celery_ tasks to manage MySQL users and databases.
|
||||||
|
|
||||||
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from celery import shared_task
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def create_mysql_user(username, password):
|
||||||
|
"""
|
||||||
|
This task creates a new MySQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:param str password: the password
|
||||||
|
:return: the created user's name
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def set_mysql_userpassword(username, password):
|
||||||
|
"""
|
||||||
|
Set a new password for an existing MySQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:param str password: the password
|
||||||
|
:return: True if the password could be set, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_mysql_user(username):
|
||||||
|
"""
|
||||||
|
This task deletes an existing MySQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:return: True if the user has been deleted, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def create_mysql_database(dbname, username):
|
||||||
|
"""
|
||||||
|
This task creates a new MySQL database for the given MySQL user.
|
||||||
|
|
||||||
|
:param str dbname: database name
|
||||||
|
:param str username: the user name of an existing MySQL user
|
||||||
|
:return: the database name
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_mysql_database(dbname, username):
|
||||||
|
"""
|
||||||
|
This task deletes an existing MySQL database and revokes privileges of the
|
||||||
|
given user on that database.
|
||||||
|
|
||||||
|
:param str dbname: database name
|
||||||
|
:param str username: the user name of an existing MySQL user
|
||||||
|
:return: True if the database has been deleted, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
4
gnuviechadmin/pgsqltasks/__init__.py
Normal file
4
gnuviechadmin/pgsqltasks/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
This module contains :py:mod:`pgsqltasks.tasks`.
|
||||||
|
|
||||||
|
"""
|
4
gnuviechadmin/pgsqltasks/models.py
Normal file
4
gnuviechadmin/pgsqltasks/models.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
Empty models to make Django accept pgsqltasks as an app.
|
||||||
|
|
||||||
|
"""
|
72
gnuviechadmin/pgsqltasks/tasks.py
Normal file
72
gnuviechadmin/pgsqltasks/tasks.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
"""
|
||||||
|
This module defines Celery_ tasks to manage PostgreSQL users and databases.
|
||||||
|
|
||||||
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from celery import shared_task
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def create_pgsql_user(username, password):
|
||||||
|
"""
|
||||||
|
This task creates a new PostgreSQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:param str password: the password
|
||||||
|
:return: the created user's name
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def set_pgsql_userpassword(username, password):
|
||||||
|
"""
|
||||||
|
Set a new password for an existing PostgreSQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:param str password: the password
|
||||||
|
:return: True if the password could be set, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_pgsql_user(username):
|
||||||
|
"""
|
||||||
|
This task deletes an existing PostgreSQL user.
|
||||||
|
|
||||||
|
:param str username: the user name
|
||||||
|
:return: True if the user has been deleted, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def create_pgsql_database(dbname, username):
|
||||||
|
"""
|
||||||
|
This task creates a new PostgreSQL database for the given PostgreSQL user.
|
||||||
|
|
||||||
|
:param str dbname: database name
|
||||||
|
:param str username: the user name of an existing PostgreSQL user
|
||||||
|
:return: the database name
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task
|
||||||
|
def delete_pgsql_database(dbname, username):
|
||||||
|
"""
|
||||||
|
This task deletes an existing PostgreSQL database and revokes privileges of
|
||||||
|
the given user on that database.
|
||||||
|
|
||||||
|
:param str dbname: database name
|
||||||
|
:param str username: the user name of an existing PostgreSQL user
|
||||||
|
:return: True if the database has been deleted, False otherwise
|
||||||
|
:rtype: boolean
|
||||||
|
|
||||||
|
"""
|
Loading…
Reference in a new issue