|
|
a60cd7 |
From f0f9bb1e9ab024da1ab4f9311164294404f536df Mon Sep 17 00:00:00 2001
|
|
|
a60cd7 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
Date: Mon, 27 Jan 2014 10:29:32 +0100
|
|
|
a60cd7 |
Subject: [ABRT PATCH 17/27] harvest-vmcore: properly handle inaccessible dir
|
|
|
a60cd7 |
error
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Related to rhbz#1032511
|
|
|
a60cd7 |
|
|
|
a60cd7 |
rmarko: added missing newlines to sys.stderr.write calls
|
|
|
a60cd7 |
|
|
|
a60cd7 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
a60cd7 |
---
|
|
|
a60cd7 |
src/hooks/abrt_harvest_vmcore.py.in | 19 ++++++++++++++-----
|
|
|
a60cd7 |
1 file changed, 14 insertions(+), 5 deletions(-)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
a60cd7 |
index ecfb32d..17e2be8 100644
|
|
|
a60cd7 |
--- a/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
a60cd7 |
+++ b/src/hooks/abrt_harvest_vmcore.py.in
|
|
|
a60cd7 |
@@ -231,10 +231,19 @@ def harvest_vmcore():
|
|
|
a60cd7 |
f_full = os.path.join(dump_dir, cfile)
|
|
|
a60cd7 |
if not os.path.isdir(f_full):
|
|
|
a60cd7 |
continue
|
|
|
a60cd7 |
- files = [ff for ff in os.listdir(f_full)
|
|
|
a60cd7 |
- if os.path.isfile(os.path.join(f_full, ff))]
|
|
|
a60cd7 |
- if 'vmcore' not in files:
|
|
|
a60cd7 |
+
|
|
|
a60cd7 |
+ try:
|
|
|
a60cd7 |
+ vmcoredirfilelist = os.listdir(f_full)
|
|
|
a60cd7 |
+ except OSError as ex:
|
|
|
a60cd7 |
+ sys.stderr.write("VMCore dir '%s' not accessible.\n" % f_full)
|
|
|
a60cd7 |
continue
|
|
|
a60cd7 |
+ else:
|
|
|
a60cd7 |
+ if all(("vmcore" != ff
|
|
|
a60cd7 |
+ for ff in vmcoredirfilelist
|
|
|
a60cd7 |
+ if os.path.isfile(os.path.join(f_full, ff)))):
|
|
|
a60cd7 |
+ sys.stderr.write(
|
|
|
a60cd7 |
+ "VMCore dir '%s' doesn't contain 'vmcore' file.\n" % f_full)
|
|
|
a60cd7 |
+ continue
|
|
|
a60cd7 |
|
|
|
a60cd7 |
destdir = os.path.join(abrtdumpdir, ('vmcore-' + cfile))
|
|
|
a60cd7 |
destdirnew = destdir + '.new'
|
|
|
a60cd7 |
@@ -250,7 +259,7 @@ def harvest_vmcore():
|
|
|
a60cd7 |
try:
|
|
|
a60cd7 |
shutil.copytree(f_full, destdirnew)
|
|
|
a60cd7 |
except (OSError, shutil.Error):
|
|
|
a60cd7 |
- sys.stderr.write("Unable to copy '%s' to '%s'. Skipping"
|
|
|
a60cd7 |
+ sys.stderr.write("Unable to copy '%s' to '%s'. Skipping\n"
|
|
|
a60cd7 |
% (f_full, destdirnew))
|
|
|
a60cd7 |
|
|
|
a60cd7 |
# delete .new dir so we don't create mess
|
|
|
a60cd7 |
@@ -261,7 +270,7 @@ def harvest_vmcore():
|
|
|
a60cd7 |
try:
|
|
|
a60cd7 |
shutil.rmtree(f_full)
|
|
|
a60cd7 |
except OSError:
|
|
|
a60cd7 |
- sys.stderr.write("Unable to delete '%s'. Ignoring" % f_full)
|
|
|
a60cd7 |
+ sys.stderr.write("Unable to delete '%s'. Ignoring\n" % f_full)
|
|
|
a60cd7 |
|
|
|
a60cd7 |
# Let abrtd know what type of problem it is:
|
|
|
a60cd7 |
create_abrtd_info(destdirnew)
|
|
|
a60cd7 |
--
|
|
|
a60cd7 |
1.8.3.1
|
|
|
a60cd7 |
|