diff --git a/pyweb/mumble/management/server_detect.py b/pyweb/mumble/management/server_detect.py index 30bc604..9871dda 100644 --- a/pyweb/mumble/management/server_detect.py +++ b/pyweb/mumble/management/server_detect.py @@ -115,18 +115,14 @@ def find_existing_instances( **kwargs ): "srvid": id, } - if v > 1: - print "Found new Murmur instance %d on bus '%s'... " % ( id, dbusName ), + if v: + print "Found new Murmur instance %d on bus '%s'... " % ( id, dbusName ) # now create a model for the record set. instance = Mumble( **values ); else: - if v > 1: - print "Syncing Murmur instance... ", - - - if v > 1: - print instance.name; + if v: + print "Syncing Murmur instance %d: '%s'... " % ( instance.id, instance.name ) try: instance.configureFromMurmur(); @@ -163,7 +159,7 @@ def find_existing_instances( **kwargs ): if v > 1: print "Looking for registered Players on Server id %d." % id; instance.readUsersFromMurmur( verbose=v ); - elif v > 1: + elif v: print "This server is not running, can't sync players."; if v > 1: diff --git a/pyweb/mumble/management/update_schema.py b/pyweb/mumble/management/update_schema.py index 934f8db..c3b4dfc 100644 --- a/pyweb/mumble/management/update_schema.py +++ b/pyweb/mumble/management/update_schema.py @@ -26,7 +26,15 @@ from mumble.management.server_detect import find_existing_instances def update_schema( **kwargs ): - scriptpath = join( + if "verbosity" in kwargs: + v = kwargs['verbosity']; + else: + v = 1; + + if v: + print "Migrating Database schema for Mumble-Django 2.0 now." + + scriptdir = join( settings.MUMBLE_DJANGO_ROOT, "pyweb", "mumble", "conversionsql", { 'postgresql_psycopg2': 'pgsql', 'postgresql': 'pgsql', @@ -35,14 +43,20 @@ def update_schema( **kwargs ): }[settings.DATABASE_ENGINE] ) - scripts = [ filename for filename in os.listdir( scriptpath ) if filename.endswith( ".sql" ) ] + if v > 1: + print "Reading migration scripts for %s from '%s'" % ( settings.DATABASE_ENGINE, scriptdir ) + + scripts = [ filename for filename in os.listdir( scriptdir ) if filename.endswith( ".sql" ) ] scripts.sort() for filename in scripts: cursor = connection.cursor() - scriptfile = open( os.path.join( scriptpath, filename ), "r" ) + scriptpath = os.path.join( scriptdir, filename ) + scriptfile = open( scriptpath, "r" ) try: + if v > 1: + print "Running migration script '%s'..." % scriptpath stmt = scriptfile.read() cursor.execute( stmt ) @@ -58,4 +72,7 @@ def update_schema( **kwargs ): scriptfile.close() cursor.close() + if v: + print "Database migration finished successfully." + find_existing_instances( **kwargs ) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index e7435bc..47b3d01 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -328,7 +328,7 @@ class Mumble( models.Model ): else: if verbose > 1: - print "Player '%s' is already listed in the database." % playerdata.name; + print "Player '%s' is already known." % playerdata.name; playerinstance = MumbleUser.objects.get( server=self, mumbleid=playerdata.userid ); playerinstance.name = playerdata.name;