Blame SOURCES/BZ-1199976-kbase-articles.patch

5e9bef
diff --git a/output.py b/output.py
5e9bef
index 091b58e..b14f129 100755
5e9bef
--- a/output.py
5e9bef
+++ b/output.py
5e9bef
@@ -447,6 +447,8 @@ class YumOutput:
5e9bef
         self.term = YumTerm()
5e9bef
         self._last_interrupt = None
5e9bef
 
5e9bef
+        self.reported_error_msgs = {k: False for (k, v) in ERRORS_TO_KBASE_ARTICLES.iteritems()}
5e9bef
+
5e9bef
     
5e9bef
     def printtime(self):
5e9bef
         """Return a string representing the current time in the form::
5e9bef
@@ -471,8 +473,22 @@ class YumOutput:
5e9bef
         """
5e9bef
         self.logger.error('%s: %s', errobj.url, errobj.exception)
5e9bef
         self.logger.error(_('Trying other mirror.'))
5e9bef
+        self.suggestKBaseArticle(errobj)
5e9bef
         raise errobj.exception
5e9bef
     
5e9bef
+    def suggestKBaseArticle(self, errobj):
5e9bef
+        errcode = None
5e9bef
+        if hasattr(errobj.exception, 'code') and errobj.exception.code in ERRORS_TO_KBASE_ARTICLES:
5e9bef
+            errcode = errobj.exception.code
5e9bef
+        elif hasattr(errobj.exception, 'errno') and errobj.exception.errno in ERRORS_TO_KBASE_ARTICLES:
5e9bef
+            errcode = errobj.exception.errno
5e9bef
+        if not errcode:
5e9bef
+            return
5e9bef
+
5e9bef
+        if not self.reported_error_msgs[errcode]:
5e9bef
+            self.logger.error(ERRORS_TO_KBASE_ARTICLES[errcode])
5e9bef
+            self.reported_error_msgs[errcode] = True
5e9bef
+    
5e9bef
         
5e9bef
     def simpleProgressBar(self, current, total, name=None):
5e9bef
         """Output the current status to the terminal using a simple
5e9bef
diff --git a/yum/constants.py b/yum/constants.py
5e9bef
index 5c728d4..02b2527 100644
5e9bef
--- a/yum/constants.py
5e9bef
+++ b/yum/constants.py
5e9bef
@@ -120,3 +120,25 @@ REPO_PROBLEM_METADATA=2
5e9bef
 REPO_PROBLEM_COMPS=3
5e9bef
 REPO_PROBLEM_OTHER=4
5e9bef
 REPO_PROBLEM_PACKAGE=5
5e9bef
+
5e9bef
+
5e9bef
+ERRORS_TO_KBASE_ARTICLES = {
5e9bef
+    404: """To address this issue please refer to the below knowledge base article 
5e9bef
+
5e9bef
+https://access.redhat.com/articles/1320623
5e9bef
+
5e9bef
+If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
5e9bef
+""",
5e9bef
+    403: """To address this issue please refer to the below knowledge base article
5e9bef
+
5e9bef
+https://access.redhat.com/solutions/69319
5e9bef
+
5e9bef
+If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
5e9bef
+""",
5e9bef
+    60: """It was impossible to connect to the Red Hat servers.
5e9bef
+This could mean a connectivity issue in your environment, such as the requirement to configure a proxy,
5e9bef
+or a transparent proxy that tampers with TLS security, or an incorrect system clock.
5e9bef
+Please collect information about the specific failure that occurs in your environment,
5e9bef
+using the instructions in: https://access.redhat.com/solutions/1527033 and open a ticket with Red Hat Support.
5e9bef
+"""
5e9bef
+}
5e9bef
\ No newline at end of file