gva/gnuviechadmin/fileservertasks/tasks.py

136 lines
3.1 KiB
Python
Raw Normal View History

"""
This module defines task stubs for the tasks implemented in the gvafile Celery
worker.
"""
from __future__ import absolute_import
from celery import shared_task
@shared_task
def setup_file_sftp_userdir(username):
"""
This task creates the home directory for an SFTP user if it does not exist
yet.
:param str username: the user name
:raises Exception: if the SFTP directory of the user cannot be created
:return: the created directory name
:rtype: str
"""
@shared_task
def delete_file_sftp_userdir(username):
"""
This task recursively deletes the home directory of an SFTP user if it
does not exist yet.
:param str username: the user name
:raises Exception: if the SFTP directory of the user cannot be removed
:return: the removed directory name
:rtype: str
"""
@shared_task
def setup_file_mail_userdir(username):
"""
This task creates the mail base directory for a user if it does not exist
yet.
:param str username: the user name
:raises Exception: if the mail base directory for the user cannot be
created
:return: the created directory name
:rtype: str
"""
@shared_task
def delete_file_mail_userdir(username):
"""
This task recursively deletes the mail base directory for a user if it
does not exist yet.
:param str username: the user name
:raises Exception: if the mail base directory of the user cannot be removed
:return: the removed directory name
:rtype: str
"""
@shared_task
def create_file_mailbox(username, mailboxname):
"""
This task creates a new mailbox directory for the given user and mailbox
name.
:param str username: the user name
:param str mailboxname: the mailbox name
2015-01-29 21:03:55 +01:00
:raises Exception: if the mailbox directory cannot be created
:return: the created mailbox directory name
:rtype: str
"""
@shared_task
def delete_file_mailbox(username, mailboxname):
"""
This task deletes the given mailbox of the given user.
:param str username: the user name
:param str mailboxname: the mailbox name
2015-01-29 21:03:55 +01:00
:raises Exception: if the mailbox directory cannot be deleted
:return: the deleted mailbox directory name
:rtype: str
"""
@shared_task
def create_file_website_hierarchy(username, sitename):
"""
This task creates the directory hierarchy for a website.
:param str username: the user name
:param str sitename: name of the website
:return: the directory name
:rtype: str
"""
@shared_task
def delete_file_website_hierarchy(username, sitename):
"""
This task deletes the website hierarchy recursively.
:param str username: the user name
:param str sitename: name of the website
:return: the directory name
:rtype: str
"""
@shared_task
def set_file_ssh_authorized_keys(username, ssh_keys):
"""
This task sets the authorized keys for ssh logins.
:param str username: the user name
:param list ssh_key: an ssh_key
:raises Exception: if the update of the creation or update of ssh
authorized_keys failed
:return: the name of the authorized_keys file
:rtype: str
"""