]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Allow .teuthology.yaml to set downburst path
authorWarren Usui <warren.usui@inktank.com>
Sat, 10 May 2014 00:20:26 +0000 (17:20 -0700)
committerWarren Usui <warren.usui@inktank.com>
Sat, 10 May 2014 00:20:26 +0000 (17:20 -0700)
If .teuthology.yaml defines downburst, _get_downburst_exec()
now returns that value as the path to the downburst executable.

Also cleaned up code in create_if_vm.  ctx.downburst_conf was
never defined, so the code that handled the AttributeError
was always being executed.

Fixes: 6921
Signed-off-by: Warren Usui <warren.usui@inktank.com>
README.rst
teuthology/lock.py

index dac71bb841141da93a406282b98154ecbf0fcf37..0bb499d3de6108cbfa8a0791d62d202cbd76a675 100644 (file)
@@ -418,6 +418,12 @@ These values are used by downburst to create the virtual machine.
 When locking a file, a downburst meta-data yaml file can be specified by using
 the downburst-conf parameter on the command line.
 
+To find the downburst executable, teuthology first checks the PATH environment
+variable.  If not defined, teuthology next checks for
+src/downburst/virtualenv/bin/downburst executables in the user's home
+directory, /home/ubuntu, and /home/teuthology.  This can all be overridden if
+the user specifies a downburst field in the user's .teuthology.yaml file.
+
 HOST KEYS:
 ----------
 
index fafe0b8612baad3911aa7061d0a53af03ac47e34..20704d2f209db5ccf9caac5b32ea7a953d54aa67 100644 (file)
@@ -419,6 +419,8 @@ def _get_downburst_exec():
     Then check in ~/src, ~ubuntu/src, and ~teuthology/src.
     Return '' if no executable downburst is found.
     """
+    if config.downburst:
+        return config.downburst
     path = os.environ.get('PATH', None)
     if path:
         for p in os.environ.get('PATH', '').split(os.pathsep):
@@ -448,21 +450,10 @@ def create_if_vm(ctx, machine_name):
 
     createMe = decanonicalize_hostname(machine_name)
     with tempfile.NamedTemporaryFile() as tmp:
-        try:
-            lfile = ctx.downburst_conf
-            with open(lfile) as downb_yaml:
-                lcnfg = yaml.safe_load(downb_yaml)
-                if lcnfg.keys() == ['downburst']:
-                    lcnfg = lcnfg['downburst']
-        except (TypeError, AttributeError):
-            if hasattr(ctx, 'config') and ctx.config is not None:
-                lcnfg = ctx.config.get('downburst', dict())
-            else:
-                lcnfg = {}
-        except IOError:
-            print "Error reading %s" % lfile
-            return False
-
+        if hasattr(ctx, 'config') and ctx.config is not None:
+            lcnfg = ctx.config.get('downburst', dict())
+        else:
+            lcnfg = {}
         distro = lcnfg.get('distro', os_type.lower())
         distroversion = lcnfg.get('distroversion', os_version)