1
0
Fork 0

add IPv6 support to gvaserver (fixes #30)

This commit is contained in:
Jan Dittberner 2009-07-18 20:23:03 +02:00
parent 92c1e21f32
commit 483c1f9038
1 changed files with 15 additions and 3 deletions

View File

@ -21,14 +21,16 @@
#
# Version: $Id$
import sys, os, logging.config
import sys, os, logging.config, socket
from gnuviechadmin.util.passwordutils import md5_crypt_password
from SimpleXMLRPCServer import SimpleXMLRPCServer
logcfgs = ('gnuviechadmin/logging.cfg', '/etc/gnuviechadmin/logging.cfg',
os.path.expanduser('~/.gva-logging.cfg'))
for cfg in [x for x in logcfgs if os.path.exists(x)]:
logging.config.fileConfig(cfg)
def usage():
print """%s <host> <port>
@ -36,12 +38,22 @@ where host and port specify the connection parameters. Host is the
hostname or ip address to listen on.
""" % sys.argv[0]
class GnuviechAdminXMLRPCServer(SimpleXMLRPCServer):
def __init__(self, server_address, **kwargs):
try:
SimpleXMLRPCServer.__init__(self, server_address, **kwargs)
except socket.gaierror, e:
self.address_family = socket.AF_INET6
SimpleXMLRPCServer.__init__(self, server_address, **kwargs)
def main():
if (sys.argv.__len__() < 3):
usage()
sys.exit()
from SimpleXMLRPCServer import SimpleXMLRPCServer
server = SimpleXMLRPCServer(("localhost", 9999), allow_none=True)
server = GnuviechAdminXMLRPCServer((sys.argv[1], int(sys.argv[2])),
allow_none=True)
server.register_introspection_functions()
from gnuviechadmin.xmlrpc import XMLRPCFacade