replace xmlrpc_client exception with requests

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

Fixes: https://pagure.io/koji/issue/1914
This commit is contained in:
Tomas Kopecek 2020-01-06 14:37:00 +01:00
parent c30c4a48fd
commit 638f6cc6f2
5 changed files with 14 additions and 11 deletions

View file

@ -19,9 +19,10 @@ import sys
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
@ -349,7 +350,7 @@ def warn(msg):
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)))

View file

@ -35,9 +35,10 @@ import sys
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 warn(msg):
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 "