r5485 - in trunk/cumin: model/upgrades python/cumin

tmckay at fedoraproject.org tmckay at fedoraproject.org
Thu Sep 27 19:35:55 UTC 2012


Author: tmckay
Date: 2012-09-27 19:35:54 +0000 (Thu, 27 Sep 2012)
New Revision: 5485

Added:
   trunk/cumin/model/upgrades/1.3_to_1.3a
Modified:
   trunk/cumin/python/cumin/admin.py
Log:
Bump the schema version from 1.3 to 1.3a
Check the db auth configuration in the upgrade script and apply
the changes in 1.1_to_1.1a if they have not already been applied.
Since this is the end of the schema version, everything should
be back in sync at this point for users that missed 1.1_to_1.1a.


Added: trunk/cumin/model/upgrades/1.3_to_1.3a
===================================================================
--- trunk/cumin/model/upgrades/1.3_to_1.3a	                        (rev 0)
+++ trunk/cumin/model/upgrades/1.3_to_1.3a	2012-09-27 19:35:54 UTC (rev 5485)
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+import subprocess
+import os
+import re
+
+# The cumin db auth changes can be missed if users
+# have a schema version already > 1.1 when they run
+# cumin-amdin upgrade-schema since the auth changes were
+# injected in the change from 1.1 to 1.1a.
+
+# Therefore, we scan for the pg_hba.conf changes here.
+# If everything is right, there will be no action.
+# Otherwise, the 1.1_to_1.1a script will be run
+# (it touches only db config data for auth).
+# With the subsequent version change 1.3a, everyone
+# should be on the same page regardess of path
+
+PG_HBA_CONF = "/var/lib/pgsql/data/pg_hba.conf"
+
+home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
+
+old = re.compile("^\s*(local|host|hostssl|hostnossl)\s*cumin\s*cumin.*trust\s*$")
+lines = file(PG_HBA_CONF).readlines()
+for l in lines:
+    if old.match(l):
+        # Okay, we have old config lines to get rid of.
+        subprocess.Popen(os.path.join(home, "model/upgrades/1.1_to_1.1a"), 
+                         shell=True).wait()
+        break


Property changes on: trunk/cumin/model/upgrades/1.3_to_1.3a
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/cumin/python/cumin/admin.py
===================================================================
--- trunk/cumin/python/cumin/admin.py	2012-09-27 19:20:39 UTC (rev 5484)
+++ trunk/cumin/python/cumin/admin.py	2012-09-27 19:35:54 UTC (rev 5485)
@@ -7,7 +7,7 @@
 
 log = logging.getLogger("cumin.admin")
 
-schema_version = "1.3"
+schema_version = "1.3a"
 
 class SchemaMissing(Exception):
     pass



More information about the cumin-developers mailing list