Blame SOURCES/network_issues_handling_1236657.patch

fd2bce
From 3f2ae1112b66ec1ec205d355ba2253d8fa30885d Mon Sep 17 00:00:00 2001
fd2bce
From: Vratislav Podzimek <vpodzime@redhat.com>
fd2bce
Date: Mon, 6 Jul 2015 13:36:55 +0200
fd2bce
Subject: [PATCH 6/9] React better on network issues (#1236657)
fd2bce
fd2bce
Instead of raising an exception we should let users know that there was a
fd2bce
network error.
fd2bce
fd2bce
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
fd2bce
---
fd2bce
 org_fedora_oscap/gui/spokes/oscap.py | 16 +++++++++++++++-
fd2bce
 1 file changed, 15 insertions(+), 1 deletion(-)
fd2bce
fd2bce
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
fd2bce
index 6656108..5e5a43e 100644
fd2bce
--- a/org_fedora_oscap/gui/spokes/oscap.py
fd2bce
+++ b/org_fedora_oscap/gui/spokes/oscap.py
fd2bce
@@ -277,10 +277,16 @@ class OSCAPSpoke(NormalSpoke):
fd2bce
         if any(self._addon_data.content_url.startswith(net_prefix)
fd2bce
                for net_prefix in data_fetch.NET_URL_PREFIXES):
fd2bce
             # need to fetch data over network
fd2bce
-            thread_name = common.wait_and_fetch_net_data(
fd2bce
+            try:
fd2bce
+                thread_name = common.wait_and_fetch_net_data(
fd2bce
                                      self._addon_data.content_url,
fd2bce
                                      self._addon_data.raw_preinst_content_path,
fd2bce
                                      self._addon_data.certificates)
fd2bce
+            except common.OSCAPaddonNetworkError:
fd2bce
+                self._network_problem()
fd2bce
+                with self._fetch_flag_lock:
fd2bce
+                    self._fetching = False
fd2bce
+                return
fd2bce
 
fd2bce
         # pylint: disable-msg=E1101
fd2bce
         hubQ.send_message(self.__class__.__name__,
fd2bce
@@ -623,6 +629,14 @@ class OSCAPSpoke(NormalSpoke):
fd2bce
         self._wrong_content()
fd2bce
 
fd2bce
     @gtk_action_wait
fd2bce
+    def _network_problem(self):
fd2bce
+        """Adapts the UI if network error was encountered during data fetch"""
fd2bce
+
fd2bce
+        self._progress_label.set_markup("%s" % _("Network error encountered when fetching data."
fd2bce
+                                                        " Please check that network is setup and working."))
fd2bce
+        self._wrong_content()
fd2bce
+
fd2bce
+    @gtk_action_wait
fd2bce
     def _extraction_failed(self, err_msg):
fd2bce
         """Adapts the UI if extracting data from entered URL failed"""
fd2bce
 
fd2bce
-- 
fd2bce
2.4.3
fd2bce