~ubuntu-branches/ubuntu/wily/apache2/wily

« back to all changes in this revision

Viewing changes to debian/apache2.py

  • Committer: Martin Pitt
  • Date: 2012-07-16 08:02:16 UTC
  • mfrom: (77.1.1 apache2)
  • Revision ID: martin@piware.de-20120716080216-c9ewcnj71ytfdp3x
* debian/apache2.py
 - Update apport hook for python3 ; thanks to Edward Donovan (LP: #1013171)
 - Check if this directory exists: /etc/apache2/sites-enabled/

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
from apport.hookutils import *
16
16
import os
17
17
 
 
18
SITES_ENABLED_DIR = '/etc/apache2/sites-enabled/'
 
19
 
18
20
def add_info(report, ui):
19
 
    response = ui.yesno("The contents of your /etc/apache2/sites-enabled directory "
20
 
                        "may help developers diagnose your bug more "
21
 
                        "quickly.  However, it may contain sensitive "
22
 
                        "information.  Do you want to include it in your "
23
 
                        "bug report?")
24
 
 
25
 
    if response == None: # user cancelled
26
 
        raise StopIteration
27
 
 
28
 
    elif response == True:
29
 
        # Attache config files in /etc/apache2/sites-enabled and listing of files in /etc/apache2/conf.d 
30
 
        for conf_file in os.listdir('/etc/apache2/sites-enabled'):
31
 
            attach_file_if_exists(report, '/etc/apache2/sites-enabled/' + conf_file, conf_file)
32
 
        try:
33
 
            report['Apache2ConfdDirListing'] = unicode(os.listdir('/etc/apache2/conf.d'))
34
 
        except OSError:
35
 
            report['Apache2ConfdDirListing'] = unicode(False)
36
 
 
37
 
        # Attach default config files if changed.
38
 
        attach_conffiles(report, 'apache2.2-common', conffiles=None)
39
 
 
40
 
        # Attach the error.log file.
41
 
        attach_file(report, '/var/log/apache2/error.log', key='error.log')
42
 
 
43
 
        # Get loaded modules.
44
 
        report['Apache2Modules'] = root_command_output(['/usr/sbin/apachectl', '-D DUMP_MODULES'])
 
21
    if os.path.isdir(SITES_ENABLED_DIR):
 
22
        response = ui.yesno("The contents of your " + SITES_ENABLED_DIR + " directory "
 
23
                            "may help developers diagnose your bug more "
 
24
                            "quickly.  However, it may contain sensitive "
 
25
                            "information.  Do you want to include it in your "
 
26
                            "bug report?")
 
27
 
 
28
        if response == None: # user cancelled
 
29
            raise StopIteration
 
30
 
 
31
        elif response == True:
 
32
            # Attache config files in /etc/apache2/sites-enabled and listing of files in /etc/apache2/conf.d 
 
33
            for conf_file in os.listdir(SITES_ENABLED_DIR):
 
34
                attach_file_if_exists(report, SITES_ENABLED_DIR + conf_file, conf_file)
 
35
 
 
36
    try:
 
37
        report['Apache2ConfdDirListing'] = str(os.listdir('/etc/apache2/conf.d'))
 
38
    except OSError:
 
39
        report['Apache2ConfdDirListing'] = str(False)
 
40
 
 
41
    # Attach default config files if changed.
 
42
    attach_conffiles(report, 'apache2.2-common', conffiles=None)
 
43
 
 
44
    # Attach the error.log file.
 
45
    attach_file(report, '/var/log/apache2/error.log', key='error.log')
 
46
 
 
47
    # Get loaded modules.
 
48
    report['Apache2Modules'] = root_command_output(['/usr/sbin/apachectl', '-D DUMP_MODULES'])