summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abrt.spec4
-rw-r--r--lib/Plugins/Python.cpp16
-rw-r--r--src/Hooks/Makefile.am5
-rw-r--r--src/Hooks/abrt_exception_handler.py.in4
-rw-r--r--src/Hooks/sitecustomize.py65
5 files changed, 35 insertions, 59 deletions
diff --git a/abrt.spec b/abrt.spec
index d9a6ec19..9b0b3617 100644
--- a/abrt.spec
+++ b/abrt.spec
@@ -285,7 +285,7 @@ fi
%dir %{_libdir}/%{name}
%{_mandir}/man8/abrtd.8.gz
%{_mandir}/man5/%{name}.conf.5.gz
-%{_mandir}/man5/pyhook.conf.5.gz
+#%{_mandir}/man5/pyhook.conf.5.gz
%{_mandir}/man7/%{name}-plugins.7.gz
%{_datadir}/polkit-1/actions/org.fedoraproject.abrt.policy
%{_datadir}/dbus-1/system-services/com.redhat.abrt.service
@@ -385,8 +385,6 @@ fi
%files addon-python
%defattr(-,root,root,-)
%attr(2755, root, abrt) %{_bindir}/%{name}-pyhook-helper
-%config(noreplace) %{_sysconfdir}/%{name}/pyhook.conf
-#%{python_sitearch}/ABRTUtils.so
%{_libdir}/%{name}/libPython.so*
%{python_site}/*.py*
diff --git a/lib/Plugins/Python.cpp b/lib/Plugins/Python.cpp
index a5e9909d..906e815d 100644
--- a/lib/Plugins/Python.cpp
+++ b/lib/Plugins/Python.cpp
@@ -4,7 +4,6 @@
#include "ABRTException.h"
#define FILENAME_BACKTRACE "backtrace"
-#define PYHOOK_CONFIG "/etc/abrt/pyhook.conf"
static std::string CreateHash(const char *pDebugDumpDir)
{
@@ -26,25 +25,10 @@ std::string CAnalyzerPython::GetGlobalUUID(const char *pDebugDumpDir)
void CAnalyzerPython::Init()
{
- std::ofstream fOutPySiteCustomize;
- fOutPySiteCustomize.open(PYHOOK_CONFIG);
- if (fOutPySiteCustomize.is_open())
- {
- fOutPySiteCustomize << "enabled = yes" << std::endl;
- fOutPySiteCustomize.close();
- }
}
void CAnalyzerPython::DeInit()
{
- // TODO: remove copied abrt exception handler
- std::ofstream fOutPySiteCustomize;
- fOutPySiteCustomize.open(PYHOOK_CONFIG);
- if (fOutPySiteCustomize.is_open())
- {
- fOutPySiteCustomize << "enabled = no" << std::endl;
- fOutPySiteCustomize.close();
- }
}
PLUGIN_INFO(ANALYZER,
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am
index 21569570..af51d99a 100644
--- a/src/Hooks/Makefile.am
+++ b/src/Hooks/Makefile.am
@@ -45,14 +45,9 @@ abrt_pyhook_helper_CPPFLAGS = \
abrt_pyhook_helper_LDADD = \
../../lib/Utils/libABRTUtils.la
-man_MANS = pyhook.conf.5
-
python_PYTHON = sitecustomize.py abrt_exception_handler.py
EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS)
-pyhookconfdir = $(CONF_DIR)
-dist_pyhookconf_DATA = pyhook.conf
-
CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc))
abrt_exception_handler.py:
diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in
index 6933ac00..a8da9808 100644
--- a/src/Hooks/abrt_exception_handler.py.in
+++ b/src/Hooks/abrt_exception_handler.py.in
@@ -133,10 +133,6 @@ def __dump_exception(out, text, tracebk):
except:
pass
-
-def __exception_window(title, text, component_name):
- pass
-
__ACTION_STR = ""
def action(what):
"""Describe what you want to do actually.
diff --git a/src/Hooks/sitecustomize.py b/src/Hooks/sitecustomize.py
index 71d8c4e1..97941e87 100644
--- a/src/Hooks/sitecustomize.py
+++ b/src/Hooks/sitecustomize.py
@@ -5,38 +5,41 @@
# and python interpreter runs it automatically everytime
# some python script is executed.
-config = None
-conf = {}
-try:
- config = open("/etc/abrt/pyhook.conf","r")
-except:
- # Silently ignore if file doesn't exist.
- pass
-
-try:
- if config:
- # we expect config in form
- # key = value
- # Enabled = yes
- # this should strip
- line = config.readline().lower().replace(' ','').strip('\n').split('=')
- conf[line[0]] = line[1]
- config.close()
-except:
- # Ignore silently everything, because we don't want to bother user
- # if this hook doesn't work.
- pass
+def abrt_daemon_ok():
+ try:
+ #FIXME: make it relocable! this will work only when installed in default path
+ #pidfile = open(VAR_RUN_PID_FILE, "r");
+ pidfile = open("/var/run/abrt.pid", "r")
+ except Exception, ex:
+ # log the exception?
+ return False
+
+ pid = pidfile.readline()
+ pidfile.close()
+ if not pid:
+ return False
+
+ try:
+ # pid[:-1] strips the trailing '\n'
+ cmdline = open("/proc/%s/cmdline" % pid[:-1], "r").readline()
+ except Exception, ex:
+ # can't read cmdline
+ return False
+ if not ("abrtd" in cmdline):
+ return False
+
+ return True
-if conf.has_key("enabled"):
+if abrt_daemon_ok():
# Prevent abrt exception handler from running when the abrtd daemon is
# not active.
- # abrtd sets the value to "no" when deactivated and vice versa.
- if conf["enabled"] == "yes":
- try:
- from abrt_exception_handler import *
+ try:
+ from abrt_exception_handler import installExceptionHandler
- installExceptionHandler(debug = 1)
- except Exception, e:
- # FIXME don't print anything, write it to some log file
- print e
- pass
+ installExceptionHandler(debug = 1)
+ except Exception, e:
+ # FIXME: log errors?
+ pass
+else:
+ #FIXME: log something?
+ pass