diff options
| author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-16 17:54:20 +0200 |
|---|---|---|
| committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-16 17:54:20 +0200 |
| commit | b67b664e6f3019a142996c5bdc3a2e8c32f4306a (patch) | |
| tree | 95aaf34561d8abc9cd59da1229b4ff620ac194e0 /src/Daemon | |
| parent | d71fe39576ded4e9567f5f938e9ef67183bb8afd (diff) | |
| download | abrt-b67b664e6f3019a142996c5bdc3a2e8c32f4306a.tar.gz abrt-b67b664e6f3019a142996c5bdc3a2e8c32f4306a.tar.xz abrt-b67b664e6f3019a142996c5bdc3a2e8c32f4306a.zip | |
- reporter plugins can tak an argiment
- added "Reporters" option which allows report basic info after a crash occurs
- fixed interface of plugins
Diffstat (limited to 'src/Daemon')
| -rw-r--r-- | src/Daemon/CrashWatcher.cpp | 12 | ||||
| -rw-r--r-- | src/Daemon/Settings.cpp | 64 | ||||
| -rw-r--r-- | src/Daemon/Settings.h | 14 | ||||
| -rw-r--r-- | src/Daemon/abrt.conf | 18 |
4 files changed, 59 insertions, 49 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 7c043c2..48d18db 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -132,27 +132,27 @@ void CCrashWatcher::SetUpMW() { m_pMW->RegisterPlugin(*it_p); } - CSettings::set_strings_t reporters = m_pSettings->GetReporters(); - CSettings::set_strings_t::iterator it_r; + CSettings::set_pair_strings_t reporters = m_pSettings->GetReporters(); + CSettings::set_pair_strings_t::iterator it_r; for (it_r = reporters.begin(); it_r != reporters.end(); it_r++) { - m_pMW->AddReporter(*it_r); + m_pMW->AddReporter((*it_r).first, (*it_r).second); } CSettings::map_analyzer_reporters_t analyzer_reporters = m_pSettings->GetAnalyzerReporters(); CSettings::map_analyzer_reporters_t::iterator it_pr; for (it_pr = analyzer_reporters.begin(); it_pr != analyzer_reporters.end(); it_pr++) { - CSettings::set_strings_t::iterator it_r; + CSettings::set_pair_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); + m_pMW->AddAnalyzerReporter(it_pr->first, (*it_r).first, (*it_r).second); } } CSettings::map_analyzer_actions_t analyser_actions = m_pSettings->GetAnalyzerActions(); CSettings::map_analyzer_actions_t::iterator it_pa; for (it_pa = analyser_actions.begin(); it_pa != analyser_actions.end(); it_pa++) { - CSettings::set_actions_t::iterator it_a; + CSettings::set_pair_strings_t::iterator it_a; for (it_a = it_pa->second.begin(); it_a != it_pa->second.end(); it_a++) { m_pMW->AddAnalyzerAction(it_pa->first, (*it_a).first, (*it_a).second); diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp index 240a6f6..6555e8d 100644 --- a/src/Daemon/Settings.cpp +++ b/src/Daemon/Settings.cpp @@ -3,8 +3,8 @@ #include <stdlib.h> #define SECTION_COMMON "Common" -#define SECTION_REPORTERS "Reporters" -#define SECTION_ACTIONS "Actions" +#define SECTION_REPORTERS "AnalyzerReporters" +#define SECTION_ACTIONS "AnalyzerActions" void CSettings::LoadSettings(const std::string& pPath) { @@ -30,11 +30,11 @@ void CSettings::LoadSettings(const std::string& pPath) { continue; } - else if (line[ii] == '#') + else if (line[ii] == '#' && !is_quote) { break; } - else if (line[ii] == '[') + else if (line[ii] == '[' && !is_quote) { is_section = true; section = ""; @@ -52,7 +52,7 @@ void CSettings::LoadSettings(const std::string& pPath) } section += line[ii]; } - else if (line[ii] == '=') + else if (line[ii] == '=' && !is_quote) { is_key = false; key = value; @@ -63,7 +63,7 @@ void CSettings::LoadSettings(const std::string& pPath) value += line[ii]; } } - if (!is_key) + if (!is_key && !is_quote) { if (section == SECTION_COMMON) { @@ -100,13 +100,13 @@ void CSettings::ParseCommon() { m_setBlackList = ParseList(m_mapSettingsCommon["BlackList"]); } - if (m_mapSettingsCommon.find("EnabledPlugins") != m_mapSettingsCommon.end()) + if (m_mapSettingsCommon.find("Database") != m_mapSettingsCommon.end()) { - m_setEnabledPlugins = ParseList(m_mapSettingsCommon["EnabledPlugins"]); + m_sDatabase =m_mapSettingsCommon["Database"]; } - if (m_mapSettingsCommon.find("Database") != m_mapSettingsCommon.end()) + if (m_mapSettingsCommon.find("EnabledPlugins") != m_mapSettingsCommon.end()) { - m_sDatabase = m_mapSettingsCommon["Database"]; + m_setEnabledPlugins = ParseList(m_mapSettingsCommon["EnabledPlugins"]); } if (m_mapSettingsCommon.find("MaxCrashReportsSize") != m_mapSettingsCommon.end()) { @@ -114,7 +114,7 @@ void CSettings::ParseCommon() } if (m_mapSettingsCommon.find("Reporters") != m_mapSettingsCommon.end()) { - m_setReporters = ParseList(m_mapSettingsCommon["Reporters"]); + m_setReporters = ParseListWithArgs(m_mapSettingsCommon["Reporters"]); } } @@ -124,7 +124,7 @@ void CSettings::ParseReporters() map_settings_t::iterator it; for (it = m_mapSettingsReporters.begin(); it != m_mapSettingsReporters.end(); it++) { - m_mapAnalyzerReporters[it->first] = ParseList(it->second); + m_mapAnalyzerReporters[it->first] = ParseListWithArgs(it->second); } } @@ -133,8 +133,8 @@ void CSettings::ParseActions() map_settings_t::iterator it; for (it = m_mapSettingsActions.begin(); it != m_mapSettingsActions.end(); it++) { - set_strings_t keys = ParseActionKey(it->first); - set_actions_t singleActions = ParseActionValue(it->second); + set_strings_t keys = ParseKey(it->first); + set_pair_strings_t singleActions = ParseListWithArgs(it->second); set_strings_t::iterator it_keys; for (it_keys = keys.begin(); it_keys != keys.end(); it_keys++) { @@ -144,9 +144,9 @@ void CSettings::ParseActions() } -CSettings::set_actions_t CSettings::ParseActionValue(const std::string& pValue) +CSettings::set_pair_strings_t CSettings::ParseListWithArgs(const std::string& pValue) { - set_actions_t singleActions; + set_pair_strings_t pluginArgs; unsigned int ii; std::string item = ""; std::string action = ""; @@ -167,7 +167,7 @@ CSettings::set_actions_t CSettings::ParseActionValue(const std::string& pValue) } else if (pValue[ii] == ')' && is_arg && !is_quote) { - singleActions.insert(make_pair(action, item)); + pluginArgs.insert(make_pair(action, item)); item = ""; is_arg = false; action = ""; @@ -176,7 +176,7 @@ CSettings::set_actions_t CSettings::ParseActionValue(const std::string& pValue) { if (item != "") { - singleActions.insert(make_pair(item, "")); + pluginArgs.insert(make_pair(item, "")); item = ""; } } @@ -187,12 +187,12 @@ CSettings::set_actions_t CSettings::ParseActionValue(const std::string& pValue) } if (item != "") { - singleActions.insert(make_pair(item, "")); + pluginArgs.insert(make_pair(item, "")); } - return singleActions; + return pluginArgs; } -CSettings::set_strings_t CSettings::ParseActionKey(const std::string& Key) +CSettings::set_strings_t CSettings::ParseKey(const std::string& Key) { unsigned int ii; std::string item = ""; @@ -205,12 +205,12 @@ CSettings::set_strings_t CSettings::ParseActionKey(const std::string& Key) { is_quote = is_quote == true ? false : true; } - else if (Key[ii] == '(' && !is_quote) + else if (Key[ii] == ':' && !is_quote) { key = item; item = ""; } - else if ((Key[ii] == ',' || Key[ii] == ')') && !is_quote) + else if ((Key[ii] == ',') && !is_quote) { set.insert(key + ":" + item); item = ""; @@ -222,7 +222,14 @@ CSettings::set_strings_t CSettings::ParseActionKey(const std::string& Key) } if (item != "" && !is_quote) { - set.insert(item); + if (key == "") + { + set.insert(item); + } + else + { + set.insert(key + ":" + item); + } } return set; } @@ -286,11 +293,12 @@ const unsigned int& CSettings::GetMaxCrashReportsSize() return m_nMaxCrashReportsSize; } -const std::string& CSettings::GetDatabase() +const CSettings::set_pair_strings_t& CSettings::GetReporters() { - return m_sDatabase; + return m_setReporters; } -const CSettings::set_strings_t& CSettings::GetReporters() + +const std::string& CSettings::GetDatabase() { - return m_setReporters; + return m_sDatabase; } diff --git a/src/Daemon/Settings.h b/src/Daemon/Settings.h index 7a8723a..04a16d7 100644 --- a/src/Daemon/Settings.h +++ b/src/Daemon/Settings.h @@ -12,9 +12,9 @@ class CSettings typedef std::map<std::string, std::string> map_settings_t; typedef std::set<std::string> set_strings_t; typedef std::pair<std::string, std::string> pair_string_string_t; - typedef std::map<std::string, set_strings_t> map_analyzer_reporters_t; - typedef std::set<pair_string_string_t> set_actions_t; - typedef std::map<std::string, set_actions_t> map_analyzer_actions_t; + typedef std::set<pair_string_string_t> set_pair_strings_t; + typedef std::map<std::string, set_pair_strings_t> map_analyzer_reporters_t; + typedef std::map<std::string, set_pair_strings_t> map_analyzer_actions_t; private: map_settings_t m_mapSettingsCommon; @@ -24,8 +24,8 @@ class CSettings set_strings_t m_setOpenGPGPublicKeys; set_strings_t m_setBlackList; set_strings_t m_setEnabledPlugins; - set_strings_t m_setReporters; std::string m_sDatabase; + set_pair_strings_t m_setReporters; bool m_bOpenGPGCheck; unsigned int m_nMaxCrashReportsSize; map_analyzer_reporters_t m_mapAnalyzerReporters; @@ -35,8 +35,8 @@ class CSettings void ParseReporters(); void ParseActions(); set_strings_t ParseList(const std::string& pList); - set_strings_t ParseActionKey(const std::string& pKey); - set_actions_t ParseActionValue(const std::string& pValue); + set_pair_strings_t ParseListWithArgs(const std::string& pList); + set_strings_t ParseKey(const std::string& pKey); public: void LoadSettings(const std::string& pPath); @@ -47,8 +47,8 @@ class CSettings const map_analyzer_reporters_t& GetAnalyzerReporters(); const map_analyzer_actions_t& GetAnalyzerActions(); const unsigned int& GetMaxCrashReportsSize(); + const set_pair_strings_t& GetReporters(); const std::string& GetDatabase(); - const set_strings_t& GetReporters(); }; #endif diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf index 51367db..ff0e854 100644 --- a/src/Daemon/abrt.conf +++ b/src/Daemon/abrt.conf @@ -7,20 +7,22 @@ EnableOpenGPG = no # GPG keys OpenGPGPublicKeys = /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora # blacklisted packages -BlackList = bash, bind, apache2 +BlackList = bash, bind # enabled plugins +# there has to be exactly one database plugin EnabledPlugins = SQLite3, CCpp, Mailx, Logger, Kerneloops, KerneloopsReporter -# selected DB plugin +# Database Database = SQLite3 -# max size for coredumps storage +# max size for crash storage MaxCrashReportsSize = 1000 -# set of reporters which are activated in crash time -Reporters = Mailx +# set of reporters which are activated immediately after a crash occurs +Reporters = Mailx("[abrt] new crash was detected") -# reporters association with alanyzers -[ Reporters ] +# reporters association with analyzers +[ AnalyzerReporters ] CCpp = Logger Kerneloops = KerneloopsReporter # actions association -[ Actions ]
\ No newline at end of file +[ AnalyzerActions ] +# CCpp : xorg-x11-apps = RunApp("date", "RunApp")
\ No newline at end of file |
