|
|
2c83a8 |
From eeae29b92017d42b7be967b0a67a4db24bafa80e Mon Sep 17 00:00:00 2001
|
|
|
2c83a8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
2c83a8 |
Date: Mon, 19 Oct 2015 14:24:52 +0200
|
|
|
2c83a8 |
Subject: [PATCH] plugins: port reporters to add_reported_to_entry
|
|
|
2c83a8 |
|
|
|
2c83a8 |
This commit should make the code less fragile. There is no need for this
|
|
|
2c83a8 |
commit, however I plan to make the '.label' member configurable through
|
|
|
2c83a8 |
environment variables.
|
|
|
2c83a8 |
|
|
|
2c83a8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
2c83a8 |
|
|
|
2c83a8 |
Conflicts:
|
|
|
2c83a8 |
src/plugins/reporter-mantisbt.c
|
|
|
2c83a8 |
---
|
|
|
2c83a8 |
src/lib/ureport.c | 21 ++++++++++++---------
|
|
|
2c83a8 |
src/plugins/reporter-bugzilla.c | 7 ++++---
|
|
|
2c83a8 |
src/plugins/reporter-kerneloops.c | 6 +++---
|
|
|
2c83a8 |
src/plugins/reporter-mailx.c | 7 ++++---
|
|
|
2c83a8 |
src/plugins/reporter-print.c | 7 ++++---
|
|
|
2c83a8 |
src/plugins/reporter-rhtsupport.c | 12 +++++-------
|
|
|
2c83a8 |
6 files changed, 32 insertions(+), 28 deletions(-)
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/lib/ureport.c b/src/lib/ureport.c
|
|
|
2c83a8 |
index ebeaa8b..f89fe62 100644
|
|
|
2c83a8 |
--- a/src/lib/ureport.c
|
|
|
2c83a8 |
+++ b/src/lib/ureport.c
|
|
|
2c83a8 |
@@ -644,15 +644,18 @@ ureport_server_response_save_in_dump_dir(struct ureport_server_response *resp,
|
|
|
2c83a8 |
|
|
|
2c83a8 |
if (resp->urr_bthash)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("uReport: BTHASH=%s", resp->urr_bthash);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
-
|
|
|
2c83a8 |
- char *report_url = ureport_server_response_get_report_url(resp, config);
|
|
|
2c83a8 |
- msg = xasprintf("ABRT Server: URL=%s", report_url);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
- free(report_url);
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"uReport" };
|
|
|
2c83a8 |
+ rr.bthash = resp->urr_bthash;
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"ABRT Server" };
|
|
|
2c83a8 |
+ rr.url = ureport_server_response_get_report_url(resp, config);
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
+ free(rr.url);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
if (resp->urr_reported_to_list)
|
|
|
2c83a8 |
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
|
|
|
2c83a8 |
index 097924e..d11fadf 100644
|
|
|
2c83a8 |
--- a/src/plugins/reporter-bugzilla.c
|
|
|
2c83a8 |
+++ b/src/plugins/reporter-bugzilla.c
|
|
|
2c83a8 |
@@ -1351,9 +1351,10 @@ int main(int argc, char **argv)
|
|
|
2c83a8 |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
2c83a8 |
if (dd)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("Bugzilla: URL=%s/show_bug.cgi?id=%u", rhbz.b_bugzilla_url, bz->bi_id);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"Bugzilla" };
|
|
|
2c83a8 |
+ rr.url = xasprintf("%s/show_bug.cgi?id=%u", rhbz.b_bugzilla_url, bz->bi_id);
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
+ free(rr.url);
|
|
|
2c83a8 |
dd_close(dd);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/plugins/reporter-kerneloops.c b/src/plugins/reporter-kerneloops.c
|
|
|
2c83a8 |
index d312459..895f755 100644
|
|
|
2c83a8 |
--- a/src/plugins/reporter-kerneloops.c
|
|
|
2c83a8 |
+++ b/src/plugins/reporter-kerneloops.c
|
|
|
2c83a8 |
@@ -118,9 +118,9 @@ static void report_to_kerneloops(
|
|
|
2c83a8 |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
2c83a8 |
if (dd)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("kerneloops: URL=%s", submitURL);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"kerneloops" };
|
|
|
2c83a8 |
+ rr.url = (char *)submitURL;
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
dd_close(dd);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
|
|
|
2c83a8 |
index 92e78a4..54dc82e 100644
|
|
|
2c83a8 |
--- a/src/plugins/reporter-mailx.c
|
|
|
2c83a8 |
+++ b/src/plugins/reporter-mailx.c
|
|
|
2c83a8 |
@@ -149,9 +149,10 @@ static void create_and_send_email(
|
|
|
2c83a8 |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
2c83a8 |
if (dd)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("email: URL=mailto:%s", email_to);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"email" };
|
|
|
2c83a8 |
+ rr.url = xasprintf("mailto:%s", email_to);
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
+ free(rr.url);
|
|
|
2c83a8 |
dd_close(dd);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
diff --git a/src/plugins/reporter-print.c b/src/plugins/reporter-print.c
|
|
|
2c83a8 |
index 0c67a3c..90ed4c3 100644
|
|
|
2c83a8 |
--- a/src/plugins/reporter-print.c
|
|
|
2c83a8 |
+++ b/src/plugins/reporter-print.c
|
|
|
2c83a8 |
@@ -134,9 +134,10 @@ int main(int argc, char **argv)
|
|
|
2c83a8 |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
2c83a8 |
if (dd)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("file: URL=file://%s", output_file);
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
+ report_result_t rr = { .label = (char *)"file" };
|
|
|
2c83a8 |
+ rr.url = xasprintf("file://%s", output_file);
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
+ free(rr.url);
|
|
|
2c83a8 |
dd_close(dd);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
|
|
|
2c83a8 |
index add0d6b..90988fc 100644
|
|
|
2c83a8 |
--- a/src/plugins/reporter-rhtsupport.c
|
|
|
2c83a8 |
+++ b/src/plugins/reporter-rhtsupport.c
|
|
|
2c83a8 |
@@ -734,13 +734,11 @@ int main(int argc, char **argv)
|
|
|
2c83a8 |
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
|
|
|
2c83a8 |
if (dd)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
- char *msg = xasprintf("RHTSupport: TIME=%s URL=%s%s%s",
|
|
|
2c83a8 |
- iso_date_string(NULL),
|
|
|
2c83a8 |
- result->url,
|
|
|
2c83a8 |
- result->msg ? " MSG=" : "", result->msg ? result->msg : ""
|
|
|
2c83a8 |
- );
|
|
|
2c83a8 |
- add_reported_to(dd, msg);
|
|
|
2c83a8 |
- free(msg);
|
|
|
2c83a8 |
+ struct report_result rr = { .label = (char *)"RHTSupport" };
|
|
|
2c83a8 |
+ rr.url = result->url;
|
|
|
2c83a8 |
+ rr.msg = result->msg;
|
|
|
2c83a8 |
+ time(&rr.timestamp);
|
|
|
2c83a8 |
+ add_reported_to_entry(dd, &rr);
|
|
|
2c83a8 |
dd_close(dd);
|
|
|
2c83a8 |
if (result->msg)
|
|
|
2c83a8 |
log("%s", result->msg);
|
|
|
2c83a8 |
--
|
|
|
2c83a8 |
1.8.3.1
|
|
|
2c83a8 |
|