#1916 replace xmlrpc_client exception with requests
Merged 4 years ago by tkopecek. Opened 4 years ago by tkopecek.
tkopecek/koji issue1914  into  master

file modified
+4 -3
@@ -47,6 +47,7 @@ 

  from optparse import SUPPRESS_HELP, OptionParser

  

  import Cheetah.Template

+ import requests

  import rpm

  import six

  import six.moves.xmlrpc_client
@@ -6328,7 +6329,7 @@ 

                                options.serverca)

          except koji.AuthError as e:

              quit("Error: Unable to log in: %s" % e)

-         except six.moves.xmlrpc_client.ProtocolError:

+         except requests.exceptions.ConnectionError:

              quit("Error: Unable to connect to server %s" % (options.server))

      elif options.user:

          try:
@@ -6336,7 +6337,7 @@ 

              session.login()

          except koji.AuthError:

              quit("Error: Unable to log in. Bad credentials?")

-         except six.moves.xmlrpc_client.ProtocolError:

+         except requests.exceptions.ConnectionError:

              quit("Error: Unable to connect to server %s" % (options.server))

      elif krbV or requests_kerberos:

          krb_principal = options.krb_principal
@@ -6362,7 +6363,7 @@ 

      #make sure it works

      try:

          ret = session.echo("OK")

-     except six.moves.xmlrpc_client.ProtocolError:

+     except requests.exceptions.ConnectionError:

          quit("Error: Unable to connect to server %s" % (options.server))

      if ret != ["OK"]:

          quit("Error: incorrect server response: %r" % (ret))

file modified
+1 -1
@@ -108,7 +108,7 @@ 

  def ensure_connection(session):

      try:

          ret = session.getAPIVersion()

-     except six.moves.xmlrpc_client.ProtocolError:

+     except requests.exceptions.ConnectionError:

          error(_("Error: Unable to connect to server"))

      if ret != koji.API_VERSION:

          warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))

file modified
+3 -2
@@ -19,9 +19,10 @@ 

  import time

  from string import Template

  

+ import requests

  import six

  import six.moves.configparser

- import six.moves.xmlrpc_client  # for ProtocolError and Fault

+ import six.moves.xmlrpc_client  # for Fault

  from six.moves import email_mime_text as MIMEText

  

  import koji
@@ -335,7 +336,7 @@ 

  def ensure_connection(session):

      try:

          ret = session.getAPIVersion()

-     except six.moves.xmlrpc_client.ProtocolError:

+     except requests.exceptions.ConnectionError:

          error(_("Error: Unable to connect to server"))

      if ret != koji.API_VERSION:

          warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))

file modified
+3 -2
@@ -35,9 +35,10 @@ 

  import time

  import urllib2

  

+ import requests

  import rpm

  import six

- import six.moves.xmlrpc_client  # for ProtocolError and Fault

+ import six.moves.xmlrpc_client  # for Fault

  from six.moves import range

  

  import koji
@@ -283,7 +284,7 @@ 

  def ensure_connection(session):

      try:

          ret = session.getAPIVersion()

-     except six.moves.xmlrpc_client.ProtocolError:

+     except requests.exceptions.ConnectionError:

          error(_("Error: Unable to connect to server"))

      if ret != koji.API_VERSION:

          warn(_("WARNING: The server is at API version %d and the client is at "

file modified
+3 -3
@@ -1107,7 +1107,7 @@ 

                                options.serverca)

          except koji.AuthError as e:

              quit("Error: Unable to log in: %s" % e)

-         except six.moves.xmlrpc_client.ProtocolError:

+         except requests.exceptions.ConnectionError:

              quit("Error: Unable to connect to server %s" % (options.server))

      elif options.user:

          try:
@@ -1115,7 +1115,7 @@ 

              session.login()

          except koji.AuthError:

              quit("Error: Unable to log in. Bad credentials?")

-         except six.moves.xmlrpc_client.ProtocolError:

+         except requests.exceptions.ConnectionError:

              quit("Error: Unable to connect to server %s" % (options.server))

      elif krbV:

          krb_principal = options.krb_principal
@@ -1141,7 +1141,7 @@ 

      #make sure it works

      try:

          ret = session.echo("OK")

-     except six.moves.xmlrpc_client.ProtocolError:

+     except requests.exceptions.ConnectionError:

          quit("Error: Unable to connect to server %s" % (options.server))

      if ret != ["OK"]:

          quit("Error: incorrect server response: %r" % (ret))

It is broken in startup function for kojid and kojivmd from the
introduction of requests.

Fixes: https://pagure.io/koji/issue/1914

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

pretty please pagure-ci rebuild

4 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

4 years ago

Commit fbfeff5 fixes this pull-request

Pull-Request has been merged by tkopecek

4 years ago