diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:44 +0000 |
commit | bf772a107fc4511b6e3e5aafddb762ca3fa74f0b (patch) | |
tree | 8d994c2f3d8e9f01da4d334f90a20798760d9318 /debian/additions/source_mariadb.py | |
parent | Adding upstream version 1:10.11.6. (diff) | |
download | mariadb-bf772a107fc4511b6e3e5aafddb762ca3fa74f0b.tar.xz mariadb-bf772a107fc4511b6e3e5aafddb762ca3fa74f0b.zip |
Adding debian version 1:10.11.6-2.debian/1%10.11.6-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/additions/source_mariadb.py')
-rw-r--r-- | debian/additions/source_mariadb.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/debian/additions/source_mariadb.py b/debian/additions/source_mariadb.py new file mode 100644 index 00000000..74c36335 --- /dev/null +++ b/debian/additions/source_mariadb.py @@ -0,0 +1,54 @@ +'''apport package hook for mariadb + +(c) 2009 Canonical Ltd. +Author: Mathias Gug <mathias.gug@canonical.com> +''' + +from __future__ import print_function, unicode_literals +import os, os.path + +from apport.hookutils import * + +def _add_my_conf_files(report, filename): + key = 'MySQLConf' + path_to_key(filename) + report[key] = "" + for line in read_file(filename).split('\n'): + try: + if 'password' in line.split('=')[0]: + line = "%s = @@APPORTREPLACED@@" % (line.split('=')[0]) + report[key] += line + '\n' + except IndexError: + continue + +def add_info(report): + attach_conffiles(report, 'mariadb-server', conffiles=None) + key = 'Logs' + path_to_key('/var/log/daemon.log') + report[key] = "" + for line in read_file('/var/log/daemon.log').split('\n'): + try: + if 'mariadbd' in line.split()[4]: + report[key] += line + '\n' + except IndexError: + continue + if os.path.exists('/var/log/mysql/error.log'): + key = 'Logs' + path_to_key('/var/log/mysql/error.log') + report[key] = "" + for line in read_file('/var/log/mysql/error.log').split('\n'): + report[key] += line + '\n' + attach_mac_events(report, '/usr/sbin/mariadbd') + attach_file(report,'/etc/apparmor.d/usr.sbin.mariadbd') + _add_my_conf_files(report, '/etc/mysql/mariadb.cnf') + for f in os.listdir('/etc/mysql/conf.d'): + _add_my_conf_files(report, os.path.join('/etc/mysql/conf.d', f)) + for f in os.listdir('/etc/mysql/mariadb.conf.d'): + _add_my_conf_files(report, os.path.join('/etc/mysql/mariadb.conf.d', f)) + try: + report['MySQLVarLibDirListing'] = str(os.listdir('/var/lib/mysql')) + except OSError: + report['MySQLVarLibDirListing'] = str(False) + +if __name__ == '__main__': + report = {} + add_info(report) + for key in report: + print('%s: %s' % (key, report[key].split('\n', 1)[0])) |