]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
misc: Check for 'None' string from yaml
authorSam Lang <sam.lang@inktank.com>
Wed, 17 Apr 2013 00:08:45 +0000 (19:08 -0500)
committerSam Lang <sam.lang@inktank.com>
Wed, 17 Apr 2013 15:36:42 +0000 (10:36 -0500)
The description attribute from the machines yaml returned by the
locker might be the string 'None'.  Need to explicitly check for
that to avoid using a test dir of /tmp/cephtest/None.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
teuthology/misc.py

index 13f60a31d8248d1e4906d3a3f78e5ef2a2ae69f6..3cd9dc8828a89c7c533a3643f479c712ad90f0fd 100644 (file)
@@ -38,15 +38,20 @@ def get_testdir(ctx):
         jobids = {}
         for machine in ctx.config['targets'].iterkeys():
             status = lockstatus.get_status(ctx, machine)
+            if status is None or 'description' not in status:
+                continue
             jid = status['description'].split('/')[-1]
+            if jid is None or jid == 'None':
+                continue
             jobids[jid] = 1
             if len(jobids) > 1:
                 break
         if len(jobids) == 1:
             # same job id on all machines, use that as the test subdir
             (jobid,) = jobids.iterkeys()
-            global_jobid = jobid
-            log.debug('setting my jobid to {jid}'.format(jid=global_jobid))
+            if jobid is not None:
+                global_jobid = jobid
+                log.debug('setting my jobid to {jid}'.format(jid=global_jobid))
         checked_jobid = True
 
     # the subdir is chosen using the priority:
@@ -54,7 +59,7 @@ def get_testdir(ctx):
     # 2. run name specified by teuthology schedule
     # 3. user@timestamp
     if global_jobid is not None:
-        log.debug('with jobid basedir: {b}'.format(b=str(global_jobid)))
+        log.debug('with jobid basedir: {b}'.format(b=global_jobid))
         return '{basedir}/{jobid}'.format(
                     basedir=basedir,
                     jobid=global_jobid,