from teuthology.config import set_config_attr
from teuthology.lock import (
- keys,
ops,
util,
query,
vmachines.append(machine['name'])
if vmachines:
log.info("updating host keys for %s", ' '.join(sorted(vmachines)))
- keys.do_update_keys(vmachines, _raise=False)
+ ops.do_update_keys(vmachines, _raise=False)
# get statuses again to refresh any updated keys
statuses = query.get_statuses(machines)
if statuses:
for machine in reimage_machines:
p.spawn(teuthology.provision.reimage, ctx, machine)
for machine in updatekeys_machines:
- keys.do_update_keys([machine])
+ ops.do_update_keys([machine])
ops.update_nodes(reimage_machines + machines_to_update)
elif ctx.unlock:
for doc in docs:
machines = [n for n in doc.get('targets', dict()).keys()]
- return keys.do_update_keys(machines, all_)[0]
+ return ops.do_update_keys(machines, all_)[0]
from teuthology import misc
-from teuthology.lock import ops, query
-
log = logging.getLogger(__name__)
-def do_update_keys(machines, all_=False, _raise=True):
- reference = query.list_locks(keyed_by_name=True)
- if all_:
- machines = reference.keys()
- keys_dict = misc.ssh_keyscan(machines, _raise=_raise)
- return push_new_keys(keys_dict, reference), keys_dict
-
-
-def push_new_keys(keys_dict, reference):
- ret = 0
- for hostname, pubkey in keys_dict.items():
- log.info('Checking %s', hostname)
- if reference[hostname]['ssh_pub_key'] != pubkey:
- log.info('New key found. Updating...')
- if not ops.update_lock(hostname, ssh_pub_key=pubkey):
- log.error('failed to update %s!', hostname)
- ret = 1
- return ret
from teuthology.task import console_log
from teuthology.misc import canonicalize_hostname
-from teuthology.lock import util
-from teuthology.lock import keys
+from teuthology.lock import util, query
log = logging.getLogger(__name__)
log.error('Unable to create virtual machine: %s',
machine)
unlock_one(ctx, machine, user)
- ok_machs = keys.do_update_keys(ok_machs.keys())[1]
+ ok_machs = do_update_keys(ok_machs.keys())[1]
update_nodes(ok_machs)
return ok_machs
elif machine_type in reimage_types:
for machine in machines:
p.spawn(teuthology.provision.reimage, ctx, machine)
reimaged[machine] = machines[machine]
- reimaged = keys.do_update_keys(reimaged.keys())[1]
+ reimaged = do_update_keys(reimaged.keys())[1]
update_nodes(reimaged)
return reimaged
return machines
log.error("Node update/creation failed for %s: %s",
name, response.text)
return response.ok
+
+
+def do_update_keys(machines, all_=False, _raise=True):
+ reference = query.list_locks(keyed_by_name=True)
+ if all_:
+ machines = reference.keys()
+ keys_dict = misc.ssh_keyscan(machines, _raise=_raise)
+ return push_new_keys(keys_dict, reference), keys_dict
+
+
+def push_new_keys(keys_dict, reference):
+ ret = 0
+ for hostname, pubkey in keys_dict.items():
+ log.info('Checking %s', hostname)
+ if reference[hostname]['ssh_pub_key'] != pubkey:
+ log.info('New key found. Updating...')
+ if not update_lock(hostname, ssh_pub_key=pubkey):
+ log.error('failed to update %s!', hostname)
+ ret = 1
+ return ret
import time
import yaml
-import teuthology.lock.keys
import teuthology.lock.ops
import teuthology.lock.query
import teuthology.lock.util
full_name = misc.canonicalize_hostname(guest)
provision.destroy_if_vm(ctx, full_name)
provision.create_if_vm(ctx, full_name)
- if teuthology.lock.keys.do_update_keys(keys_dict)[0]:
+ if teuthology.lock.ops.do_update_keys(keys_dict)[0]:
log.info("Error in virtual machine keys")
newscandict = {}
for dkey in all_locked.keys():