|
@ -83,10 +83,7 @@ def find_existing_instances( **kwargs ): |
|
|
if v > 1: |
|
|
if v > 1: |
|
|
print "Successfully connected to Murmur via connection string %s, using %s." % ( dbusName, ctl.method ); |
|
|
print "Successfully connected to Murmur via connection string %s, using %s." % ( dbusName, ctl.method ); |
|
|
|
|
|
|
|
|
default = ctl.getDefaultConf(); |
|
|
|
|
|
|
|
|
|
|
|
servIDs = ctl.getAllServers(); |
|
|
servIDs = ctl.getAllServers(); |
|
|
bootedIDs = ctl.getBootedServers(); |
|
|
|
|
|
|
|
|
|
|
|
for id in servIDs: |
|
|
for id in servIDs: |
|
|
if v > 1: |
|
|
if v > 1: |
|
@ -95,44 +92,25 @@ def find_existing_instances( **kwargs ): |
|
|
try: |
|
|
try: |
|
|
instance = models.Mumble.objects.get( dbus=dbusName, srvid=id ); |
|
|
instance = models.Mumble.objects.get( dbus=dbusName, srvid=id ); |
|
|
except models.Mumble.DoesNotExist: |
|
|
except models.Mumble.DoesNotExist: |
|
|
conf = ctl.getAllConf(id); |
|
|
|
|
|
|
|
|
|
|
|
servername = find_in_dicts( "registername", conf, default, "noname" ); |
|
|
|
|
|
if not servername: |
|
|
|
|
|
# RegistrationName was found in the dicts, but is an empty string |
|
|
|
|
|
servername = "noname"; |
|
|
|
|
|
|
|
|
|
|
|
values = { |
|
|
values = { |
|
|
"name": servername, |
|
|
|
|
|
"srvid": id, |
|
|
"srvid": id, |
|
|
"dbus": dbusName, |
|
|
"dbus": dbusName, |
|
|
"addr": find_in_dicts( ( "registerhostame", "host" ), conf, default, "0.0.0.0" ), |
|
|
|
|
|
"port": find_in_dicts( "port", conf, default ), |
|
|
|
|
|
"url": find_in_dicts( "registerurl", conf, default ), |
|
|
|
|
|
"motd": find_in_dicts( "welcometext", conf, default ), |
|
|
|
|
|
"passwd": find_in_dicts( "password", conf, default ), |
|
|
|
|
|
"supw": '', |
|
|
|
|
|
"users": find_in_dicts( "users", conf, default ), |
|
|
|
|
|
"bwidth": find_in_dicts( "bandwidth", conf, default ), |
|
|
|
|
|
"sslcrt": find_in_dicts( "certificate", conf, default ), |
|
|
|
|
|
"sslkey": find_in_dicts( "key", conf, default ), |
|
|
|
|
|
"booted": ( id in bootedIDs ), |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if values['addr'].find( ':' ) != -1: |
|
|
|
|
|
# The addr is a hostname which actually contains a port number, but we already got that from |
|
|
|
|
|
# the port field, so we can simply drop it. |
|
|
|
|
|
values['addr'] = values['addr'].split(':')[0]; |
|
|
|
|
|
|
|
|
|
|
|
if v: |
|
|
if v: |
|
|
print 'Found new Murmur "%s" running on %s:%s.' % ( values['name'], values['addr'], values['port'] ); |
|
|
|
|
|
|
|
|
print 'Found new Murmur instance... ', |
|
|
|
|
|
|
|
|
# now create a model for the record set. |
|
|
# now create a model for the record set. |
|
|
instance = models.Mumble( **values ); |
|
|
instance = models.Mumble( **values ); |
|
|
instance.save( dontConfigureMurmur=True ); |
|
|
|
|
|
else: |
|
|
else: |
|
|
if v > 1: |
|
|
if v > 1: |
|
|
print "This instance is already listed in the database."; |
|
|
|
|
|
|
|
|
print "Syncing Murmur instance... ", |
|
|
|
|
|
|
|
|
|
|
|
instance.configureFromMurmur(); |
|
|
|
|
|
print instance.name; |
|
|
|
|
|
|
|
|
|
|
|
instance.save( dontConfigureMurmur=True ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Now search for players on this server that have not yet been registered |
|
|
# Now search for players on this server that have not yet been registered |
|
|
if v > 1: |
|
|
if v > 1: |
|
|