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

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