version in the internal.lock_machines task.
When the internal task wasn't using get_distro to retrieve os_type it
could set os_type to None, causing the lock to fail. This happened when
there was not an os_type defined in the config or a --os-type flag given.
Now, os_type will be properly defaulted to ubuntu when trying to lock
bare metal machines.
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
Get the name of the distro that we are using (usually the os_type).
"""
os_type = None
- # first, try to get the os_type from the config of --os-type
+ # first, try to get the os_type from the config or --os-type
+ # note that if --os-type is passed it's assigned to config["os_type"]
+ # in teuthology.run.py
try:
os_type = ctx.config.get('os_type', ctx.os_type)
except AttributeError:
import yaml
from .config import config
-from .misc import decanonicalize_hostname
+from .misc import decanonicalize_hostname, get_distro, get_distro_version
from .lockstatus import get_status
-from .misc import get_distro
-from .misc import get_distro_version
+
log = logging.getLogger(__name__)
new machines. This is not called if the one has teuthology-locked
machines and placed those keys in the Targets section of a yaml file.
"""
- os_type = ctx.config.get('os_type')
- os_version = ctx.config.get('os_version')
+ os_type = misc.get_distro(ctx)
+ os_version = misc.get_distro_version(ctx)
arch = ctx.config.get('arch')
log.info('Locking machines...')
assert isinstance(config[0], int), 'config[0] must be an integer'