Changeset - bc4a8a686e3c
[Not reviewed]
0 2 0
Lance Edgar - 6 years ago 2019-02-16 18:21:40
ledgar@techsupport.coop
Add functions to deploy, enable apache config files
2 files changed with 26 insertions and 0 deletions:
0 comments (0 inline, 0 general) First comment
rattail_fabric2/apache.py
Show inline comments
 
@@ -92,6 +92,27 @@ def deploy_site(c, deployer, local_path, name, enable=False, **kwargs):
 
        enable_site(c, name)
 

	
 

	
 
def deploy_conf(c, deployer, local_path, name, enable=False, **kwargs):
 
    """
 
    Deploy a config snippet file to Apache
 
    """
 
    apache_version = get_version(c)
 
    if apache_version == 2.2:
 
        deployer(c, local_path, '/etc/apache2/conf.d/{}.conf'.format(name), **kwargs)
 
    else:
 
        deployer(c, local_path, '/etc/apache2/conf-available/{}.conf'.format(name), **kwargs)
 
        if enable:
 
            enable_conf(c, name)
 

	
 

	
 
def enable_conf(c, *names):
 
    """
 
    Enable the given Apache configurations
 
    """
 
    for name in names:
 
        c.sudo('a2enconf {}'.format(name))
 

	
 

	
 
def restart(c):
 
    """
 
    Restart the Apache web service
rattail_fabric2/core.py
Show inline comments
 
@@ -210,6 +210,11 @@ class Deployer(object):
 
        kwargs['use_sudo'] = True
 
        deploy_site(c, self, local_path, name, **kwargs)
 

	
 
    def apache_conf(self, c, local_path, name, **kwargs):
 
        from rattail_fabric2.apache import deploy_conf
 
        kwargs['use_sudo'] = True
 
        deploy_conf(c, self, local_path, name, **kwargs)
 

	
 
    def backup_app(self, c, envname='backup', *args, **kwargs):
 
        from rattail_fabric2.backup import deploy_backup_app
 
        deploy_backup_app(c, self, envname, *args, **kwargs)
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now