mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
python: Fix xmlrpclib imports.
Fix imports of xmlrpclib to be compatible with Python 3. Python 2 had xmlrpclib (client) and SimpleXMLRPCServer (server). In Python 3, these have been renamed to xmlrpc.client and xmlrpc.server. The solution implemented here is to use the six library. It may seem excessive for this particular issue, but the six library provides helpers for Python 2 and 3 compatibility for many different issues. This is just the first of many uses of the six library. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -20,8 +20,8 @@ from __future__ import print_function
|
||||
|
||||
import exceptions
|
||||
import sys
|
||||
import xmlrpclib
|
||||
|
||||
import six.moves.xmlrpc_client
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.error import CannotListenError
|
||||
from twisted.web import xmlrpc
|
||||
@@ -108,7 +108,8 @@ class TestArena(xmlrpc.XMLRPC):
|
||||
Returns the ovs-test server IP address that the other ovs-test server
|
||||
with the given ip will see.
|
||||
"""
|
||||
server1 = xmlrpclib.Server("http://%s:%u/" % (his_ip, his_port))
|
||||
server1 = six.moves.xmlrpc_client.Server("http://%s:%u/" %
|
||||
(his_ip, his_port))
|
||||
return server1.get_my_address()
|
||||
|
||||
def xmlrpc_create_udp_listener(self, port):
|
||||
|
@@ -25,7 +25,8 @@ import struct
|
||||
import signal
|
||||
import subprocess
|
||||
import re
|
||||
import xmlrpclib
|
||||
|
||||
import six.moves.xmlrpc_client
|
||||
|
||||
|
||||
def str_ip(ip_address):
|
||||
@@ -167,7 +168,8 @@ def get_interface_from_routing_decision(ip):
|
||||
|
||||
|
||||
def rpc_client(ip, port):
|
||||
return xmlrpclib.Server("http://%s:%u/" % (ip, port), allow_none=True)
|
||||
return six.moves.xmlrpc_client.Server("http://%s:%u/" % (ip, port),
|
||||
allow_none=True)
|
||||
|
||||
|
||||
def sigint_intercept():
|
||||
|
Reference in New Issue
Block a user