]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
lock server: return host pubkeys with locked machine names
authorJosh Durgin <josh.durgin@dreamhost.com>
Thu, 14 Jul 2011 22:26:49 +0000 (15:26 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Wed, 20 Jul 2011 00:13:13 +0000 (17:13 -0700)
teuthology/locker/api.py

index 0a5641ddd95e0617b900de64c2fdd9bb14ee07b5..d5091ffef28141a3ff22bb79bdbb4a63b70a4ea5 100644 (file)
@@ -83,13 +83,17 @@ class Lock:
         while True:
             try:
                 with DB.transaction():
-                    results = list(DB.select('machine', what='name',
+                    results = list(DB.select('machine', what='name, sshpubkey',
                                              where='locked = false and up = true',
                                              limit=num))
                     if len(results) < num:
                         raise web.HTTPError(status='503 Service Unavailable')
-                    names = [row.name for row in results]
-                    num_locked = DB.update('machine', where=web.db.sqlors('name = ', names),
+                    name_keys = {}
+                    for row in results:
+                        name_keys[row.name] = row.sshpubkey
+                    num_locked = DB.update('machine',
+                                           where=web.db.sqlors('name = ',
+                                                               name_keys.keys()),
                                            locked=True,
                                            locked_by=user,
                                            locked_since=web.db.SQLLiteral('NOW()'))
@@ -103,4 +107,4 @@ class Lock:
                 break
 
         web.header('Content-type', 'text/json')
-        return json.dumps(names)
+        return json.dumps(name_keys)