From 91e85cf829250429a2437076e9e165b4a953e5ac Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 15 Jun 2010 13:15:46 +0200 Subject: RHTSupport: actually use settings; report curl errors better Signed-off-by: Denys Vlasenko --- lib/Plugins/Bugzilla.conf | 1 + lib/Plugins/FileTransfer.conf | 3 +-- lib/Plugins/Makefile.am | 4 +++- lib/Plugins/RHTSupport.conf | 1 + lib/Plugins/RHTSupport.cpp | 18 ++++++++++++++---- lib/Plugins/TicketUploader.conf | 3 ++- lib/Utils/abrt_rh_support.cpp | 22 +++++++++++++++------- 7 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 lib/Plugins/RHTSupport.conf (limited to 'lib') diff --git a/lib/Plugins/Bugzilla.conf b/lib/Plugins/Bugzilla.conf index ff2f8286..bd83a08e 100644 --- a/lib/Plugins/Bugzilla.conf +++ b/lib/Plugins/Bugzilla.conf @@ -1,4 +1,5 @@ Enabled = yes + # Bugzilla URL BugzillaURL = https://bugzilla.redhat.com/ # yes means that ssl certificates will not be checked diff --git a/lib/Plugins/FileTransfer.conf b/lib/Plugins/FileTransfer.conf index 30769b18..111c1c4b 100644 --- a/lib/Plugins/FileTransfer.conf +++ b/lib/Plugins/FileTransfer.conf @@ -1,6 +1,5 @@ -Enabled = yes - # Configuration of the FileTransfer reporter plugin. +Enabled = yes # The plugin is invoked in the abrt.conf file, usually in the # ActionsAndReporters option and/or the [cron] section. diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am index d1d50218..bb370b71 100644 --- a/lib/Plugins/Makefile.am +++ b/lib/Plugins/Makefile.am @@ -35,6 +35,7 @@ dist_pluginsconf_DATA = \ Logger.conf \ Kerneloops.conf \ Bugzilla.conf \ + RHTSupport.conf \ Catcut.conf \ TicketUploader.conf \ FileTransfer.conf \ @@ -46,7 +47,8 @@ man_MANS = \ abrt-Bugzilla.7 \ abrt-KerneloopsScanner.7 \ abrt-KerneloopsReporter.7 \ - abrt-Logger.7 abrt-Mailx.7 \ + abrt-Logger.7 \ + abrt-Mailx.7 \ abrt-plugins.7 \ abrt-SQLite3.7 \ abrt-RunApp.7 \ diff --git a/lib/Plugins/RHTSupport.conf b/lib/Plugins/RHTSupport.conf new file mode 100644 index 00000000..3201c6da --- /dev/null +++ b/lib/Plugins/RHTSupport.conf @@ -0,0 +1 @@ +Enabled = yes diff --git a/lib/Plugins/RHTSupport.cpp b/lib/Plugins/RHTSupport.cpp index 01f46f13..c9467a43 100644 --- a/lib/Plugins/RHTSupport.cpp +++ b/lib/Plugins/RHTSupport.cpp @@ -104,6 +104,15 @@ string CReporterRHticket::Report(const map_crash_data_t& pCrashData, { string retval; + map_plugin_settings_t::const_iterator end = pSettings.end(); + map_plugin_settings_t::const_iterator it; + it = pSettings.find("URL"); + string URL = (it == end ? m_sStrataURL : it->second); + it = pSettings.find("Login"); + string login = (it == end ? m_sLogin : it->second); + it = pSettings.find("Password"); + string password = (it == end ? m_sPassword : it->second); + const string& package = get_crash_data_item_content(pCrashData, FILENAME_PACKAGE); // const string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT); // const string& release = get_crash_data_item_content(pCrashData, FILENAME_RELEASE); @@ -220,9 +229,9 @@ string CReporterRHticket::Report(const map_crash_data_t& pCrashData, { update_client(_("Creating a new case...")); - char* result = send_report_to_new_case(m_sStrataURL.c_str(), - m_sLogin.c_str(), - m_sPassword.c_str(), + char* result = send_report_to_new_case(URL.c_str(), + login.c_str(), + password.c_str(), summary.c_str(), description.c_str(), package.c_str(), @@ -234,7 +243,8 @@ string CReporterRHticket::Report(const map_crash_data_t& pCrashData, } ret: - kill(child, SIGKILL); /* just in case */ + // Damn, selinux does not allow SIGKILLing our own child! wtf?? + //kill(child, SIGKILL); /* just in case */ waitpid(child, NULL, 0); if (tar) tar_close(tar); diff --git a/lib/Plugins/TicketUploader.conf b/lib/Plugins/TicketUploader.conf index 97f455c5..57692531 100644 --- a/lib/Plugins/TicketUploader.conf +++ b/lib/Plugins/TicketUploader.conf @@ -1,3 +1,5 @@ +Enabled = yes + # Customer = "Example Inc." # Ticket = IT12345 # Encrypt = yes @@ -17,4 +19,3 @@ # How long we wait between we retry the upload (in seconds) # RetryDelay = 20 -Enabled = yes diff --git a/lib/Utils/abrt_rh_support.cpp b/lib/Utils/abrt_rh_support.cpp index 76a36119..5ff75652 100644 --- a/lib/Utils/abrt_rh_support.cpp +++ b/lib/Utils/abrt_rh_support.cpp @@ -399,14 +399,20 @@ send_report_to_new_case(const char* baseURL, /* fall through */ default: - errmsg = find_header_in_abrt_post_state(case_state, "Strata-Message:"); - if (!errmsg && case_state->body && case_state->body[0]) - errmsg = case_state->body; + errmsg = case_state->curl_error_msg; if (errmsg) - retval = xasprintf("error in case creation, server says: '%s'", errmsg); + retval = xasprintf("error in case creation: %s", errmsg); else - retval = xasprintf("error in case creation, HTTP code: %d", - case_state->http_resp_code); + { + errmsg = find_header_in_abrt_post_state(case_state, "Strata-Message:"); + if ((!errmsg || !errmsg[0]) && case_state->body && case_state->body[0]) + errmsg = case_state->body; + if (errmsg) + retval = xasprintf("error in case creation, server says: '%s'", errmsg); + else + retval = xasprintf("error in case creation, HTTP code: %d", + case_state->http_resp_code); + } break; case 200: @@ -443,7 +449,9 @@ send_report_to_new_case(const char* baseURL, default: /* Case Creation Succeeded, attachement FAILED */ errmsg = find_header_in_abrt_post_state(atch_state, "Strata-Message:"); - if (!errmsg && atch_state->body && atch_state->body[0]) + if (!errmsg || !errmsg[0]) + errmsg = atch_state->curl_error_msg; + if ((!errmsg || !errmsg[0]) && atch_state->body && atch_state->body[0]) errmsg = atch_state->body; if (case_state->body && case_state->body[0]) { -- cgit