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

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