diff options
| author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-02 11:39:54 +0200 |
|---|---|---|
| committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-02 11:39:54 +0200 |
| commit | f2658049fa50cb8b9898691263d7147217e78218 (patch) | |
| tree | 222412d78d7d4d8e52f5ef3a1d6e93c0479c8097 /src/Daemon | |
| parent | 72a763a187a27c3838e87d7a79aeded7a8933ca9 (diff) | |
| download | abrt-f2658049fa50cb8b9898691263d7147217e78218.tar.gz abrt-f2658049fa50cb8b9898691263d7147217e78218.tar.xz abrt-f2658049fa50cb8b9898691263d7147217e78218.zip | |
added new interface frof settings
Diffstat (limited to 'src/Daemon')
| -rw-r--r-- | src/Daemon/CrashWatcher.cpp | 66 | ||||
| -rw-r--r-- | src/Daemon/CrashWatcher.h | 10 | ||||
| -rw-r--r-- | src/Daemon/Daemon.cpp | 36 | ||||
| -rw-r--r-- | src/Daemon/Makefile.am | 5 | ||||
| -rw-r--r-- | src/Daemon/abrt.conf | 8 |
5 files changed, 95 insertions, 30 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 3426e92..783a694 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -31,7 +31,7 @@ #include <dirent.h> #include <cstring> -/* just a helper function +/* just a helper function template< class T > std::string to_string( T x ) @@ -119,12 +119,60 @@ CCrashWatcher::CCrashWatcher(const std::string& pPath,DBus::Connection &connecti m_pGio = g_io_channel_unix_new(m_nFd); } */ + +void CCrashWatcher::SetUpMW() +{ + m_pMW->SetOpenGPGCheck(m_pSettings->GetOpenGPGCheck()); + m_pMW->SetDatabase(m_pSettings->GetDatabase()); + CSettings::set_strings_t openGPGPublicKeys = m_pSettings->GetOpenGPGPublicKeys(); + CSettings::set_strings_t::iterator it_k; + for (it_k = openGPGPublicKeys.begin(); it_k != openGPGPublicKeys.end(); it_k++) + { + m_pMW->AddOpenGPGPublicKey(*it_k); + } + CSettings::set_strings_t blackList = m_pSettings->GetBlackList(); + CSettings::set_strings_t::iterator it_b; + for (it_b = blackList.begin(); it_b != blackList.end(); it_b++) + { + m_pMW->AddBlackListedPackage(*it_b); + } + CSettings::set_strings_t enabledPlugins = m_pSettings->GetEnabledPlugins(); + CSettings::set_strings_t::iterator it_p; + for (it_p = enabledPlugins.begin(); it_p != enabledPlugins.end(); it_p++) + { + m_pMW->RegisterPlugin(*it_p); + } + CSettings::map_reporters_t reporters = m_pSettings->GetReporters(); + CSettings::map_reporters_t::iterator it_pr; + for (it_pr = reporters.begin(); it_pr != reporters.end(); it_pr++) + { + CSettings::set_strings_t::iterator it_r; + for (it_r = it_pr->second.begin(); it_r != it_pr->second.end(); it_r++) + { + m_pMW->AddAnalyzerReporter(it_pr->first, *it_r); + } + } + CSettings::map_actions_t actions = m_pSettings->GetActions(); + CSettings::map_actions_t::iterator it_pa; + for (it_pa = actions.begin(); it_pa != actions.end(); it_pa++) + { + CSettings::map_single_actions_t::iterator it_sa; + for (it_sa = it_pa->second.begin(); it_sa != it_pa->second.end(); it_sa++) + { + m_pMW->AddAnalyzerAction(it_pa->first, it_sa->first, it_sa->second); + } + } +} + CCrashWatcher::CCrashWatcher(const std::string& pPath) { int watch = 0; m_sTarget = pPath; // middleware object - m_pMW = new CMiddleWare(PLUGINS_CONF_DIR,PLUGINS_LIB_DIR, std::string(CONF_DIR) + "/abrt.conf"); + m_pSettings = new CSettings(); + m_pSettings->LoadSettings(std::string(CONF_DIR) + "/abrt.conf"); + m_pMW = new CMiddleWare(PLUGINS_CONF_DIR,PLUGINS_LIB_DIR); + SetUpMW(); FindNewDumps(pPath); m_pMainloop = g_main_loop_new(NULL,FALSE); #ifdef HAVE_DBUS @@ -149,11 +197,15 @@ CCrashWatcher::CCrashWatcher(const std::string& pPath) CCrashWatcher::~CCrashWatcher() { - //delete dispatcher, connection, etc.. - //m_pConn->disconnect(); - delete m_pMW; - g_io_channel_unref(m_pGio); - g_main_loop_unref(m_pMainloop); + //delete dispatcher, connection, etc.. + //m_pConn->disconnect(); + + g_io_channel_unref(m_pGio); + g_main_loop_unref(m_pMainloop); + + delete m_pCommLayer; + delete m_pMW; + delete m_pSettings; } void CCrashWatcher::FindNewDumps(const std::string& pPath) { diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 667e521..7ab7072 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -27,6 +27,7 @@ //#include "DBusManager.h" //#include "DBusServerProxy.h" #include "MiddleWare.h" +#include "Settings.h" #include "CommLayerServerDBus.h" #ifdef HAVE_DBUS @@ -50,9 +51,10 @@ class CCrashWatcher void StartWatch(); void GStartWatch(); void Lock(); + void SetUpMW(); /* finds dumps created when daemon wasn't running */ void FindNewDumps(const std::string& pPath); - + int m_nFd; GIOChannel* m_pGio; GMainLoop *m_pMainloop; @@ -61,16 +63,16 @@ class CCrashWatcher CCommLayerServer *m_pCommLayer; /*FIXME not needed */ //DBus::Connection *m_pConn; - + CSettings *m_pSettings; public: //CCrashWatcher(const std::string& pPath,DBus::Connection &connection); CCrashWatcher(const std::string& pPath); - ~CCrashWatcher(); + virtual ~CCrashWatcher(); //run as daemon void Daemonize(); //don't go background - for debug void Run(); - + /* methods exported on dbus */ public: dbus_vector_crash_infos_t GetCrashInfos(const std::string &pUID); diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 1eca300..5133902 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -1,22 +1,22 @@ -/* - Copyright (C) 2009 Jiri Moskovcak (jmoskovc@redhat.com) - Copyright (C) 2009 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. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +/* + Copyright (C) 2009 Jiri Moskovcak (jmoskovc@redhat.com) + Copyright (C) 2009 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. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + #include "CrashWatcher.h" #include <iostream> #include <cstdio> diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am index 3eb2292..fd07999 100644 --- a/src/Daemon/Makefile.am +++ b/src/Daemon/Makefile.am @@ -1,6 +1,6 @@ sbin_PROGRAMS = abrt abrt_SOURCES = CrashWatcher.cpp CrashWatcher.h Daemon.cpp DBusServerProxy.h \ - DBusCommon.h + DBusCommon.h Settings.h Settings.cpp abrt_CPPFLAGS = -Wall -Werror -I../../lib/MiddleWare -I../../lib/CommLayer\ -I../../lib/DBus \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(GLIB_CFLAGS) $(DBUSCPP_CFLAGS) \ @@ -11,3 +11,6 @@ abrt_LDADD = ../../lib/MiddleWare/libMiddleWare.la ../../lib/CommLayer/libABRTCo dbusabrtconfdir = ${sysconfdir}/dbus-1/system.d/ dist_dbusabrtconf_DATA = dbus-abrt.conf + +daemonconfdir = $(CONF_DIR) +dist_daemonconf_DATA = abrt.conf diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf index af5b395..90b33e2 100644 --- a/src/Daemon/abrt.conf +++ b/src/Daemon/abrt.conf @@ -1,4 +1,7 @@ # test conf file. it will be generated in the future + +# common abrt settings +[ Common ] # Enable GPG check EnableOpenGPG = no # GPG keys @@ -9,6 +12,11 @@ BlackList = bash, bind, apache2 EnabledPlugins = SQLite3, CCpp, Mailx, Kerneloops, KerneloopsReporter # selected DB plugin Database = SQLite3 + # reporters association +[ Reporters ] CCpp = Mailx Kerneloops = KerneloopsReporter + +# actions association +[ Actions ]
\ No newline at end of file |
