From a513331ebce53c6c20a3e415806f4ce27b2b3683 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Thu, 8 Jan 2015 20:32:32 +0100 Subject: [PATCH] add unimplemented pgsqltasks --- gvapgsql/pgsqltasks/__init__.py | 4 ++ gvapgsql/pgsqltasks/models.py | 4 ++ gvapgsql/pgsqltasks/tasks.py | 72 +++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 gvapgsql/pgsqltasks/__init__.py create mode 100644 gvapgsql/pgsqltasks/models.py create mode 100644 gvapgsql/pgsqltasks/tasks.py diff --git a/gvapgsql/pgsqltasks/__init__.py b/gvapgsql/pgsqltasks/__init__.py new file mode 100644 index 0000000..c49a650 --- /dev/null +++ b/gvapgsql/pgsqltasks/__init__.py @@ -0,0 +1,4 @@ +""" +This module contains :py:mod:`pgsqltasks.tasks`. + +""" diff --git a/gvapgsql/pgsqltasks/models.py b/gvapgsql/pgsqltasks/models.py new file mode 100644 index 0000000..3a43087 --- /dev/null +++ b/gvapgsql/pgsqltasks/models.py @@ -0,0 +1,4 @@ +""" +Empty models to make Django accept pgsqltasks as an app. + +""" diff --git a/gvapgsql/pgsqltasks/tasks.py b/gvapgsql/pgsqltasks/tasks.py new file mode 100644 index 0000000..039b74a --- /dev/null +++ b/gvapgsql/pgsqltasks/tasks.py @@ -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 + + """