[Commits] idmgr branch master updated.

Martin Langhoff martin at laptop.org
Mon Aug 10 20:55:44 EDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/olpc-code/git/projects/idmgr".

The branch, master has been updated
       via  7480458321745e677edf51302dd35ec316a79bf6 (commit)
       via  5ef89de945bc6eeb7aeeedb4d87ba2985bab9d0c (commit)
       via  d1b4a819762420a332ca099cfa9008175b4608bc (commit)
       via  2f465906baa11e391b160ef5223af22b1259c70e (commit)
      from  ed0f2e0a5935819eeed68d4ed6d5dc21a4a42ebd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

 conf.schoolserver/idmgr        |    3 ++-
 idmgr.spec.in                  |    4 +++-
 scripts/update_users_1_to_2.py |   15 +++++++++------
 scripts/update_users_2_to_3.py |   17 +++++++++--------
 4 files changed, 23 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit 7480458321745e677edf51302dd35ec316a79bf6
Author: Martin Langhoff <martin at laptop.org>
Date:   Tue Aug 11 02:53:49 2009 +0200

    update_users_2_to_3: fix broken "v3" detection
    
    the script did try to spot a good v3 DB, but it had
    the wrong column name. With this, a v3 DB is spotted
    right away.

diff --git a/scripts/update_users_2_to_3.py b/scripts/update_users_2_to_3.py
index c50f48a..ad3a77b 100644
--- a/scripts/update_users_2_to_3.py
+++ b/scripts/update_users_2_to_3.py
@@ -29,7 +29,7 @@ conn = sqlite3.connect(DBFILE)
 try:
     # if the select doesn't raise an exception, the column must
     # already exist.
-    conn.execute('SELECT group FROM laptops')
+    conn.execute('SELECT class_group FROM laptops')
 except Exception, e:
     conn.execute('ALTER TABLE laptops ADD COLUMN class_group INTEGER')
 else:

commit 5ef89de945bc6eeb7aeeedb4d87ba2985bab9d0c
Author: Martin Langhoff <martin at laptop.org>
Date:   Tue Aug 11 02:47:16 2009 +0200

    rpm: fix creation of the DB to also set the rev number

diff --git a/idmgr.spec.in b/idmgr.spec.in
index 6e67ae7..a4098b7 100644
--- a/idmgr.spec.in
+++ b/idmgr.spec.in
@@ -46,8 +46,10 @@ getent group xousers > /dev/null 2>&1 || groupadd xousers
 
 %post
 #  Create the identity database, if there is no pre-existing one
+#  and set the current rev number
 if [ ! -r /home/idmgr/identity.db ] ; then
    /home/idmgr/create_registration
+   echo 3 > /home/idmgr/storage_format_version
 fi
 
 if [ ! -r /home/idmgr/storage_format_version ] || \
@@ -65,7 +67,7 @@ if [ ! -r /home/idmgr/storage_format_version ] || \
 fi
 
 if [ ! -r /home/idmgr/storage_format_version ] || \
-   [ `< /home/idmgr/storage_format_version` == 2 ] ; then
+   [ `cat /home/idmgr/storage_format_version` == 2 ] ; then
    # Add database column for group
    /home/idmgr/update_users_2_to_3.py && \
    echo 3 > /home/idmgr/storage_format_version

commit d1b4a819762420a332ca099cfa9008175b4608bc
Author: Martin Langhoff <martin at laptop.org>
Date:   Tue Aug 11 02:41:39 2009 +0200

    upgrades: fix upgrade scripts handling of a running idmgr
    
    the logic was quite problematic. Now we check for /var/lock/subsys/idmgr
    as the status, try and stop it if it was running. If the stop fails,
    we fail. If the stop succeeds, we'll try to start it after we're done.

diff --git a/scripts/update_users_1_to_2.py b/scripts/update_users_1_to_2.py
index c8b9035..092613d 100644
--- a/scripts/update_users_1_to_2.py
+++ b/scripts/update_users_1_to_2.py
@@ -18,6 +18,7 @@
 import sys
 import subprocess
 import sqlite3
+import os.path
 
 DBFILE='/home/idmgr/identity.db'
 
@@ -28,8 +29,10 @@ DBFILE='/home/idmgr/identity.db'
 #/etc/init.d/idmgr is fine, except it doesn't really match the care
 #that 'condrestart' takes with build environments. Oh well. Onwards.
 
-#Assume failure to stop means not running. 0 == success
-running = not subprocess.call(('/etc/init.d/idmgr', 'stop'))
+wasrunning = os.path.exists('/var/lock/subsys/idmgr')
+
+if wasrunning:
+    subprocess.check_call(['/etc/init.d/idmgr', 'stop'])
 
 conn = sqlite3.connect(DBFILE)
 
@@ -52,8 +55,8 @@ else:
     print >> sys.stderr, "Laptops table seems to have lastmodified column!"
 
 
-if running:
-    failed = subprocess.call(('/etc/init.d/idmgr', 'start'))
-    if failed:
-        print >> sys.stderr, "Couldn't restart idmgr after updating database (return code %s)" % worked
+if wasrunning:
+    errcode = subprocess.call(['/etc/init.d/idmgr', 'start'])
+    if errcode:
+        print >> sys.stderr, "Couldn't restart idmgr after updating database (return code %s)" % errcode
 
diff --git a/scripts/update_users_2_to_3.py b/scripts/update_users_2_to_3.py
index 7f232fe..c50f48a 100644
--- a/scripts/update_users_2_to_3.py
+++ b/scripts/update_users_2_to_3.py
@@ -14,14 +14,15 @@
 import sys
 import subprocess
 import sqlite3
+import os.path
 
 DBFILE='/home/idmgr/identity.db'
 
 
-# Try to stop idmgr before altering the database. If stopping is
-# successful, restart it afterwards.
+wasrunning = os.path.exists('/var/lock/subsys/idmgr')
 
-running = not subprocess.call(('/etc/init.d/idmgr', 'stop'))
+if wasrunning:
+    subprocess.check_call(['/etc/init.d/idmgr', 'stop'])
 
 conn = sqlite3.connect(DBFILE)
 
@@ -34,8 +35,8 @@ except Exception, e:
 else:
     print >> sys.stderr, "Laptops table seems to have group column!"
 
-if running:
-    failed = subprocess.call(('/etc/init.d/idmgr', 'start'))
-    if failed:
-        print >> sys.stderr, "Couldn't restart idmgr after updating database (return code %s)" % worked
+if wasrunning:
+    errcode = subprocess.call(['/etc/init.d/idmgr', 'start'])
+    if errcode:
+        print >> sys.stderr, "Couldn't restart idmgr after updating database (return code %s)" % errcode
 

commit 2f465906baa11e391b160ef5223af22b1259c70e
Author: Martin Langhoff <martin at laptop.org>
Date:   Tue Apr 28 20:32:02 2009 +0200

    idmgr.init: - fixups

diff --git a/conf.schoolserver/idmgr b/conf.schoolserver/idmgr
index 3446632..9001b18 100755
--- a/conf.schoolserver/idmgr
+++ b/conf.schoolserver/idmgr
@@ -32,9 +32,10 @@ OPTS="$PID_FILE "
 prog=idmgr
 SERVER=/usr/bin/registration-server
 RETVAL=0
+SYS_DOMAIN_FILE=/etc/sysconfig/xs_domain_name
 
 check_domain_configured() {
-    if [ ! -e /etc/sysconfig/xs_domain_name ]; then
+    if [ ! -e $SYS_DOMAIN_FILE ]; then
 	echo "Domain not configured yet" > /dev/stderr
 	exit 1;
     fi
-----------------------------------------------------------------------


--
/home/olpc-code/git/projects/idmgr


More information about the Commits mailing list