]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
No need to be passing ctx to update_lock()
authorZack Cerza <zack@cerza.org>
Tue, 20 May 2014 23:27:53 +0000 (18:27 -0500)
committerZack Cerza <zack.cerza@inktank.com>
Mon, 25 Aug 2014 17:14:37 +0000 (11:14 -0600)
... or update_keys() or scan_for_locks()

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/lock.py
teuthology/task/internal.py

index 4ce5f42f6d2f13d013700ad934edda53697b0e92..b57dadc41bd194d061fe68e85c31b7cccbb5ddb4 100644 (file)
@@ -90,7 +90,7 @@ def main(ctx):
             # Avoid ssh-keyscans for everybody when listing all machines
             # Listing specific machines will update the keys.
             if machines:
-                scan_for_locks(ctx, vmachines)
+                scan_for_locks(vmachines)
                 statuses = [get_status(machine)
                             for machine in machines]
             else:
@@ -196,7 +196,7 @@ def main(ctx):
 
     if ctx.desc is not None or ctx.status is not None:
         for machine in machines_to_update:
-            update_lock(ctx, machine, ctx.desc, ctx.status)
+            update_lock(machine, ctx.desc, ctx.status)
 
     return ret
 
@@ -296,7 +296,7 @@ def list_locks(machine_type=None):
     return None
 
 
-def update_lock(ctx, name, description=None, status=None, ssh_pub_key=None):
+def update_lock(name, description=None, status=None, ssh_pub_key=None):
     status_info = get_status(name)
     phys_host = status_info['vpshost']
     if phys_host:
@@ -389,15 +389,15 @@ def updatekeys(ctx):
         except IOError as e:
             raise argparse.ArgumentTypeError(str(e))
 
-    return scan_for_locks(ctx, machines)
+    return scan_for_locks(machines)
 
 
-def scan_for_locks(ctx, machines):
+def scan_for_locks(machines):
     out, current_locks = keyscan_check(machines)
-    return update_keys(ctx, out, current_locks)
+    return update_keys(out, current_locks)
 
 
-def update_keys(ctx, out, current_locks):
+def update_keys(out, current_locks):
     ret = 0
     for key_entry in out.splitlines():
         hostname, pubkey = key_entry.split(' ', 1)
@@ -407,7 +407,7 @@ def update_keys(ctx, out, current_locks):
         assert full_name in current_locks, 'host is not in the database!'
         if current_locks[full_name]['ssh_pub_key'] != pubkey:
             log.info('New key found. Updating...')
-            if not update_lock(ctx, full_name, ssh_pub_key=pubkey):
+            if not update_lock(full_name, ssh_pub_key=pubkey):
                 log.error('failed to update %s!', full_name)
                 ret = 1
     return ret
index 393d25bf5216ffaa83e3007e37121e5fb72bd3d7..54d279e58e22955278780020562c6bece07cfa29 100644 (file)
@@ -125,7 +125,7 @@ def lock_machines(ctx, config):
                                 log.info('recreating: ' + guest)
                                 provision.destroy_if_vm(ctx, 'ubuntu@' + guest)
                                 provision.create_if_vm(ctx, 'ubuntu@' + guest)
-                if lock.update_keys(ctx, keyscan_out, current_locks):
+                if lock.update_keys(keyscan_out, current_locks):
                     log.info("Error in virtual machine keys")
                 newscandict = {}
                 for dkey in newly_locked.iterkeys():