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

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