No need to be passing ctx to update_lock()

... or update_keys() or scan_for_locks()

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
This commit is contained in:
Zack Cerza 2014-05-20 18:27:53 -05:00 committed by Zack Cerza
parent 8048dc348c
commit 5e5c32ef79
2 changed files with 9 additions and 9 deletions

View 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

View 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():