Add Fedora support to the fabfile (Tested on Fedora 17)

This commit is contained in:
Roberto Rosario
2012-06-02 01:41:23 -04:00
parent f9e028e134
commit a0193ca78b
9 changed files with 163 additions and 45 deletions

View File

@@ -1,34 +1,49 @@
import os
from fabric.api import run, sudo, cd, env, task
from fabric.api import run, sudo, cd, env, task, settings
from fabric.contrib.files import upload_template
from ..literals import OS_UBUNTU, OS_FEDORA
def install_site():
"""
Install Mayan EDMS's site file in Apache configuration
"""
# TODO: configurable site name
upload_template(filename=os.path.join('fabfile', 'templates', 'apache_site'), destination='/etc/apache2/sites-available/mayan', context=env, use_sudo=True)
sudo('a2ensite mayan')
if env.os == OS_UBUNTU:
upload_template(filename=os.path.join('fabfile', 'templates', 'apache_site'), destination='/etc/apache2/sites-available/mayan', context=env, use_sudo=True)
sudo('a2ensite mayan')
elif env.os == OS_FEDORA:
upload_template(filename=os.path.join('fabfile', 'templates', 'apache_site'), destination='/etc/httpd/conf.d/mayan.conf', context=env, use_sudo=True)
def remove_site():
"""
Install Mayan EDMS's site file from Apache's configuration
"""
sudo('a2dissite mayan')
if env.os == OS_UBUNTU:
sudo('a2dissite mayan')
elif env.os == OS_FEDORA:
with settings(warn_only=True):
sudo('rm /etc/httpd/conf.d/mayan.conf')
def restart():
"""
Restart Apache
"""
sudo('/etc/init.d/apache2 restart')
if env.os == OS_UBUNTU:
sudo('/etc/init.d/apache2 restart')
elif env.os == OS_FEDORA:
sudo('systemctl restart httpd.service')
def reload():
"""
Reload Apache configuration files
"""
sudo('/etc/init.d/apache2 reload')
if env.os == OS_UBUNTU:
sudo('/etc/init.d/apache2 reload')
elif env.os == OS_FEDORA:
sudo('systemctl reload httpd.service')