]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Use teuthology.misc.get_distro and teuthology.misc.get_distro_
authorAndrew Schoen <aschoen@redhat.com>
Wed, 17 Dec 2014 15:20:19 +0000 (09:20 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 18 Dec 2014 16:45:51 +0000 (10:45 -0600)
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>
teuthology/misc.py
teuthology/provision.py
teuthology/task/internal.py

index 44088842471bee7f4b5936fe8197bfe6e025773e..d4fa4fb2b5b71aa1e09d70df272a8c7f9485d5c3 100644 (file)
@@ -1154,7 +1154,9 @@ def get_distro(ctx):
     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:
index 8bc1ca7e263ecc1cb04c821297fbc1c21b17e0cb..07ac8bb4006ccbec6f6ed104ce2b29fba056e1c7 100644 (file)
@@ -5,10 +5,9 @@ import tempfile
 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__)
 
index b77c24fbbb6c5937bf660ed9216dfa401843b143..430b5fed100b58fcbfab7ca4b824734a0db3c980 100644 (file)
@@ -65,8 +65,8 @@ def lock_machines(ctx, config):
     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'