Blame SOURCES/0099-rhtsupport-send-ureport-before-creating-description.patch

0c9110
From 028b35b1fc9b1b373ccecec5aa71606beb825a66 Mon Sep 17 00:00:00 2001
0c9110
From: Jakub Filak <jfilak@redhat.com>
0c9110
Date: Thu, 9 Oct 2014 14:02:11 +0200
0c9110
Subject: [LIBREPORT PATCH 99/99] rhtsupport: send ureport before creating
0c9110
 description
0c9110
0c9110
Because we want to include the URL to uReport stored in 'reported_to'
0c9110
file in the description.
0c9110
0c9110
Related: #1139987
0c9110
0c9110
Signed-off-by: Jakub Filak <jfilak@redhat.com>
0c9110
---
0c9110
 src/plugins/reporter-rhtsupport.c | 45 +++++++++++++++++++--------------------
0c9110
 1 file changed, 22 insertions(+), 23 deletions(-)
0c9110
0c9110
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
0c9110
index 56daf78..e1c73d0 100644
0c9110
--- a/src/plugins/reporter-rhtsupport.c
0c9110
+++ b/src/plugins/reporter-rhtsupport.c
0c9110
@@ -526,6 +526,13 @@ int main(int argc, char **argv)
0c9110
     free_map_string(settings);
0c9110
 
0c9110
     char *base_api_url = xstrdup(url);
0c9110
+    char *bthash = NULL;
0c9110
+
0c9110
+    map_string_t *ursettings = new_map_string();
0c9110
+    struct ureport_server_config urconf;
0c9110
+
0c9110
+    prepare_ureport_configuration(urconf_file, ursettings, &urconf,
0c9110
+            url, login, password, ssl_verify);
0c9110
 
0c9110
     if (opts & OPT_t)
0c9110
     {
0c9110
@@ -592,6 +599,17 @@ int main(int argc, char **argv)
0c9110
                 return 0;
0c9110
         }
0c9110
         free_report_result(reported_to);
0c9110
+
0c9110
+        if (submit_ur)
0c9110
+        {
0c9110
+            log(_("Sending ABRT crash statistics data"));
0c9110
+
0c9110
+            bthash = submit_ureport(dump_dir_name, &urconf);
0c9110
+
0c9110
+            /* Ensure that we will use the updated credentials */
0c9110
+            STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
0c9110
+            STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
0c9110
+        }
0c9110
     }
0c9110
 
0c9110
     /* Gzipping e.g. 0.5gig coredump takes a while. Let user know what we are doing */
0c9110
@@ -647,25 +665,6 @@ int main(int argc, char **argv)
0c9110
 
0c9110
     if (!(opts & OPT_t))
0c9110
     {
0c9110
-        char *bthash = NULL;
0c9110
-
0c9110
-        map_string_t *ursettings = new_map_string();
0c9110
-        struct ureport_server_config urconf;
0c9110
-
0c9110
-        prepare_ureport_configuration(urconf_file, ursettings, &urconf,
0c9110
-                url, login, password, ssl_verify);
0c9110
-
0c9110
-        if (submit_ur)
0c9110
-        {
0c9110
-            log(_("Sending ABRT crash statistics data"));
0c9110
-
0c9110
-            bthash = submit_ureport(dump_dir_name, &urconf);
0c9110
-
0c9110
-            /* Ensure that we will use the updated credentials */
0c9110
-            STRCPY_IF_NOT_EQUAL(login, urconf.ur_username);
0c9110
-            STRCPY_IF_NOT_EQUAL(password, urconf.ur_password);
0c9110
-        }
0c9110
-
0c9110
         if (tempfile_size <= QUERY_HINTS_IF_SMALLER_THAN)
0c9110
         {
0c9110
             /* Check for hints and show them if we have something */
0c9110
@@ -772,10 +771,6 @@ int main(int argc, char **argv)
0c9110
         result->url = NULL;
0c9110
         free_rhts_result(result);
0c9110
         result = NULL;
0c9110
-
0c9110
-        ureport_server_config_destroy(&urconf);
0c9110
-        free_map_string(ursettings);
0c9110
-        free(bthash);
0c9110
     }
0c9110
 
0c9110
     char *remote_filename = NULL;
0c9110
@@ -842,6 +837,10 @@ int main(int argc, char **argv)
0c9110
     free_rhts_result(result_atch);
0c9110
     free_rhts_result(result);
0c9110
 
0c9110
+    ureport_server_config_destroy(&urconf);
0c9110
+    free_map_string(ursettings);
0c9110
+    free(bthash);
0c9110
+
0c9110
     free(base_api_url);
0c9110
     free(url);
0c9110
     free(login);
0c9110
-- 
0c9110
1.8.3.1
0c9110