Finish uninstall task

This commit is contained in:
Roberto Rosario
2012-06-01 03:39:06 -04:00
parent f8226e662e
commit 2e0b2f6535
6 changed files with 23 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
from fabric.api import task
from fabric.api import task, env
from fabric.colors import white
import databases as database
@@ -43,10 +43,11 @@ def install():
@task
def uninstall():
platform.uninstall()
platform.delete_mayan()
webserver.remove_site()
webserver.restart()
if env.drop_database:
database.drop()
database.drop_database()

View File

@@ -32,6 +32,7 @@ def setup_environment():
env['database_username'] = getattr(env, 'database_username', DEFAULT_DATABASE_USERNAME)
env['database_password'] = getattr(env, 'database_password', password_generator())
env['database_host'] = getattr(env, 'database_host', DEFAULT_DATABASE_HOST)
env['drop_database'] = getattr(env, 'drop_database', False)
if not getattr(env, 'database_manager_admin_password', None):
print('Must set the database_manager_admin_password entry in the fabric settings file (~/.fabricrc by default)')

View File

@@ -1,4 +1,4 @@
from fabric.api import run, sudo, cd, env, task
from fabric.api import run, env, task, settings
def create_database():
@@ -14,5 +14,6 @@ def drop_database():
"""
Drop MySQL's Mayan EDMS's database
"""
with settings(warn_only=True):
run('echo "drop database %(database_name)s;" | mysql -u root --password=%(database_manager_admin_password)s' % env)

View File

@@ -62,3 +62,15 @@ def install_webserver():
if env.os == OS_UBUNTU:
ubuntu.install_webserver()
@task
def delete_mayan():
"""
Delete Mayan EDMS from the OS
"""
print(green('Deleting Mayan EDMS files', bold=True))
if env.os == OS_UBUNTU:
ubuntu.delete_mayan()

View File

@@ -10,9 +10,9 @@ def install_dependencies():
sudo('apt-get install -y git-core gcc tesseract-ocr unpaper python-virtualenv ghostscript libjpeg-dev libpng-dev poppler-utils')
def uninstall():
def delete_mayan():
"""
Uninstall Mayan EDMS from an Ubuntu system
Delete Mayan EDMS files from an Ubuntu system
"""
sudo('rm %s -Rf' % env.virtualenv_path)

View File

@@ -22,7 +22,7 @@ def remove_site():
"""
Install Mayan EDMS's site file from the webserver's configuration
"""
print(green('Removing Mayan EDMS\s site file from %s configuration' % env.webserver_name, bold=True))
print(green('Removing Mayan EDMS\'s site file from %s configuration' % env.webserver_name, bold=True))
if env.webserver == WEB_APACHE:
apache.remove_site()