diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-11-11 14:17:40 +0100 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-11-11 14:17:40 +0100 |
| commit | ec3f211576c1713fdde47ce825decdb1fa0add9a (patch) | |
| tree | c77eb923b048abd26a1f2112c72726e7d44ff734 /src | |
| parent | 3e50bc1750fa3ccd98a7bc79c3904ae937eb157d (diff) | |
| download | abrt-ec3f211576c1713fdde47ce825decdb1fa0add9a.tar.gz abrt-ec3f211576c1713fdde47ce825decdb1fa0add9a.tar.xz abrt-ec3f211576c1713fdde47ce825decdb1fa0add9a.zip | |
Remove "old-style" KerneloopsReporter
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/KerneloopsReporter.cpp | 143 | ||||
| -rw-r--r-- | src/plugins/KerneloopsReporter.h | 47 | ||||
| -rw-r--r-- | src/plugins/Makefile.am | 6 |
3 files changed, 0 insertions, 196 deletions
diff --git a/src/plugins/KerneloopsReporter.cpp b/src/plugins/KerneloopsReporter.cpp deleted file mode 100644 index ae459737..00000000 --- a/src/plugins/KerneloopsReporter.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - Authors: - Anton Arapov <anton@redhat.com> - Arjan van de Ven <arjan@linux.intel.com> - */ - -#include "abrtlib.h" -#include "comm_layer_inner.h" -#include "abrt_exception.h" -#include "KerneloopsReporter.h" - -using namespace std; - -CKerneloopsReporter::CKerneloopsReporter() -{ - m_pSettings["SubmitURL"] = "http://submit.kerneloops.org/submitoops.php"; -} - -CKerneloopsReporter::~CKerneloopsReporter() -{ -} - -void CKerneloopsReporter::SetSettings(const map_plugin_settings_t& pSettings) -{ - /* Can't simply do this: - - m_pSettings = pSettings; - - * - it will erase keys which aren't present in pSettings. - * Example: if Bugzilla.conf doesn't have "Login = foo", - * then there's no pSettings["Login"] and m_pSettings = pSettings - * will nuke default m_pSettings["Login"] = "", - * making GUI think that we have no "Login" key at all - * and thus never overriding it - even if it *has* an override! - */ - - map_plugin_settings_t::iterator it = m_pSettings.begin(); - while (it != m_pSettings.end()) - { - map_plugin_settings_t::const_iterator override = pSettings.find(it->first); - if (override != pSettings.end()) - { - VERB3 log(" kerneloops settings[%s]='%s'", it->first.c_str(), it->second.c_str()); - it->second = override->second; - } - it++; - } -} - -string CKerneloopsReporter::Report(const map_crash_data_t& crash_data, - const map_plugin_settings_t& settings, - const char *args) -{ - /* abrt-action-kerneloops [-s] -c /etc/arbt/Kerneloops.conf -c - -d pCrashData.dir NULL */ - char *argv[9]; - char **pp = argv; - *pp++ = (char*)"abrt-action-kerneloops"; - -//We want to consume output, so don't redirect to syslog. -// if (logmode & LOGMODE_SYSLOG) -// *pp++ = (char*)"-s"; -//TODO: the actions<->daemon interaction will be changed anyway... - - *pp++ = (char*)"-c"; - *pp++ = (char*)(PLUGINS_CONF_DIR"/Kerneloops."PLUGINS_CONF_EXTENSION); - *pp++ = (char*)"-c"; - *pp++ = (char*)"-"; - *pp++ = (char*)"-d"; - *pp++ = (char*)get_crash_data_item_content_or_NULL(crash_data, CD_DUMPDIR); - *pp = NULL; - int pipefds[2]; - pid_t pid = fork_execv_on_steroids(EXECFLG_INPUT + EXECFLG_OUTPUT + EXECFLG_ERR2OUT, - argv, - pipefds, - /* unsetenv_vec: */ NULL, - /* dir: */ NULL, - /* uid(unused): */ 0 - ); - - /* Write the configuration to stdin */ - map_plugin_settings_t::const_iterator it = settings.begin(); - while (it != settings.end()) - { - full_write_str(pipefds[1], it->first.c_str()); - full_write_str(pipefds[1], "="); - full_write_str(pipefds[1], it->second.c_str()); - full_write_str(pipefds[1], "\n"); - it++; - } - close(pipefds[1]); - - FILE *fp = fdopen(pipefds[0], "r"); - if (!fp) - die_out_of_memory(); - - /* Consume log from stdout */ - string bug_status; - char *buf; - while ((buf = xmalloc_fgetline(fp)) != NULL) - { - if (strncmp(buf, "STATUS:", 7) == 0) - bug_status = buf + 7; - else - if (strncmp(buf, "EXCEPT:", 7) == 0) - { - CABRTException e(EXCEP_PLUGIN, "%s", buf + 7); - free(buf); - fclose(fp); - waitpid(pid, NULL, 0); - throw e; - } - update_client("%s", buf); - free(buf); - } - - fclose(fp); /* this also closes pipefds[0] */ - /* wait for child to actually exit, and prevent leaving a zombie behind */ - waitpid(pid, NULL, 0); - - return bug_status; -} - -PLUGIN_INFO(REPORTER, - CKerneloopsReporter, - "KerneloopsReporter", - "0.0.1", - _("Sends kernel oops information to kerneloops.org"), - "anton@redhat.com", - "http://people.redhat.com/aarapov", - PLUGINS_LIB_DIR"/KerneloopsReporter.glade"); diff --git a/src/plugins/KerneloopsReporter.h b/src/plugins/KerneloopsReporter.h deleted file mode 100644 index e0f4a1bb..00000000 --- a/src/plugins/KerneloopsReporter.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2007, Intel Corporation - * Copyright 2009, Red Hat Inc. - * - * This file is part of Abrt. - * - * This program file is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program in a file named COPYING; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * Authors: - * Anton Arapov <anton@redhat.com> - * Arjan van de Ven <arjan@linux.intel.com> - */ - -#ifndef __INCLUDE_GUARD_KERNELOOPSREPORTER_H_ -#define __INCLUDE_GUARD_KERNELOOPSREPORTER_H_ - -#include "plugin.h" -#include "reporter.h" - -#include <string> - -class CKerneloopsReporter : public CReporter -{ - public: - CKerneloopsReporter(); - ~CKerneloopsReporter(); - - virtual void SetSettings(const map_plugin_settings_t& pSettings); - virtual std::string Report(const map_crash_data_t& pCrashData, - const map_plugin_settings_t& pSettings, - const char *pArgs); -}; - -#endif diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 269f667f..9eef1149 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -11,7 +11,6 @@ pluginslib_LTLIBRARIES = \ libSQLite3.la \ libKerneloopsScanner.la\ libKerneloops.la \ - libKerneloopsReporter.la \ libSOSreport.la \ libReportUploader.la \ libPython.la \ @@ -75,11 +74,6 @@ libKerneloops_la_SOURCES = Kerneloops.cpp Kerneloops.h libKerneloops_la_LDFLAGS = -avoid-version libKerneloops_la_CPPFLAGS = -I$(INC_PATH) -I$(UTILS_PATH) -# KerneloopsReporter -libKerneloopsReporter_la_SOURCES = KerneloopsReporter.cpp KerneloopsReporter.h -libKerneloopsReporter_la_LDFLAGS = -avoid-version -libKerneloopsReporter_la_CPPFLAGS = -I$(INC_PATH) -I$(UTILS_PATH) -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" - # KerneloopsScanner libKerneloopsScanner_la_SOURCES = KerneloopsScanner.cpp KerneloopsScanner.h KerneloopsSysLog.cpp KerneloopsSysLog.h libKerneloopsScanner_la_LDFLAGS = -avoid-version $(GLIB_LIBS) |
