|
|
b404a9 |
From 4c754657a3581b996ae540fbcbc261efd1f65ca2 Mon Sep 17 00:00:00 2001
|
|
|
b404a9 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
b404a9 |
Date: Thu, 16 Jan 2014 12:20:40 +0100
|
|
|
b404a9 |
Subject: [ABRT PATCH 10/12] vmcore: properly configure Augeas
|
|
|
b404a9 |
|
|
|
b404a9 |
Configure Augeas to parse only required configuration files:
|
|
|
b404a9 |
- /etc/mtab
|
|
|
b404a9 |
- /ect/kdump.conf
|
|
|
b404a9 |
|
|
|
b404a9 |
Related to rhbz#1054158
|
|
|
b404a9 |
|
|
|
b404a9 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
b404a9 |
---
|
|
|
b404a9 |
src/hooks/abrt_harvest_vmcore.py.in | 16 ++++++++++++++--
|
|
|
b404a9 |
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
b404a9 |
|
|
|
b404a9 |
diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
b404a9 |
index 64d6777..ecfb32d 100644
|
|
|
b404a9 |
--- a/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
b404a9 |
+++ b/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
b404a9 |
@@ -17,6 +17,18 @@ import augeas
|
|
|
b404a9 |
import problem
|
|
|
b404a9 |
|
|
|
b404a9 |
|
|
|
b404a9 |
+def get_augeas(module, file_path):
|
|
|
b404a9 |
+ """
|
|
|
b404a9 |
+ A function for efficient configuration of Augeas.
|
|
|
b404a9 |
+ Augeas modules are placed in /usr/share/augeas/lenses/dist
|
|
|
b404a9 |
+ """
|
|
|
b404a9 |
+
|
|
|
b404a9 |
+ aug_obj = augeas.Augeas(flags=augeas.Augeas.NO_MODL_AUTOLOAD)
|
|
|
b404a9 |
+ aug_obj.set("/augeas/load/{0}/lens".format(module), "{0}.lns".format(module))
|
|
|
b404a9 |
+ aug_obj.set("/augeas/load/{0}/incl".format(module), file_path)
|
|
|
b404a9 |
+ aug_obj.load()
|
|
|
b404a9 |
+ return aug_obj
|
|
|
b404a9 |
+
|
|
|
b404a9 |
def get_mount_point(part_id):
|
|
|
b404a9 |
"""
|
|
|
b404a9 |
A function used to look up a mount point in mtab using
|
|
|
b404a9 |
@@ -26,7 +38,7 @@ def get_mount_point(part_id):
|
|
|
b404a9 |
"""
|
|
|
b404a9 |
|
|
|
b404a9 |
# look up the identifier in /etc/mtab
|
|
|
b404a9 |
- result = augeas.Augeas().get("/files/etc/mtab/*"
|
|
|
b404a9 |
+ result = get_augeas("Fstab", "/etc/mtab").get("/files/etc/mtab/*"
|
|
|
b404a9 |
"[spec=\"" + part_id + "\"]/file")
|
|
|
b404a9 |
if result:
|
|
|
b404a9 |
return result
|
|
|
b404a9 |
@@ -53,7 +65,7 @@ def parse_kdump():
|
|
|
b404a9 |
"default path '%s'\n" % dump_path)
|
|
|
b404a9 |
return dump_path
|
|
|
b404a9 |
|
|
|
b404a9 |
- aug_obj = augeas.Augeas()
|
|
|
b404a9 |
+ aug_obj = get_augeas("Kdump", "/etc/kdump.conf")
|
|
|
b404a9 |
# check for path variable in kdump.conf
|
|
|
b404a9 |
kdump_path = aug_obj.get("/files/etc/kdump.conf/path")
|
|
|
b404a9 |
if kdump_path:
|
|
|
b404a9 |
--
|
|
|
b404a9 |
1.8.3.1
|
|
|
b404a9 |
|