Use MySQLDB transactions properly.

manage_projects._get_group_uuid() was creating cursors on the globally
managed DB connection which put a write lock on the DB tables. This lock
was never released breaking subsequent writes to the table in the same
process (lock is released when the connection goes away). This meant
that manage_projects could create and read back the UUID for one group,
but mutliple group creation failed on the write lock. Fix this by
performing a commit() on the db connection after each UUID is read.

Change-Id: I75582f5f4efc9982b4606f7f29665f6ff301ad03
Fixes-bug: 1242569
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index 770fab5..634ce42 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -173,11 +173,13 @@
 def _get_group_uuid(group):
     """Wait for up to 10 seconds for the group to be created in the DB."""
     query = "SELECT group_uuid FROM account_groups WHERE name = %s"
+    con = jeepyb.gerritdb.connect()
     for x in range(10):
-        cursor = jeepyb.gerritdb.connect().cursor()
+        cursor = con.cursor()
         cursor.execute(query, group)
         data = cursor.fetchone()
         cursor.close()
+        con.commit()
         if data:
             return data[0]
         time.sleep(1)