add documentation, move to proper file structure

This commit is contained in:
Jan Dittberner 2015-01-01 14:33:53 +01:00
parent d937450819
commit cf62cc6946
14 changed files with 93 additions and 6 deletions

View file

@ -29,12 +29,6 @@ The project module :py:mod:`gvamysql`
.. automodule:: gvamysql.urls .. automodule:: gvamysql.urls
:py:mod:`gvamysql.exceptions`
-----------------------------
.. automodule:: gvamysql.exceptions
:py:mod:`gvamysql.wsgi` :py:mod:`gvamysql.wsgi`
----------------------- -----------------------

10
gvamysql/manage.py Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gvafile.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

View file

@ -0,0 +1,3 @@
"""
This module contains :py:mod:`mysqltasks.tasks`.
"""

View file

@ -0,0 +1,3 @@
"""
Empty models module required for Django to accept this as an app.
"""

View file

@ -0,0 +1,76 @@
"""
This module defines Celery_ tasks to manage MySQL users and database.
"""
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from celery import shared_task
from celery.utils.log import get_task_logger
_LOGGER = get_task_logger(__name__)
@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):
"""
This task deletes an existing MySQL database.
:param str dbname: database name
:return: True if the database has been deleted, False otherwise
:rtype: boolean
"""

View file

@ -8,3 +8,4 @@ celery==3.1.17
kombu==3.0.24 kombu==3.0.24
pytz==2014.10 pytz==2014.10
wsgiref==0.1.2 wsgiref==0.1.2
mysqlclient==1.3.4