~knielsen/ourdelta/bug_484127_484120_2

« back to all changes in this revision

Viewing changes to bakery/debian-5.1/dist/Ubuntu/mariadb-server-5.1.py

  • Committer: Arjen Lentz
  • Date: 2009-10-28 03:20:03 UTC
  • mfrom: (54.4.30 ourdelta-mariadb51-2)
  • Revision ID: arjen@openquery.com-20091028032003-3ebv58q8zin6xxbd
Merge from 5.1 bakery branch
Made autobake-deb.sh from 5.1 branch into separate autobake51-deb.sh (nasty merge)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''apport package hook for mariadb-5.1
 
2
 
 
3
(c) 2009 Canonical Ltd.
 
4
Author: Mathias Gug <mathias.gug@canonical.com>
 
5
'''
 
6
 
 
7
import os, os.path
 
8
 
 
9
from apport.hookutils import *
 
10
 
 
11
def _add_my_conf_files(report, filename):
 
12
    key = 'MySQLConf' + path_to_key(filename)
 
13
    report[key] = ""
 
14
    for line in read_file(filename).split('\n'):
 
15
        try:
 
16
            if 'password' in line.split('=')[0]:
 
17
                line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0])
 
18
            report[key] += line + '\n'
 
19
        except IndexError:
 
20
            continue
 
21
 
 
22
def add_info(report):
 
23
    attach_conffiles(report, 'mariadb-server-5.1', conffiles=None)
 
24
    key = 'Logs' + path_to_key('/var/log/daemon.log')
 
25
    report[key] = ""
 
26
    for line in read_file('/var/log/daemon.log').split('\n'):
 
27
        try:
 
28
            if 'mysqld' in line.split()[4]:
 
29
                report[key] += line + '\n'
 
30
        except IndexError:
 
31
            continue
 
32
    key = 'Logs' + path_to_key('/var/log/kern.log')
 
33
    report[key] = ""
 
34
    for line in read_file('/var/log/kern.log').split('\n'):
 
35
        try:
 
36
            if '/usr/sbin/mysqld' in string.join(line.split()[4:]):
 
37
                report[key] += line + '\n'
 
38
        except IndexError:
 
39
            continue
 
40
    attach_file(report,'/etc/apparmor.d/usr.sbin.mysqld')
 
41
    _add_my_conf_files(report, '/etc/mysql/my.cnf')
 
42
    for f in os.listdir('/etc/mysql/conf.d'):
 
43
        _add_my_conf_files(report, os.path.join('/etc/mysql/conf.d', f))
 
44
    try:
 
45
        report['MySQLVarLibDirListing'] = unicode(os.listdir('/var/lib/mysql'))
 
46
    except OSError:
 
47
        report['MySQLVarLibDirListing'] = unicode(False)
 
48
 
 
49
if __name__ == '__main__':
 
50
    report = {}
 
51
    add_info(report)
 
52
    for key in report:
 
53
        print '%s: %s' % (key, report[key].split('\n', 1)[0])